X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Frules.mk;fp=src%2Frules.mk;h=f6bd89b6c47fb2a953c2ea07da09254b7f48b689;hp=8bffe04960838d5974c27f62ca4fba5915d34534;hb=6c9943707d4f33035830eba0587a61a34eaecbc2;hpb=af88821a172c4dfd138b91b2a5148ae50b502fa2 diff --git a/src/rules.mk b/src/rules.mk index 8bffe04..f6bd89b 100644 --- a/src/rules.mk +++ b/src/rules.mk @@ -1,63 +1,45 @@ -######################### -sp := $(sp).x -dirstack_$(sp) := $(d) -d := $(dir) -######################### - -# -# Include the subdirectories--order is not important. -# - -dir := $(d)/moof -include $(dir)/rules.mk - -dir := $(d)/stlplus -include $(dir)/rules.mk - - # # Define rules and targets for Yoink. # -OBJECTS_$(d) := $(patsubst %.c,%.o,$(wildcard $(d)/*.c)) \ - $(patsubst %.cc,%.o,$(wildcard $(d)/*.cc)) -D_FILES_$(d) := $(OBJECTS_$(d):%=%.d) +$(call include,moof stlplus) # Recurse into subdirectories. -ifeq ($(PLATFORM),win32) -OBJECTS_$(d) += $(d)/yoink.o -endif +objects = $(patsubst %.c,$(builddir)/%.o,$(patsubst %.cc,$(builddir)/%.o,$(wildcard $d/*.c $d/*.cc))) -PROGRAM_$(d) := $(call add_exe_suffix,$(d)/yoink) +ifeq (win32,$(platform)) +objects += $b/win32.o # Also compile win32 resource file. +endif -BINARIES := $(BINARIES) $(PROGRAM_$(d)) -CLEAN := $(CLEAN) $(OBJECTS_$(d)) $(D_FILES_$(d)) $(PROGRAM_$(d)) +ifeq (true,$(includeConfig)) +objects += $b/config.o # Also compile in the configuration. +exec += $b/config.c # Make config.c a build target. +$b/config.c: config.mk + $(Q)$(xxd) +endif -$(OBJECTS_$(d)): CF_TGT := -I$(d) -$(OBJECTS_$(d)): $(d)/rules.mk +$(objects): TGT_CFLAGS := -I$d +$(objects): config.h $(this) | $b +# Make all objects depend on config.h; it's excessive, but config.h won't +# be remade otherwise if dependencies are not being generated. The +# alternative is to maintain an accurate list of objects with a dependency +# on config.h. -$(PROGRAM_$(d)): $(OBJECTS_$(d)) $(d)/moof/libmoof.a $(d)/stlplus/libstlplus.a - $(DO_LDX) +exec += $(objects) # Make the objects build targets. +bindir_$b := $b/$(projectName)$(EXEEXT) # Install executable to bindir. +$(bindir_$b): $(objects) $b/moof/libmoof.a $b/stlplus/libstlplus.a + $(Q)$(link_cc) # # Define the run and debug targets. # -YOINK_ENVIRONMENT = YOINK_DATADIR="./data" - -.PHONY: run -run: $(PROGRAM_$(d)) - @$(YOINK_ENVIRONMENT) $< $(YOINK_OPTS) - -.PHONY: debug -debug: $(PROGRAM_$(d)) - @$(YOINK_ENVIRONMENT) gdb $< +run: $(bindir_$b) + $(Q)$< $(YOINKFLAGS) +debug: $(bindir_$b) + $(Q)gdb $< -######################## --include $(D_FILES_$(d)) -d := $(dirstack_$(sp)) -sp := $(basename $(sp)) -######################## +.PHONY: run debug