DEADSOFTWARE

Add comment and TODO to Makefile
[odcread.git] / Makefile
index 441faf9a7e82cf364d1f069d029307221b7bbdba..656105b1c1de1d9709988bf77591889dabe78111 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,18 @@
-# List all source files to be compiled
-SRCS=odcread.cc reader.cc store.cc util.cc alien.cc typeregister.cc \
-       textmodel.cc fold.cc 
+# Modules, each containing:
+#  * $(MODULE)/Make.inc -- makefile include
+#  * $(MODULE)/$(MODULE).h -- minimal "interface" header file
+#  * $(MODULE)/$(MODULE).ih -- internal/implementation header file
+#    (only to be included by sources within the module)
+#  * $(MODULE)/*.cc -- module source files
+MODULES := reader store alien typeregister textmodel fold typepath
+
+CFLAGS += -I.
+
+# Variables for the modules to write to
+SRCS := odcread.cc
+
+# Include module definitions
+include $(patsubst %,%/Make.inc,$(MODULES))
 
 # This rule just links the object files together
 odcread: $(SRCS:.cc=.o)
@@ -17,11 +29,17 @@ 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 .o needs to be rebuilt.
 %.o: %.cc
-       g++ -I. $< -MM -MF $*.d -MP -MT $@
-       g++ -I. $< -c -o $@
+       g++ $(CFLAGS) $< -MM -MF $*.d -MP -MT $@
+       g++ $(CFLAGS) $< -c -o $@
 
 clean:
-       rm -f odcread *.d *.o
+       rm -f odcread *.d *.o */*.o */*.d
 
 # Include the generated dependency files (if they exist)
 -include $(SRCS:.cc=.d)
+
+
+# TODO:
+# Each module has a .ih file that should be *the only* include from the .cc
+# files. These .ih files should be pre-compiled, and dependency caching should
+# be based on the .ih files, not the .cc files.