Almost all kernel makefiles have to include $(TOPDIR)/Rules.make explicitly. 3/4 of the time, this is done at the end of the file. This patch lets you omit the include line in that case. (You still to include Rules.make explicitly if you have special make rules.)
As a positive side effect, we can now get rid of the $(MAKEFILES) kludge. (Hi Michael!) As a negative side effect, we prevent GNU make from being clever and recursing on 'make -n'. Removing 294 copies of "include $(TOPDIR)/Rules.make" (and 575 lines of accompanying whitespace) would be a separate patch.... Peter --- 2.5.39-/Rules.make 2002-09-17 06:28:06.000000000 -0500 +++ 2.5.39/Rules.make 2002-10-02 18:11:30.000000000 -0500 @@ -2,6 +2,8 @@ # This file contains rules which are shared between multiple Makefiles. # +RULES_MAKE_INCLUDED := 1 + # Some standard vars comma := , @@ -459,7 +461,7 @@ sub_dirs: $(subdir-ym) $(subdir-ym): - @$(MAKE) -C $@ $(MAKECMDGOALS) + @$(MAKE) -C $@ -f $(TOPDIR)/Makefile.subdir $(MAKECMDGOALS) # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- --- 2.5.39-/Makefile 2002-10-02 19:21:03.000000000 -0500 +++ 2.5.39/Makefile 2002-10-02 18:27:07.000000000 -0500 @@ -42,6 +42,7 @@ else if [ -x /bin/bash ]; then echo /bin/bash; \ else echo sh; fi ; fi) TOPDIR := $(CURDIR) +MAKESUB := $(MAKE) -f $(TOPDIR)/Makefile.subdir -C HOSTCC = gcc HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer @@ -135,7 +136,6 @@ STRIP = $(CROSS_COMPILE)strip OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump -MAKEFILES = $(TOPDIR)/.config GENKSYMS = /sbin/genksyms DEPMOD = /sbin/depmod KALLSYMS = /sbin/kallsyms @@ -150,7 +150,7 @@ export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ - CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL + CPP AR NM STRIP OBJCOPY OBJDUMP MAKE GENKSYMS PERL export CPPFLAGS EXPORT_FLAGS NOSTDINC_FLAGS OBJCOPYFLAGS export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE @@ -183,7 +183,7 @@ .PHONY: scripts scripts: - @$(MAKE) -C scripts + @$(MAKESUB) scripts ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) @@ -314,7 +314,7 @@ echo ' Generating build number' . scripts/mkversion > .tmp_version mv -f .tmp_version .version - +$(MAKE) -C init + +$(MAKESUB) init $(call cmd,link_vmlinux) echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd $(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map @@ -363,7 +363,7 @@ .PHONY: $(SUBDIRS) $(SUBDIRS): .hdepend prepare - @$(MAKE) -C $@ + @$(MAKESUB) $@ # Things we need done before we descend to build or make # module versions are listed in "prepare" @@ -386,17 +386,17 @@ # --------------------------------------------------------------------------- %.s: %.c FORCE - @$(MAKE) -C $(@D) $(@F) + @$(MAKESUB) $(@D) $(@F) %.i: %.c FORCE - @$(MAKE) -C $(@D) $(@F) + @$(MAKESUB) $(@D) $(@F) %.o: %.c FORCE - @$(MAKE) -C $(@D) $(@F) + @$(MAKESUB) $(@D) $(@F) %.lst: %.c FORCE - @$(MAKE) -C $(@D) $(@F) + @$(MAKESUB) $(@D) $(@F) %.s: %.S FORCE - @$(MAKE) -C $(@D) $(@F) + @$(MAKESUB) $(@D) $(@F) %.o: %.S FORCE - @$(MAKE) -C $(@D) $(@F) + @$(MAKESUB) $(@D) $(@F) # FIXME: The asm symlink changes when $(ARCH) changes. That's # hard to detect, but I suppose "make mrproper" is a good idea @@ -481,7 +481,7 @@ $(update-if-changed) $(patsubst %,_sfdep_%,$(SUBDIRS)): FORCE - @$(MAKE) -C $(patsubst _sfdep_%, %, $@) fastdep + @$(MAKESUB) $(patsubst _sfdep_%, %, $@) fastdep else # !CONFIG_MODVERSIONS @@ -533,7 +533,7 @@ .PHONY: $(patsubst %, _modinst_%, $(SUBDIRS)) $(patsubst %, _modinst_%, $(SUBDIRS)) : - @$(MAKE) -C $(patsubst _modinst_%, %, $@) modules_install + @$(MAKESUB) $(patsubst _modinst_%, %, $@) modules_install else # CONFIG_MODULES @@ -631,11 +631,11 @@ make_with_config xconfig: - @$(MAKE) -C scripts kconfig.tk + @$(MAKESUB) scripts kconfig.tk wish -f scripts/kconfig.tk menuconfig: - @$(MAKE) -C scripts lxdialog + @$(MAKESUB) scripts lxdialog $(CONFIG_SHELL) $(src)/scripts/Menuconfig arch/$(ARCH)/config.in config: @@ -734,7 +734,7 @@ -type f -print | xargs rm -f @rm -f $(MRPROPER_FILES) @rm -rf $(MRPROPER_DIRS) - @$(MAKE) -C scripts mrproper + @$(MAKESUB) scripts mrproper @$(MAKE) -f Documentation/DocBook/Makefile mrproper distclean: mrproper --- /dev/null 2002-07-29 18:50:30.000000000 -0500 +++ 2.5.39/Makefile.subdir 2002-10-02 18:11:39.000000000 -0500 @@ -0,0 +1,7 @@ +# Makefile.subdir: invoke a makefile in a subdirectory. + +include $(TOPDIR)/.config +include Makefile +ifndef RULES_MAKE_INCLUDED + include $(TOPDIR)/Rules.make +endif ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ kbuild-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/kbuild-devel