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