DEADSOFTWARE

Reader split into files
[odcread.git] / Makefile
1 MODULES := reader store alien typeregister textmodel fold typepath
3 # Add module directories to the include path
4 CFLAGS += -I.
6 # Variables for the modules to write to
7 SRCS := odcread.cc
9 # Include module definitions
10 include $(patsubst %,%/Make.inc,$(MODULES))
12 # This rule just links the object files together
13 odcread: $(SRCS:.cc=.o)
14 g++ -o $@ $^
16 # This rule build an object (.o) from a source (.cc). It first builds a
17 # dependency (.d) file which will ensure that the .o is rebuilt whenever the
18 # header files included by the .cc are updated.
19 # The options given to GCC for this are as follows:
20 # -MM : calculate dependencies, but exclude system headers
21 # -MF : output dependencies to the given file
22 # -MP : generate "header.h:" rules to avoid errors on deletion of headers
23 # -MT : the main rule has the given target (to handle subdirs correctly)
24 # The .d file is not an explicit target because it will need to be (re-)built
25 # if and only if the .o needs to be rebuilt.
26 %.o: %.cc
27 g++ $(CFLAGS) $< -MM -MF $*.d -MP -MT $@
28 g++ $(CFLAGS) $< -c -o $@
30 clean:
31 rm -f odcread *.d *.o */*.o */*.d
33 # Include the generated dependency files (if they exist)
34 -include $(SRCS:.cc=.d)