From c955ccafc38e77312b4c65e5a70960080fb8a3f2 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Thu, 8 Jun 2006 22:12:39 -0700 Subject: kconfig: fix .config dependencies This fixes one of the worst kbuild warts left - the broken dependencies used to check and regenerate the .config file. This was done via an indirect dependency and the .config itself had an empty command, which can cause make not to reread the changed .config file. Instead of this we generate now a new file include/config/auto.conf from .config, which is used for kbuild and has the proper dependencies. It's also the main make target now for all files generated during this step (and thus replaces include/linux/autoconf.h). This also means we can now relax the syntax requirements for the .config file and we don't have to rewrite it all the time, i.e. silentoldconfig only writes .config now when it's necessary to keep it in sync with the Kconfig files and even this can be suppressed by setting the environment variable KCONFIG_NOSILENTUPDATE, so the update can (and must) be done manually. Signed-off-by: Roman Zippel Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- Makefile | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a3a7baad8555..b1610562a65f 100644 --- a/Makefile +++ b/Makefile @@ -404,7 +404,7 @@ include $(srctree)/arch/$(ARCH)/Makefile export KBUILD_DEFCONFIG config %config: scripts_basic outputmakefile FORCE - $(Q)mkdir -p include/linux + $(Q)mkdir -p include/linux include/config $(Q)$(MAKE) $(build)=scripts/kconfig $@ $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease @@ -421,8 +421,6 @@ PHONY += scripts scripts: scripts_basic include/config/MARKER $(Q)$(MAKE) $(build)=$(@) -scripts_basic: include/linux/autoconf.h - # Objects we will link into vmlinux / subdirs we need to visit init-y := init/ drivers-y := drivers/ sound/ @@ -436,25 +434,22 @@ ifeq ($(dot-config),1) # Read in dependencies to all Kconfig* files, make sure to run # oldconfig if changes are detected. --include .kconfig.d - -include .config +-include include/config/auto.conf.cmd +-include include/config/auto.conf -# If .config needs to be updated, it will be done via the dependency -# that autoconf has on .config. # To avoid any implicit rule to kick in, define an empty command -.config .kconfig.d: ; +.config include/config/auto.conf.cmd: ; -# If .config is newer than include/linux/autoconf.h, someone tinkered +# If .config is newer than include/config/auto.conf, someone tinkered # with it and forgot to run make oldconfig. -# If kconfig.d is missing then we are probarly in a cleaned tree so +# if auto.conf.cmd is missing then we are probarly in a cleaned tree so # we execute the config step to be sure to catch updated Kconfig files -include/linux/autoconf.h: .kconfig.d .config - $(Q)mkdir -p include/linux +include/config/auto.conf: .config include/config/auto.conf.cmd $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig + else # Dummy target needed, because used as prerequisite -include/linux/autoconf.h: ; +include/config/auto.conf: ; endif # The all: target is the default when no target is given on the @@ -779,7 +774,7 @@ PHONY += prepare-all prepare3: .kernelrelease ifneq ($(KBUILD_SRC),) @echo ' Using $(srctree) as source for kernel' - $(Q)if [ -f $(srctree)/.config ]; then \ + $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ echo " $(srctree) is not clean, please run 'make mrproper'";\ echo " in the '$(srctree)' directory.";\ /bin/false; \ @@ -822,7 +817,7 @@ include/asm: # Split autoconf.h into include/linux/config/* -include/config/MARKER: scripts/basic/split-include include/linux/autoconf.h +include/config/MARKER: scripts/basic/split-include include/config/auto.conf @echo ' SPLIT include/linux/autoconf.h -> include/config/*' @scripts/basic/split-include include/linux/autoconf.h include/config @touch $@ -- cgit From 2e3646e51b2d6415549b310655df63e7e0d7a080 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Thu, 8 Jun 2006 22:12:42 -0700 Subject: kconfig: integrate split config into silentoldconfig Now that kconfig can load multiple configurations, it becomes simple to integrate the split config step, by simply comparing the new .config file with the old auto.conf (and then saving the new auto.conf). A nice side effect is that this saves a bit of disk space and cache, as no data needs to be read from or saved into the splitted config files anymore (e.g. include/config is now 648KB instead of 5.2MB). Signed-off-by: Roman Zippel Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- Makefile | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b1610562a65f..4b996c8fb70a 100644 --- a/Makefile +++ b/Makefile @@ -418,7 +418,7 @@ ifeq ($(KBUILD_EXTMOD),) # Carefully list dependencies so we do not try to build scripts twice # in parrallel PHONY += scripts -scripts: scripts_basic include/config/MARKER +scripts: scripts_basic include/config/auto.conf $(Q)$(MAKE) $(build)=$(@) # Objects we will link into vmlinux / subdirs we need to visit @@ -787,7 +787,7 @@ endif prepare2: prepare3 outputmakefile prepare1: prepare2 include/linux/version.h include/asm \ - include/config/MARKER + include/config/auto.conf ifneq ($(KBUILD_MODULES),) $(Q)mkdir -p $(MODVERDIR) $(Q)rm -f $(MODVERDIR)/* @@ -815,13 +815,6 @@ include/asm: $(Q)if [ ! -d include ]; then mkdir -p include; fi; @ln -fsn asm-$(ARCH) $@ -# Split autoconf.h into include/linux/config/* - -include/config/MARKER: scripts/basic/split-include include/config/auto.conf - @echo ' SPLIT include/linux/autoconf.h -> include/config/*' - @scripts/basic/split-include include/linux/autoconf.h include/config - @touch $@ - # Generate some files # --------------------------------------------------------------------------- -- cgit From f1d28fb043b325dad8944647a52b20287e59d8a1 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Thu, 8 Jun 2006 22:12:43 -0700 Subject: kconfig: move .kernelrelease This moves the .kernelrelease file into include/config directory. Remove its generation from the config step, if the config step doesn't leave a proper .config behind, it triggers a call to silentoldconfig. Instead its generation can be done via proper dependencies. Signed-off-by: Roman Zippel Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- Makefile | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4b996c8fb70a..3c55de99ed31 100644 --- a/Makefile +++ b/Makefile @@ -309,8 +309,8 @@ CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common AFLAGS := -D__ASSEMBLY__ -# Read KERNELRELEASE from .kernelrelease (if it exists) -KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null) +# Read KERNELRELEASE from include/config/kernel.release (if it exists) +KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \ @@ -406,7 +406,6 @@ export KBUILD_DEFCONFIG config %config: scripts_basic outputmakefile FORCE $(Q)mkdir -p include/linux include/config $(Q)$(MAKE) $(build)=scripts/kconfig $@ - $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease else # =========================================================================== @@ -714,7 +713,7 @@ $(vmlinux-dirs): prepare scripts $(Q)$(MAKE) $(build)=$@ # Build the kernel release string -# The KERNELRELEASE is stored in a file named .kernelrelease +# The KERNELRELEASE is stored in a file named include/config/kernel.release # to be used when executing for example make install or make modules_install # # Take the contents of any files called localversion* and the config @@ -748,9 +747,9 @@ endif localver-full = $(localver)$(localver-auto) -# Store (new) KERNELRELASE string in .kernelrelease +# Store (new) KERNELRELASE string in include/config/kernel.release kernelrelease = $(KERNELVERSION)$(localver-full) -.kernelrelease: FORCE +include/config/kernel.release: include/config/auto.conf FORCE $(Q)rm -f $@ $(Q)echo $(kernelrelease) > $@ @@ -771,7 +770,7 @@ PHONY += prepare-all # and if so do: # 1) Check that make has not been executed in the kernel src $(srctree) # 2) Create the include2 directory, used for the second asm symlink -prepare3: .kernelrelease +prepare3: include/config/kernel.release ifneq ($(KBUILD_SRC),) @echo ' Using $(srctree) as source for kernel' $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ @@ -834,7 +833,7 @@ define filechk_version.h ) endef -include/linux/version.h: $(srctree)/Makefile .config .kernelrelease FORCE +include/linux/version.h: $(srctree)/Makefile include/config/kernel.release FORCE $(call filechk,version.h) # --------------------------------------------------------------------------- @@ -930,7 +929,7 @@ CLEAN_FILES += vmlinux System.map \ MRPROPER_DIRS += include/config include2 MRPROPER_FILES += .config .config.old include/asm .version .old_version \ include/linux/autoconf.h include/linux/version.h \ - .kernelrelease Module.symvers tags TAGS cscope* + Module.symvers tags TAGS cscope* # clean - Delete most, but leave enough to build external modules # @@ -1253,8 +1252,8 @@ checkstack: $(PERL) $(src)/scripts/checkstack.pl $(ARCH) kernelrelease: - $(if $(wildcard .kernelrelease), $(Q)echo $(KERNELRELEASE), \ - $(error kernelrelease not valid - run 'make *config' to update it)) + $(if $(wildcard include/config/kernel.release), $(Q)echo $(KERNELRELEASE), \ + $(error kernelrelease not valid - run 'make prepare' to update it)) kernelversion: @echo $(KERNELVERSION) -- cgit From 14cdd3c402bf7c66f0bcd76e290f0770a54a4b21 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Thu, 8 Jun 2006 22:12:51 -0700 Subject: kconfig: KCONFIG_OVERWRITECONFIG If you set KCONFIG_OVERWRITECONFIG in environment, Kconfig will not break symlinks when .config is a symlink to somewhere else. Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3c55de99ed31..3cb9270c584d 100644 --- a/Makefile +++ b/Makefile @@ -178,6 +178,8 @@ CROSS_COMPILE ?= # Architecture as present in compile.h UTS_MACHINE := $(ARCH) +KCONFIG_CONFIG ?= .config + # SHELL used by kbuild CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ else if [ -x /bin/bash ]; then echo /bin/bash; \ @@ -437,13 +439,13 @@ ifeq ($(dot-config),1) -include include/config/auto.conf # To avoid any implicit rule to kick in, define an empty command -.config include/config/auto.conf.cmd: ; +$(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; # If .config is newer than include/config/auto.conf, someone tinkered # with it and forgot to run make oldconfig. # if auto.conf.cmd is missing then we are probarly in a cleaned tree so # we execute the config step to be sure to catch updated Kconfig files -include/config/auto.conf: .config include/config/auto.conf.cmd +include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig else -- cgit From c30a02e022576c1b49a6c9b39ad83559167399c6 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Thu, 8 Jun 2006 22:12:50 -0700 Subject: kbuild: `make kernelrelease' speedup Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3cb9270c584d..abc0051d259a 100644 --- a/Makefile +++ b/Makefile @@ -364,7 +364,8 @@ endif # of make so .config is not included in this case either (for *config). no-dot-config-targets := clean mrproper distclean \ - cscope TAGS tags help %docs check% + cscope TAGS tags help %docs check% \ + kernelrelease kernelversion config-targets := 0 mixed-targets := 0 @@ -1248,7 +1249,7 @@ namespacecheck: endif #ifeq ($(config-targets),1) endif #ifeq ($(mixed-targets),1) -PHONY += checkstack +PHONY += checkstack kernelrelease kernelversion checkstack: $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \ $(PERL) $(src)/scripts/checkstack.pl $(ARCH) -- cgit From 031ecc6de7d17752c57720a118a37e97a8454872 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 8 Jun 2006 22:12:37 -0700 Subject: kbuild: add dependency on kernel.release to the package targets The binrpm-pkg target uses KERNELRELEASE when generated its .spec file. When binrpm-pkg was the first build target run in a tree it generated the .spec before kernel.release so the Version: tag in the .spec was empty. I don't know if this is the best fix, but binrpm-pkg works when we explicitly build kernel.release before descending into package-dir. Signed-off-by: Zach Brown Signed-off-by: Andrew Morton Signed-off-by: Sam Ravnborg --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index abc0051d259a..818d1950e22d 100644 --- a/Makefile +++ b/Makefile @@ -984,9 +984,9 @@ distclean: mrproper # rpm target kept for backward compatibility package-dir := $(srctree)/scripts/package -%pkg: FORCE +%pkg: include/config/kernel.release FORCE $(Q)$(MAKE) $(build)=$(package-dir) $@ -rpm: FORCE +rpm: include/config/kernel.release FORCE $(Q)$(MAKE) $(build)=$(package-dir) $@ -- cgit From 566f81ca598f80de03e80a9a743e94b65b4e017e Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 10 Jun 2006 09:15:27 +0200 Subject: kbuild: ignore make's built-in rules & variables kbuild does explicitly specify what to do in all cases, and each time make's built-in rules & variables has been used it has been a bug. So to speed up things and to avoid the hard-to-debug error situations ignore the built-in definitions. If any part of the kernel uses the built-in definitions the build will just stop there and it should be trivial to fix. Signed-off-by: Sam Ravnborg --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 818d1950e22d..1b2fd97f503a 100644 --- a/Makefile +++ b/Makefile @@ -267,10 +267,9 @@ MAKEFLAGS += --include-dir=$(srctree) # We need some generic definitions include $(srctree)/scripts/Kbuild.include -# For maximum performance (+ possibly random breakage, uncomment -# the following) - -#MAKEFLAGS += -rR +# Do not use make's built-in rules and variables +# This increases performance and avoid hard-to-debug behaviour +MAKEFLAGS += -rR # Make variables (CC, etc...) -- cgit From ac031f26e89cc04fc7504f31ae137857eb83a051 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 21 Jun 2006 20:53:09 -0400 Subject: kbuild: add option for stripping modules while installing them Add option for stripping modules while installing them. This function adds support for stripping modules while they are being installed. CONFIG_DEBUG_KERNEL (which will probably become more popular as developers use kdump) causes the size of the installed modules to grow by a factor of 9 or so. Some kernel package systems solve this problem by stripping the debug information from /lib/modules after running "make modules_install", but that may not work for people who are installing directly into /lib/modules --- root partitions that were sized to handle 16 megs worth of modules may not be quite so happy with 145 megs of modules, so the "make modules_install" never succeeds. This patch allows such users to request modules_install to strip the modules as they are installed. Signed-off-by: "Theodore Ts'o" Signed-off-by: Sam Ravnborg --- Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1b2fd97f503a..d810d6cb4d08 100644 --- a/Makefile +++ b/Makefile @@ -512,6 +512,23 @@ export INSTALL_PATH ?= /boot MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) export MODLIB +# +# INSTALL_MOD_STRIP, if defined, will cause modules to be +# stripped after they are installed. If INSTALL_MOD_STRIP is '1', then +# the default option --strip-debug will be used. Otherwise, +# INSTALL_MOD_STRIP will used as the options to the strip command. + +ifdef INSTALL_MOD_STRIP +ifeq ($(INSTALL_MOD_STRIP),1) +mod_strip_cmd = $STRIP) --strip-debug +else +mod_strip_cmd = $(STRIP) $(INSTALL_MOD_STRIP) +endif # INSTALL_MOD_STRIP=1 +else +mod_strip_cmd = true +endif # INSTALL_MOD_STRIP +export mod_strip_cmd + ifeq ($(KBUILD_EXTMOD),) core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ -- cgit From 3041e47e8b08d51188b2cbdbd9c1e6f43314c8f1 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Sun, 18 Jun 2006 21:09:09 -0700 Subject: kbuild: fix silentoldconfig recursion kconfig-fix-config-dependencies causes this: make CC=cc KBUILD_VERBOSE=1 -C /usr/src/25 SUBDIRS=/home/akpm/NVIDIA-Linux-x86_64-1.0-8762-pkg2/usr/src/nv modules make -f /usr/src/devel/Makefile silentoldconfig make -f /usr/src/devel/Makefile silentoldconfig make -f /usr/src/devel/Makefile silentoldconfig The basic problem is if we compile external modules, config-targets isn't set which can cause recursive calls to silentoldconfig to update the kernel configuration. Bail out and ask the user to update manually. Signed-off-by: Sam Ravnborg --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index d810d6cb4d08..1888fabe4032 100644 --- a/Makefile +++ b/Makefile @@ -446,7 +446,11 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; # if auto.conf.cmd is missing then we are probarly in a cleaned tree so # we execute the config step to be sure to catch updated Kconfig files include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd +ifeq ($(KBUILD_EXTMOD),) $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig +else + $(error kernel configuration not valid - run 'make prepare' in $(srctree) to update it) +endif else # Dummy target needed, because used as prerequisite -- cgit From 15fde6751886fd972a64ed65ba49db309919c504 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Tue, 9 May 2006 20:37:30 +0200 Subject: kbuild: support for %.symtypes files Here is a patch that adds a new -T option to genksyms for generating dumps of the type definition that makes up the symbol version hashes. This allows to trace modversion changes back to what caused them. The dump format is the name of the type defined, followed by its definition (which is almost C): s#list_head struct list_head { s#list_head * next , * prev ; } The s#, u#, e#, and t# prefixes stand for struct, union, enum, and typedef. The exported symbols do not define types, and thus do not have an x# prefix: nfs4_acl_get_whotype int nfs4_acl_get_whotype ( char * , t#u32 ) The symbol type defintion of a single file can be generated with: make fs/jbd/journal.symtypes If KBUILD_SYMTYPES is defined, all the *.symtypes of all object files that export symbols are generated. The single *.symtypes files can be combined into a single file after a kernel build with a script like the following: for f in $(find -name '*.symtypes' | sort); do f=${f#./} echo "/* ${f%.symtypes}.o */" cat $f echo done \ | sed -e '\:UNKNOWN:d' \ -e 's:[,;] }:}:g' \ -e 's:\([[({]\) :\1:g' \ -e 's: \([])},;]\):\1:g' \ -e 's: $::' \ $f \ | awk ' /^.#/ { if (defined[$1] == $0) { print $1 next } defined[$1] = $0 } { print } ' When the kernel ABI changes, diffing individual *.symtype files, or the combined files, against each other will show which symbol changes caused the ABI changes. This can save a tremendous amount of time. Dump the types that make up modversions Signed-off-by: Andreas Gruenbacher Signed-off-by: Sam Ravnborg --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 1888fabe4032..e8906694dcc5 100644 --- a/Makefile +++ b/Makefile @@ -969,7 +969,8 @@ clean: archclean $(clean-dirs) $(call cmd,rmfiles) @find . $(RCS_FIND_IGNORE) \ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ - -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ + -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ + -o -name '*.symtypes' \) \ -type f -print | xargs rm -f # mrproper - Delete all generated files, including .config @@ -1311,6 +1312,8 @@ endif $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.o: %.S prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) +%.symtypes: %.c prepare scripts FORCE + $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) # Modules / %/: prepare scripts FORCE -- cgit From e838db685fcfd2e9a0548ffc5cb9447e6c3c11be Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Thu, 22 Jun 2006 12:21:20 +0900 Subject: kbuild: adding symbols in Kconfig and defconfig to TAGS I'm using TAGS generated from "make TAGS" to read the kernel source code. When I met a ifdef block #ifdef CONFIG_FOO ... #endif in the soruce code I would like to know the meaning CONFIG_FOO to decide whether I should read inside the ifdef block or not. meaning CONFIG_FOO is well documented in Kconfig. So it is nice if I can jump to CONFIG_FOO entry in Kconfig from "#ifdef CONFIG_FOO" with the tag jump. Here is the patch to add symbols in Kconfig and defconfig to TAGS in "make TAGS" operation. Signed-off-by: Masatake YAMATO Signed-off-by: Sam Ravnborg --- Makefile | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e8906694dcc5..a21c3192e8c9 100644 --- a/Makefile +++ b/Makefile @@ -1192,25 +1192,35 @@ endif ALLSOURCE_ARCHS := $(ARCH) -define all-sources - ( find $(__srctree) $(RCS_FIND_IGNORE) \ +define find-sources + ( find $(__srctree) $(RCS_FIND_IGNORE) \ \( -name include -o -name arch \) -prune -o \ - -name '*.[chS]' -print; \ + -name $1 -print; \ for ARCH in $(ALLSOURCE_ARCHS) ; do \ find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \ - -name '*.[chS]' -print; \ + -name $1 -print; \ done ; \ find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ - -name '*.[chS]' -print; \ + -name $1 -print; \ find $(__srctree)include $(RCS_FIND_IGNORE) \ \( -name config -o -name 'asm-*' \) -prune \ - -o -name '*.[chS]' -print; \ + -o -name $1 -print; \ for ARCH in $(ALLINCLUDE_ARCHS) ; do \ find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \ - -name '*.[chS]' -print; \ + -name $1 -print; \ done ; \ find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ - -name '*.[chS]' -print ) + -name $1 -print ) +endef + +define all-sources + $(call find-sources,'*.[chS]') +endef +define all-kconfigs + $(call find-sources,'Kconfig*') +endef +define all-defconfigs + $(call find-sources,'defconfig') endef quiet_cmd_cscope-file = FILELST cscope.files @@ -1230,7 +1240,13 @@ define cmd_TAGS echo "-I __initdata,__exitdata,__acquires,__releases \ -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ --extra=+f --c-kinds=+px"`; \ - $(all-sources) | xargs etags $$ETAGSF -a + $(all-sources) | xargs etags $$ETAGSF -a; \ + if test "x$$ETAGSF" = x; then \ + $(all-kconfigs) | xargs etags -a \ + --regex='/^config[ \t]+\([a-zA-Z0-9_]+\)/\1/'; \ + $(all-defconfigs) | xargs etags -a \ + --regex='/^#?[ \t]?\(CONFIG_[a-zA-Z0-9_]+\)/\1/'; \ + fi endef TAGS: FORCE -- cgit From 070b98bfda3d27269519067c1c67eaef695f3e0c Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 25 Jun 2006 00:07:55 +0200 Subject: kbuild: trivial fixes in Makefile Signed-off-by: Sam Ravnborg --- Makefile | 82 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a21c3192e8c9..1c558a43f8e7 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,7 @@ endif # In both cases the working directory must be the root of the kernel src. # 1) O= # Use "make O=dir/to/store/output/files/" -# +# # 2) Set KBUILD_OUTPUT # Set the environment variable KBUILD_OUTPUT to point to the directory # where the output files shall be placed. @@ -185,13 +185,13 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ else if [ -x /bin/bash ]; then echo /bin/bash; \ else echo sh; fi ; fi) -HOSTCC = gcc -HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -HOSTCXXFLAGS = -O2 +HOSTCC = gcc +HOSTCXX = g++ +HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer +HOSTCXXFLAGS = -O2 -# Decide whether to build built-in, modular, or both. -# Normally, just do built-in. +# Decide whether to build built-in, modular, or both. +# Normally, just do built-in. KBUILD_MODULES := KBUILD_BUILTIN := 1 @@ -199,7 +199,7 @@ KBUILD_BUILTIN := 1 # If we have only "make modules", don't compile built-in objects. # When we're building modules with modversions, we need to consider # the built-in objects during the descend as well, in order to -# make sure the checksums are uptodate before we record them. +# make sure the checksums are up to date before we record them. ifeq ($(MAKECMDGOALS),modules) KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1) @@ -232,7 +232,7 @@ export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD # # If $(quiet) is empty, the whole command will be printed. # If it is set to "quiet_", only the short version will be printed. -# If it is set to "silent_", nothing wil be printed at all, since +# If it is set to "silent_", nothing will be printed at all, since # the variable $(silent_cmd_cc_o_c) doesn't exist. # # A simple variant is to prefix commands with $(Q) - that's useful @@ -268,7 +268,7 @@ MAKEFLAGS += --include-dir=$(srctree) include $(srctree)/scripts/Kbuild.include # Do not use make's built-in rules and variables -# This increases performance and avoid hard-to-debug behaviour +# This increases performance and avoid hard-to-debug behavour MAKEFLAGS += -rR # Make variables (CC, etc...) @@ -306,21 +306,21 @@ LINUXINCLUDE := -Iinclude \ CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) -CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ - -fno-strict-aliasing -fno-common -AFLAGS := -D__ASSEMBLY__ +CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ + -fno-strict-aliasing -fno-common +AFLAGS := -D__ASSEMBLY__ # Read KERNELRELEASE from include/config/kernel.release (if it exists) KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) -export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \ - ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ - CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ - HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS +export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION +export ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC +export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE +export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS -export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE +export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE # When compiling out-of-tree modules, put MODVERDIR in the module @@ -358,7 +358,7 @@ endif # catch them early, and hand them over to scripts/kconfig/Makefile # It is allowed to specify more targets when calling make, including # mixing *config targets and build targets. -# For example 'make oldconfig all'. +# For example 'make oldconfig all'. # Detect when mixed targets is specified, and make a second invocation # of make so .config is not included in this case either (for *config). @@ -417,7 +417,7 @@ else ifeq ($(KBUILD_EXTMOD),) # Additional helpers built in scripts/ # Carefully list dependencies so we do not try to build scripts twice -# in parrallel +# in parallel PHONY += scripts scripts: scripts_basic include/config/auto.conf $(Q)$(MAKE) $(build)=$(@) @@ -443,7 +443,7 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; # If .config is newer than include/config/auto.conf, someone tinkered # with it and forgot to run make oldconfig. -# if auto.conf.cmd is missing then we are probarly in a cleaned tree so +# if auto.conf.cmd is missing then we are probably in a cleaned tree so # we execute the config step to be sure to catch updated Kconfig files include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd ifeq ($(KBUILD_EXTMOD),) @@ -460,7 +460,7 @@ endif # The all: target is the default when no target is given on the # command line. # This allow a user to issue only 'make' to build a kernel including modules -# Defaults vmlinux but it is usually overriden in the arch makefile +# Defaults vmlinux but it is usually overridden in the arch makefile all: vmlinux ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE @@ -492,11 +492,11 @@ CHECKFLAGS += $(NOSTDINC_FLAGS) # warn about C99 declaration after statement CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) -# disable pointer signedness warnings in gcc 4.0 +# disable pointer signed / unsigned warnings in gcc 4.0 CFLAGS += $(call cc-option,-Wno-pointer-sign,) # Default kernel image to build when no specific target is given. -# KBUILD_IMAGE may be overruled on the commandline or +# KBUILD_IMAGE may be overruled on the command line or # set in the environment # Also any assignments in arch/$(ARCH)/Makefile take precedence over # this default value @@ -510,7 +510,7 @@ export INSTALL_PATH ?= /boot # # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory # relocations required by build roots. This is not defined in the -# makefile but the arguement can be passed to make if needed. +# makefile but the argument can be passed to make if needed. # MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) @@ -556,7 +556,7 @@ libs-y := $(libs-y1) $(libs-y2) # Build vmlinux # --------------------------------------------------------------------------- -# vmlinux is build from the objects selected by $(vmlinux-init) and +# vmlinux is built from the objects selected by $(vmlinux-init) and # $(vmlinux-main). Most are built-in.o files from top-level directories # in the kernel tree, others are specified in arch/$(ARCH)Makefile. # Ordering when linking is important, and $(vmlinux-init) must be first. @@ -607,7 +607,7 @@ quiet_cmd_vmlinux_version = GEN .version $(MAKE) $(build)=init # Generate System.map -quiet_cmd_sysmap = SYSMAP +quiet_cmd_sysmap = SYSMAP cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap # Link of vmlinux @@ -754,10 +754,10 @@ _localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f))) localver = $(subst $(space),, \ $(shell cat /dev/null $(_localver)) \ $(patsubst "%",%,$(CONFIG_LOCALVERSION))) - + # If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called # and if the SCM is know a tag from the SCM is appended. -# The appended tag is determinded by the SCM used. +# The appended tag is determined by the SCM used. # # Currently, only git is supported. # Other SCMs can edit scripts/setlocalversion and add the appropriate @@ -823,14 +823,14 @@ prepare0: archprepare FORCE # All the preparing.. prepare prepare-all: prepare0 -# Leave this as default for preprocessing vmlinux.lds.S, which is now -# done in arch/$(ARCH)/kernel/Makefile +# Leave this as default for preprocessing vmlinux.lds.S, which is now +# done in arch/$(ARCH)/kernel/Makefile export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) -# FIXME: The asm symlink changes when $(ARCH) changes. That's -# hard to detect, but I suppose "make mrproper" is a good idea -# before switching between archs anyway. +# FIXME: The asm symlink changes when $(ARCH) changes. That's +# hard to detect, but I suppose "make mrproper" is a good idea +# before switching between archs anyway. include/asm: @echo ' SYMLINK $@ -> include/asm-$(ARCH)' @@ -870,7 +870,7 @@ depend dep: ifdef CONFIG_MODULES -# By default, build modules as well +# By default, build modules as well all: modules @@ -968,7 +968,7 @@ clean: archclean $(clean-dirs) $(call cmd,rmdirs) $(call cmd,rmfiles) @find . $(RCS_FIND_IGNORE) \ - \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ + \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.symtypes' \) \ -type f -print | xargs rm -f @@ -993,9 +993,9 @@ PHONY += distclean distclean: mrproper @find $(srctree) $(RCS_FIND_IGNORE) \ - \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ + \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ - -o -name '.*.rej' -o -size 0 \ + -o -name '.*.rej' -o -size 0 \ -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ -type f -print | xargs rm -f @@ -1088,7 +1088,7 @@ else # KBUILD_EXTMOD # make M=dir modules Make all modules in specified dir # make M=dir Same as 'make M=dir modules' # make M=dir modules_install -# Install the modules build in the module directory +# Install the modules built in the module directory # Assumes install directory is already created # We are always building modules @@ -1147,7 +1147,7 @@ clean: rm-dirs := $(MODVERDIR) clean: $(clean-dirs) $(call cmd,rmdirs) @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \ - \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ + \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ -type f -print | xargs rm -f @@ -1186,7 +1186,7 @@ else ALLINCLUDE_ARCHS := $(ARCH) endif else -#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour. +#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behavour. ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) endif -- cgit