From 8c47c6182fe5319d571ff8771e24516d45afa50a Mon Sep 17 00:00:00 2001 From: Hizenberg469 Date: Sat, 16 Nov 2024 23:38:31 +0530 Subject: [PATCH] updated --- featureful_makefile/Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/featureful_makefile/Makefile b/featureful_makefile/Makefile index 9310d65..69e7157 100644 --- a/featureful_makefile/Makefile +++ b/featureful_makefile/Makefile @@ -1,3 +1,33 @@ + +#Setting a default configuration if invoked with just "make": +CFG ?= debug + +# Config specific settings +ifeq ($(CFG),debug) +CFLAGS += -DDEBUG +else +CFLAGS += -O3 -DNDEBUG +endif + +inform: +ifneq ($(CFG),release) +ifneq ($(CFG),debug) + @echo "Invalid configuration "$(CFG)" specified." + @echo + @echo "Possible choices for configuration are 'CFG=release' and 'CFG=debug'" + @exit 1 +endif +endif + @echo "Configuration "$(CFG) + @echo "--------------------------------------------------" + +rule : dep | inform + +BUILD_DIR = build/$(CFG) +OBJS_DIR = $(BUILD_DIR)/objs +#-------------------------------------------------- + + BINARY=bin CODEDIRS=. lib INCDIRS=. ./include/ # can be list