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.
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))
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; \
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))