DEADSOFTWARE

Add comment and TODO to Makefile
[odcread.git] / Makefile
1 # Modules, each containing:
2 # * $(MODULE)/Make.inc -- makefile include
3 # * $(MODULE)/$(MODULE).h -- minimal "interface" header file
4 # * $(MODULE)/$(MODULE).ih -- internal/implementation header file
5 # (only to be included by sources within the module)
6 # * $(MODULE)/*.cc -- module source files
7 MODULES := reader store alien typeregister textmodel fold typepath
9 CFLAGS += -I.
11 # Variables for the modules to write to
12 SRCS := odcread.cc
14 # Include module definitions
15 include $(patsubst %,%/Make.inc,$(MODULES))
17 # This rule just links the object files together
18 odcread: $(SRCS:.cc=.o)
19 g++ -o $@ $^
21 # This rule build an object (.o) from a source (.cc). It first builds a
22 # dependency (.d) file which will ensure that the .o is rebuilt whenever the
23 # header files included by the .cc are updated.
24 # The options given to GCC for this are as follows:
25 # -MM : calculate dependencies, but exclude system headers
26 # -MF : output dependencies to the given file
27 # -MP : generate "header.h:" rules to avoid errors on deletion of headers
28 # -MT : the main rule has the given target (to handle subdirs correctly)
29 # The .d file is not an explicit target because it will need to be (re-)built
30 # if and only if the .o needs to be rebuilt.
31 %.o: %.cc
32 g++ $(CFLAGS) $< -MM -MF $*.d -MP -MT $@
33 g++ $(CFLAGS) $< -c -o $@
35 clean:
36 rm -f odcread *.d *.o */*.o */*.d
38 # Include the generated dependency files (if they exist)
39 -include $(SRCS:.cc=.d)
42 # TODO:
43 # Each module has a .ih file that should be *the only* include from the .cc
44 # files. These .ih files should be pre-compiled, and dependency caching should
45 # be based on the .ih files, not the .cc files.