From 040fcc819a2e7783a570f4bdcdd1f2a7f5f06837 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 28 Jan 2006 22:15:55 +0100 Subject: kbuild: improved modversioning support for external modules With following patch a second option is enabled to obtain symbol information from a second external module when a external module is build. The recommended approach is to use a common kbuild file but that may be impractical in certain cases. With this patch one can copy over a Module.symvers from one external module to make symbols (and symbol versions) available for another external module. Updated documentation in Documentation/kbuild/modules.txt Signed-off-by: Sam Ravnborg --- scripts/Makefile.modpost | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts/Makefile.modpost') diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index bf96a61d4b8..563e3c5bd8d 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -39,7 +39,8 @@ include .config include scripts/Kbuild.include include scripts/Makefile.lib -symverfile := $(objtree)/Module.symvers +kernelsymfile := $(objtree)/Module.symvers +modulesymfile := $(KBUILD_EXTMOD)/Modules.symvers # Step 1), find all modules listed in $(MODVERDIR)/ __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) @@ -54,7 +55,9 @@ quiet_cmd_modpost = MODPOST cmd_modpost = scripts/mod/modpost \ $(if $(CONFIG_MODVERSIONS),-m) \ $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \ - $(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \ + $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \ + $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \ + $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(filter-out FORCE,$^) .PHONY: __modpost -- cgit v1.2.3 From 4f1933620f57145212cdbb1ac6ce099eeeb21c5a Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sun, 5 Mar 2006 17:14:10 -0500 Subject: kbuild: change kbuild to not rely on incorrect GNU make behavior The kbuild system takes advantage of an incorrect behavior in GNU make. Once this behavior is fixed, all files in the kernel rebuild every time, even if nothing has changed. This patch ensures kbuild works with both the incorrect and correct behaviors of GNU make. For more details on the incorrect behavior, see: http://lists.gnu.org/archive/html/bug-make/2006-03/msg00003.html Changes in this patch: - Keep all targets that are to be marked .PHONY in a variable, PHONY. - Add .PHONY: $(PHONY) to mark them properly. - Remove any $(PHONY) files from the $? list when determining whether targets are up-to-date or not. Signed-off-by: Paul Smith Signed-off-by: Sam Ravnborg --- scripts/Makefile.modpost | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'scripts/Makefile.modpost') diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 563e3c5bd8d..0cfbe1cf243 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -32,7 +32,7 @@ # Step 4 is solely used to allow module versioning in external modules, # where the CRC of each module is retrieved from the Module.symers file. -.PHONY: _modpost +PHONY := _modpost _modpost: __modpost include .config @@ -60,7 +60,7 @@ quiet_cmd_modpost = MODPOST $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \ $(filter-out FORCE,$^) -.PHONY: __modpost +PHONY += __modpost __modpost: $(wildcard vmlinux) $(modules:.ko=.o) FORCE $(call cmd,modpost) @@ -97,7 +97,7 @@ targets += $(modules) # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- -.PHONY: FORCE +PHONY += FORCE FORCE: @@ -112,3 +112,9 @@ cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) ifneq ($(cmd_files),) include $(cmd_files) endif + + +# Declare the contents of the .PHONY variable as phony. We keep that +# information in a variable se we can use it in if_changed and friends. + +.PHONY: $(PHONY) -- cgit v1.2.3