feat: added configuration and USE_SLIST

This commit is contained in:
Zoëy Noort 2025-05-31 20:43:20 +02:00
parent 14adc54215
commit 721a840908
16 changed files with 57 additions and 9 deletions

View file

@ -18,7 +18,9 @@ TESTS_OBJS = $(patsubst $(TESTS_DIR)/%.c,$(OBJ_DIR)/%.test.o,$(TESTS_SRCS))
TESTS_BINS = $(patsubst $(TESTS_DIR)/%.c,$(BUILD_DIR)/%_test,$(TESTS_SRCS))
# Flags for configuration
CONFIG_FLAGS := $(shell grep -E '^[a-zA-Z0-9_]+=' .config | sed 's/=\(.*\)/=-D\U&/g' | sed 's/=/ /g' | sed 's/y/1/;s/n/0/')
CONFIG_FLAGS := $(shell grep -E '^[a-zA-Z0-9_]+=' .config | sed 's/\([A-Za-z0-9_]*\)=y/-D\1=1/;s/\([A-Za-z0-9_]*\)=n/-D\1=0/')
CFLAGS += $(CONFIG_FLAGS)
all: $(LIBRARY)
@ -62,3 +64,12 @@ fclean: clean
re: fclean all
.PHONY: all clean fclean re tests
CONFIG_FILE := .config
genconfig:
@echo -e " C\t${CONFIG_FILE}"
@echo "USE_SLIST=y" > $(CONFIG_FILE)
@echo "USE_DLIST=y" >> $(CONFIG_FILE)
@echo "USE_STACK=y" >> $(CONFIG_FILE)