From 53cceda7ad4a8ade4006d62a554b725964150472 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 2 May 2008 15:51:08 -0700 Subject: [PATCH] Reduce spurious recompilations for Linux 2.4 datapath. 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 | 1 + datapath/linux-2.4/Makefile.in | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/datapath/Modules.mk b/datapath/Modules.mk index c1b31b35..02970d94 100644 --- a/datapath/Modules.mk +++ b/datapath/Modules.mk @@ -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)) diff --git a/datapath/linux-2.4/Makefile.in b/datapath/linux-2.4/Makefile.in index 74f4c999..ef3a545c 100644 --- a/datapath/linux-2.4/Makefile.in +++ b/datapath/linux-2.4/Makefile.in @@ -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)) -- 2.30.2