X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=Makefile;h=3e394f058f9f266778df401a8587d539ddf54e10;hb=68f5d585dbbada3c3c69ac2cd9ba8e6d2ef3adae;hp=415e3250cebaf0cde6ad7c7995e9f02e2ba2c42a;hpb=cf88fc04686af2b4a34f9ccebc9f517cd83be491;p=odcread.git diff --git a/Makefile b/Makefile index 415e325..3e394f0 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # * $(MODULE)/*.cc -- module source files MODULES := main reader store alien typeregister textmodel fold typepath -CFLAGS := -I. +CFLAGS += -I. # Variables for the modules to write to SRCS := @@ -18,6 +18,7 @@ include $(patsubst %,%/Make.inc,$(MODULES)) odcread: $(SRCS:.cc=.o) g++ -o $@ $^ +# This rule build an object (.o) from a source (.cc). %.o: %.cc g++ $(CFLAGS) $< -c -o $@ @@ -32,22 +33,21 @@ odcread: $(SRCS:.cc=.o) # The .d file is not an explicit target because it will need to be (re-)built # if and only if the .ih.gch needs to be rebuilt. %.ih.gch: %.ih - g++ $(CFLAGS) -x c++-header $< -MM -MF $(dir $@)module.d -MP -MT $@ + g++ $(CFLAGS) -x c++-header $< -MM -MF $*.d -MP -MT $@ g++ $(CFLAGS) -x c++-header $< -o $@ -# This rule build an object (.o) from a source (.cc). # Each module has a .ih file that should be *the only* include from the .cc # files. These .ih files are pre-compiled to .ih.gch, and dependency caching # is based on the .ih files, not the .cc files. define depend_on_compiled_header -$(patsubst %.cc,%.o,$(1)) : $(dir $(1))$(patsubst %/,%,$(dir $(1))).ih.gch +$(patsubst %.cc,%.o,$(1)) : $(dir $(1))module.ih.gch endef $(foreach src,$(SRCS),$(eval $(call depend_on_compiled_header,$(src)))) clean: - rm -f odcread *.o */*.o */*.d */*.ih.gch + rm -f */*.o */module.d */module.ih.gch +dist-clean: clean + rm -f odcread # Include the generated dependency files (if they exist) -include $(patsubst %,%/module.d,$(MODULES)) - -# TODO: rename all %/%.ih files to %/module.ih for simplicity of matching rules