Reduce spurious recompilations for Linux 2.4 datapath.
authorBen Pfaff <blp@nicira.com>
Fri, 2 May 2008 22:51:08 +0000 (15:51 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 2 May 2008 22:51:08 +0000 (15:51 -0700)
We need object files to depend on the build directories, so that the
build directories get created before we try to output files into them.
But making them depend directly on the build directories means that
whenever a build directory changes (including any change to the set of
files inside it) all the source files get recompiled.  So, instead, make
them depend on dummy files inside the directories, which will only get
modified if someone does it intentionally.

datapath/Modules.mk
datapath/linux-2.4/Makefile.in

index c1b31b355ff2c03278b4ca690232df2ac00d149e..02970d94245ef5f4bb7686f9f2e5993347d4743f 100644 (file)
@@ -37,3 +37,4 @@ all_sources = $(foreach module,$(all_modules),$($(module)_sources))
 all_headers = $(foreach module,$(all_modules),$($(module)_headers))
 all_objects = $(patsubst %.c,%.o,$(all_sources))
 all_objdirs = $(addprefix $(builddir)/,$(sort $(dir $(all_objects))))
+all_dummies = $(addsuffix /.dummy,$(all_objdirs))
index 74f4c9999aa5d4c72a3c05bf31538261cc736800..ef3a545cb96b4452404b7d86d3f100f343d093d1 100644 (file)
@@ -20,7 +20,7 @@ distdir: clean
 install:
 all: default
 clean:
-       rm -f $(all_objects) *_mod.o
+       rm -f $(all_objects) *_mod.o $(all_dummies)
        for d in $(all_objdirs); do             \
                while                           \
                        rmdir $$d 2> /dev/null; \
@@ -82,9 +82,10 @@ CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
             echo "-DMODVERSIONS -DEXPORT_SYMTAB \
                   -include $(KSRC)/include/linux/modversions.h")
 
-$(all_objects): $(all_objdirs)
-$(all_objdirs):
-       mkdir -p $@
+$(all_objects): $(all_dummies)
+$(all_dummies):
+       mkdir -p $(@D)
+       touch $@
 
 default: $(patsubst %,%_mod.o,$(all_modules))