X-Git-Url: https://git.kengrimes.com/?p=henge%2Fapc.git;a=blobdiff_plain;f=Makefile;h=62bf1193ccb17282f4c383ae321a64a51ac9bfe6;hp=f86254bb50e5e1f99b9bf4bf41553e4115bb1bd9;hb=3e4496a9ecca4b2e107f4473af2bdd062690ffc4;hpb=6044d5dc0486220559ccbe2c1e1d44f0d401b271 diff --git a/Makefile b/Makefile index f86254b..62bf119 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,9 @@ # Driver sources DRIVERS ?= apc testapc +# Debug Level +DEBUG ?= 1 + # Yacc YACC := bison YFLAGS ?= -v -d -Wall @@ -59,6 +62,8 @@ ifeq (,$(filter clean,$(MAKECMDGOALS))) # Deps should be generated for each source file, when not cleaning cGENDEP = $(if $(wildcard $1),$(subst $(dir $1),,$(filter-out $1 \ %:,$(shell $(CC) -MM -MG $1))),\ $(info [<$1>: no deps - file not found])) +# Filter only missing deps +cMISDEP = $(strip $(foreach dep,$(call cGENDEP,$1),$(if $(wildcard src/$(dep)),,$(dep)))) # S2S will print the command necessary to create a file when called S2S = $(if $(filter $2,$(call NEWER,$2,$3)),$(eval 4 := t),$(eval 4 :=)) S2S += $(if $4,$(info $(call $1,$2,$3))) @@ -74,8 +79,9 @@ cleanCMD = $(if $(wildcard $1),rm $(wildcard $(sort $1))) # Rules .SECONDEXPANSION: $(ldTRG): $$(call ldDEP,$$@) | $(hGEN) ; $(call LDCMD,$^,$@) -%-d.o: CFLAGS+= -Og -ggdb -%.o %-d.o: %.c $$(call cGENDEP,$$(dir $$@)%.c) ; $(call CCMD,$<,$@) +%-d.o: CFLAGS+= -Og -ggdb -DDEBUG=$(DEBUG) +%.o %-d.o: %.c $$(call cGENDEP,$$(dir $$@)%.c); $(call CCMD,$<,$@) +%.o %-d.o: %.c; $(error Missing dependencies for $<: $(call cMISDEP, $<)) %.tab.h: %.tab.c ; %.tab.c: %.y $$(call S2S,YCMD,%.y,$$@) ; %.fsm.c: %.rl $$(call S2S,RLCMD,%.rl,$$@) ;