X-Git-Url: https://git.llucax.com/software/makeit.git/blobdiff_plain/fbe785465ca37676a7c79383e5d1e555e34da660..9d6ff85e4983acfed399383a792d4015b5b8e381:/Makeit.mak diff --git a/Makeit.mak b/Makeit.mak index 5b788ea..8964fe2 100644 --- a/Makeit.mak +++ b/Makeit.mak @@ -34,8 +34,12 @@ COLOR_ARG ?= # See COLOR_CMD comment for details. COLOR_WARN ?= 00;36 -# Flavor (variant), should be one of "dbg", "opt" or "cov" -F ?= opt +# ANSI color used for commands output if $(COLOR) is non-empty +# See COLOR_CMD comment for details. +COLOR_OUT ?= 00;31 + +# Flavor (variant), can be defined by the user in Config.mak +F ?= default # Use C++ linker by default LINKER := $(CXX) @@ -167,11 +171,14 @@ abbr = $(if $(call eq,$(call abbr_helper,$1),$1),$1,$(addprefix \ # pretty print. vexec_pc = $(if $1,\033[$1m%s\033[00m,%s) vexec_p = $(if $(COLOR), \ - ' $(call vexec_pc,$(COLOR_CMD)) $(call vexec_pc,$(COLOR_ARG))\n', \ + ' $(call vexec_pc,$(COLOR_CMD)) $(call vexec_pc,$(COLOR_ARG))\n$(if \ + $(COLOR_OUT),\033[$(COLOR_OUT)m)', \ ' %s %s\n') vexec = $(if $V,printf $(vexec_p) \ '$(call abbr,$(if $3,$(strip $3),$(firstword $1)))' \ - '$(call abbr,$(if $2,$(strip $2),$@))' ; )$1 + '$(call abbr,$(if $2,$(strip $2),$@))' ; )$1 \ + $(if $V,$(if $(COLOR),$(if $(COLOR_OUT), \ + ; r=$$? ; printf '\033[00m' ; exit $$r))) # Same as vexec but it silence the echo command (prepending a @ if $V). exec = $V$(call vexec,$1,$2,$3) @@ -304,43 +311,19 @@ valgrind = $(call exec,$(if $(VALGRIND),$(VALGRIND_CMD)) $1,\ # Overridden flags ################## -# Warn about everything -override CPPFLAGS += -Wall - # Use the includes directories to search for includes override CPPFLAGS += -I$(INCLUDE_DIR) # Let the program know where it will be installed override CPPFLAGS += -DPREFIX=$(prefix) -# Be standard compliant -override CFLAGS += -std=c99 -pedantic -override CXXFLAGS += -std=c++98 -pedantic - # Use the generated library directory to for libraries -override LDFLAGS += -L$L -Wall +override LDFLAGS += -L$L # Make sure the generated libraries can be found export LD_LIBRARY_PATH := $L:$(LD_LIBRARY_PATH) -# Variant flags -################ - -ifeq ($F,dbg) -override CPPFLAGS += -ggdb -DDEBUG -endif - -ifeq ($F,opt) -override CPPFLAGS += -O2 -DNDEBUG -endif - -ifeq ($F,cov) -override CPPFLAGS += -ggdb -pg --coverage -override LDFLAGS += -pg --coverage -endif - - # Automatic dependency handling ################################ @@ -471,14 +454,11 @@ test: $$(test) # Create $O, $B, $L, $D and $(INCLUDE_DIR) directories and replicate the # directory structure of the project into $O. Create one symbolic link "last" # to the current build directory. -# -# NOTE: the second mkdir can yield no arguments if the project don't have any -# subdirectories, that's why the current directory "." is included, so it -# won't show an error message in case of no subdirectories. setup_build_dir__ := $(shell \ mkdir -p $O $B $L $D $(INCLUDE_DIR) $(addprefix $O,$(patsubst $T%,%,\ $(shell find $T -type d $(foreach d,$(BUILD_DIR_EXCLUDE), \ - -not -path '*/$d' -not -path '*/$d/*')))); \ + -not -path '$T/$d' -not -path '$T/$d/*' \ + -not -path '$T/*/$d' -not -path '$T/*/$d/*')))); \ rm -f $(VD)/last && ln -s $F $(VD)/last )