* [1/12] kbuild: Check for undefined symbols in vmlinux
2004-08-13 19:28 kbuild updates Sam Ravnborg
@ 2004-08-13 19:45 ` Sam Ravnborg
2004-08-13 19:45 ` [2/12] kbuild/sparc: Use new generic mksysmap script to generate System.map Sam Ravnborg
` (10 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:45 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/07 21:35:44+02:00 sam@mars.ravnborg.org
# kbuild: Check for undefined symbols in vmlinux
#
# At least one bin-utils version for ARM is know to ignore undefined
# symbols when performing the final link of vmlinux.
# Add an explicit check for undefined symbols to catch this.
# The check is made in combination with generating the System.map file
# and the actual algorithm is moved to a small shell script - mksysmap.
#
# External symbols with three leading underscores are ignored - sparc
# uses them for the BTFIXUP logic.
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# scripts/mksysmap
# 2004/08/07 21:35:27+02:00 sam@mars.ravnborg.org +54 -0
#
# scripts/mksysmap
# 2004/08/07 21:35:27+02:00 sam@mars.ravnborg.org +0 -0
# BitKeeper file /home/sam/bk/kbuild/scripts/mksysmap
#
# Makefile
# 2004/08/07 21:35:27+02:00 sam@mars.ravnborg.org +18 -7
# Use new mksysmap script when generating System.map
# Also make nice printout when executing in non-verbose mode.
#
diff -Nru a/Makefile b/Makefile
--- a/Makefile 2004-08-13 21:09:35 +02:00
+++ b/Makefile 2004-08-13 21:09:35 +02:00
@@ -538,8 +538,9 @@
echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
endef
-do_system_map = $(NM) $(1) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > $(2)
-
+quiet_cmd_sysmap = SYSMAP
+ cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
+
LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds.s
# Generate section listing all symbols and add it into vmlinux
@@ -570,8 +571,10 @@
kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
define rule_verify_kallsyms
- @$(call do_system_map, .tmp_vmlinux$(last_kallsyms), .tmp_System.map)
- @cmp -s System.map .tmp_System.map || \
+ $(Q)$(if $($(quiet)cmd_sysmap), \
+ echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \
+ $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map
+ $(Q)cmp -s System.map .tmp_System.map || \
(echo Inconsistent kallsyms data, try setting CONFIG_KALLSYMS_EXTRA_PASS ; rm .tmp_kallsyms* ; false)
endef
@@ -595,11 +598,19 @@
endif
-# Finally the vmlinux rule
+# Finally the vmlinux rule
+# This rule is also used to generate System.map
+# and to verify that the content of kallsyms are consistent
define rule_vmlinux
- $(rule_vmlinux__); \
- $(call do_system_map, $@, System.map)
+ $(rule_vmlinux__);
+ $(Q)$(if $($(quiet)cmd_sysmap), \
+ echo ' $($(quiet)cmd_sysmap) $@' &&) \
+ $(cmd_sysmap) $@ System.map; \
+ if [ $$? -ne 0 ]; then \
+ rm -f $@; \
+ /bin/false; \
+ fi;
$(rule_verify_kallsyms)
endef
diff -Nru a/scripts/mksysmap b/scripts/mksysmap
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/scripts/mksysmap 2004-08-13 21:09:35 +02:00
@@ -0,0 +1,54 @@
+#!/bin/sh -x
+# Based on the vmlinux file create the System.map file
+# System.map is used by module-init tools and some debugging
+# tools to retreive the actual addresses of symbols in the kernel.
+#
+# Before creating the System.map file as a sideeffect check for
+# undefined symbols.
+# At least one version of the ARM bin-utils did not error out on
+# undefined symbols, so catch them here instead.
+
+# Usage
+# mksysmap vmlinux System.map
+
+
+#####
+# Check for undefined symbols.
+# Undefined symbols with three leading underscores are ignored since
+# they are used by the sparc BTFIXUP logic - and is assumed to be undefined.
+
+
+if [ "`$NM -u $1 | grep -v ' ____'`" != "" ]; then
+ echo "$1: error: undefined symbol(s) found:"
+ $NM -u $1 | grep -v ' ___'
+ exit 1
+fi
+
+#####
+# Generate System.map (actual filename passed as second argument)
+
+# $NM produces the following output:
+# f0081e80 T alloc_vfsmnt
+
+# The second row specify the type of the symbol:
+# A = Absolute
+# B = Uninitialised data (.bss)
+# C = Comon symbol
+# D = Initialised data
+# G = Initialised data for small objects
+# I = Indirect reference to another symbol
+# N = Debugging symbol
+# R = Read only
+# S = Uninitialised data for small objects
+# T = Text code symbol
+# U = Undefined symbol
+# V = Weak symbol
+# W = Weak symbol
+# Corresponding small letters are local symbols
+
+# For System.map filter away:
+# a - local absolute symbols
+# U - undefined global symbols
+# w - local weak symbols
+
+nm $1 | grep -v ' [aUw] ' > $2
^ permalink raw reply [flat|nested] 14+ messages in thread* [2/12] kbuild/sparc: Use new generic mksysmap script to generate System.map
2004-08-13 19:28 kbuild updates Sam Ravnborg
2004-08-13 19:45 ` [1/12] kbuild: Check for undefined symbols in vmlinux Sam Ravnborg
@ 2004-08-13 19:45 ` Sam Ravnborg
2004-08-13 19:46 ` [3/12] kconfig: save kernel version in .config file Sam Ravnborg
` (9 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:45 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/08 09:34:43+02:00 sam@mars.ravnborg.org
# kbuild/sparc: Use new generic mksysmap script to generate System.map
#
# o Introduced usage of the mksysmap script.
# o Improved the non-verbose output to look like this:
# BTFIX arch/sparc/boot/btfix.S
# AS arch/sparc/boot/btfix.o
# LD arch/sparc/boot/image
# SYSMAP arch/sparc/boot/System.map
#
# o No longer generate System.map for each build
# o Use normal AS rule to compile btfix.S
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# scripts/mksysmap
# 2004/08/08 09:34:27+02:00 sam@mars.ravnborg.org +1 -1
# Three, not four underscores
#
# arch/sparc/boot/Makefile
# 2004/08/08 09:34:27+02:00 sam@mars.ravnborg.org +32 -8
# Use the new mksysmap script
# Do not generate System.map for every build
# Use normal AS rule for btfix.S
#
diff -Nru a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
--- a/arch/sparc/boot/Makefile 2004-08-13 21:09:21 +02:00
+++ b/arch/sparc/boot/Makefile 2004-08-13 21:09:21 +02:00
@@ -8,27 +8,51 @@
ELFTOAOUT := elftoaout
host-progs := piggyback btfixupprep
-targets := tftpboot.img btfix.o btfix.s image
+targets := tftpboot.img btfix.o btfix.S image
quiet_cmd_elftoaout = ELFTOAOUT $@
cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
-quiet_cmd_piggy = PIGGY $@
+quiet_cmd_piggy = PIGGY $@
cmd_piggy = $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG)
-quiet_cmd_btfix = BTFIX $@
+quiet_cmd_btfix = BTFIX $@
cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@
+quiet_cmd_sysmap = SYSMAP $(obj)/System.map
+ cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
+quiet_cmd_image = LD $@
+ cmd_image = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) -o $@
+
+define rule_image
+ $(if $($(quiet)cmd_image), \
+ echo ' $($(quiet)cmd_image)' &&) \
+ $(cmd_image); \
+ $(if $($(quiet)cmd_sysmap), \
+ echo ' $($(quiet)cmd_sysmap)' &&) \
+ $(cmd_sysmap) $@ $(obj)/System.map; \
+ if [ $$? -ne 0 ]; then \
+ rm -f $@; \
+ /bin/false; \
+ fi; \
+ echo 'cmd_$@ := $(cmd_image)' > $(@D)/.$(@F).cmd
+endef
BTOBJS := $(HEAD_Y) $(INIT_Y)
BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_Y)
-LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds.s $(BTOBJS) --start-group $(BTLIBS) --end-group $(kallsyms.o)
+LDFLAGS_image := -T arch/sparc/kernel/vmlinux.lds.s $(BTOBJS) \
+ --start-group $(BTLIBS) --end-group \
+ $(kallsyms.o) $(obj)/btfix.o
-# Actual linking
+# Link the final image including btfixup'ed symbols.
+# This is a replacement for the link done in the top-level Makefile.
+# Note: No dependency on the prerequisite files since that would require
+# make to try check if they are updated - and due to changes
+# in gcc options (path for example) this would result in
+# these files being recompiled for each build.
$(obj)/image: $(obj)/btfix.o FORCE
- $(call if_changed,ld)
- $(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > $(obj)/System.map
+ $(call if_changed_rule,image)
$(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE
$(call if_changed,elftoaout)
$(call if_changed,piggy)
-$(obj)/btfix.s: $(obj)/btfixupprep vmlinux FORCE
+$(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
$(call if_changed,btfix)
diff -Nru a/scripts/mksysmap b/scripts/mksysmap
--- a/scripts/mksysmap 2004-08-13 21:09:21 +02:00
+++ b/scripts/mksysmap 2004-08-13 21:09:21 +02:00
@@ -18,7 +18,7 @@
# they are used by the sparc BTFIXUP logic - and is assumed to be undefined.
-if [ "`$NM -u $1 | grep -v ' ____'`" != "" ]; then
+if [ "`$NM -u $1 | grep -v ' ___'`" != "" ]; then
echo "$1: error: undefined symbol(s) found:"
$NM -u $1 | grep -v ' ___'
exit 1
^ permalink raw reply [flat|nested] 14+ messages in thread* [3/12] kconfig: save kernel version in .config file
2004-08-13 19:28 kbuild updates Sam Ravnborg
2004-08-13 19:45 ` [1/12] kbuild: Check for undefined symbols in vmlinux Sam Ravnborg
2004-08-13 19:45 ` [2/12] kbuild/sparc: Use new generic mksysmap script to generate System.map Sam Ravnborg
@ 2004-08-13 19:46 ` Sam Ravnborg
2004-08-13 19:47 ` [4/12] kbuild: Selective compile of targets in scripts/ Sam Ravnborg
` (8 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:46 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/08 16:29:57+02:00 rddunlap@osdl.org
# kconfig: save kernel version in .config file
#
# Save kernel version info and date when writing .config file.
# Tested with 'make {menuconfig|xconfig|gconfig}'.
#
# Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# scripts/kconfig/confdata.c
# 2004/06/20 06:14:24+02:00 rddunlap@osdl.org +15 -2
# kconfig: save kernel version in .config file
#
diff -Nru a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
--- a/scripts/kconfig/confdata.c 2004-08-13 21:09:11 +02:00
+++ b/scripts/kconfig/confdata.c 2004-08-13 21:09:11 +02:00
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <unistd.h>
#define LKC_DIRECT_LINK
@@ -268,6 +269,7 @@
char dirname[128], tmpname[128], newname[128];
int type, l;
const char *str;
+ time_t now;
dirname[0] = 0;
if (name && name[0]) {
@@ -301,14 +303,25 @@
if (!out_h)
return 1;
}
+ sym = sym_lookup("KERNELRELEASE", 0);
+ sym_calc_value(sym);
+ time(&now);
fprintf(out, "#\n"
"# Automatically generated make config: don't edit\n"
- "#\n");
+ "# Linux kernel version: %s\n"
+ "# %s"
+ "#\n",
+ sym_get_string_value(sym),
+ ctime(&now));
if (out_h)
fprintf(out_h, "/*\n"
" * Automatically generated C config: don't edit\n"
+ " * Linux kernel version: %s\n"
+ " * %s"
" */\n"
- "#define AUTOCONF_INCLUDED\n");
+ "#define AUTOCONF_INCLUDED\n",
+ sym_get_string_value(sym),
+ ctime(&now));
if (!sym_change_count)
sym_clear_all_valid();
^ permalink raw reply [flat|nested] 14+ messages in thread* [4/12] kbuild: Selective compile of targets in scripts/
2004-08-13 19:28 kbuild updates Sam Ravnborg
` (2 preceding siblings ...)
2004-08-13 19:46 ` [3/12] kconfig: save kernel version in .config file Sam Ravnborg
@ 2004-08-13 19:47 ` Sam Ravnborg
2004-08-13 19:47 ` [5/12] kbuild: Use LINUXINCLUDE to specify include/ directory Sam Ravnborg
` (7 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:47 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/08 21:01:05+02:00 sam@mars.ravnborg.org
# kbuild: Selective compile of targets in scripts/
#
# Do not build executables unless needed.
# Same goes for scripts/mod/, descend only when CONFIG_MODULES are enabled.
# With inputs form: Russell King <rmk+lkml@arm.linux.org.uk> and Brian Gerst <bgerst@quark.didntduck.org>
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# scripts/Makefile
# 2004/08/08 21:00:50+02:00 sam@mars.ravnborg.org +12 -4
# Only build required host-progs.
# Descend into mod/ only when modules are enabled
#
# Makefile
# 2004/08/08 21:00:50+02:00 sam@mars.ravnborg.org +1 -1
# Add dependency on kallsyms, so recompile is done when script changes
#
diff -Nru a/Makefile b/Makefile
--- a/Makefile 2004-08-13 21:09:00 +02:00
+++ b/Makefile 2004-08-13 21:09:00 +02:00
@@ -584,7 +584,7 @@
.tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
$(call if_changed_dep,as_o_S)
-.tmp_kallsyms%.S: .tmp_vmlinux%
+.tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS)
$(call cmd,kallsyms)
.tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
diff -Nru a/scripts/Makefile b/scripts/Makefile
--- a/scripts/Makefile 2004-08-13 21:09:00 +02:00
+++ b/scripts/Makefile 2004-08-13 21:09:00 +02:00
@@ -2,14 +2,22 @@
# scripts contains sources for various helper programs used throughout
# the kernel for the build process.
# ---------------------------------------------------------------------------
-# docproc: Preprocess .tmpl file in order to generate .sgml docs
+# kallsyms: Find all symbols in vmlinux
+# pnmttologo: Convert pnm files to logo files
+# conmakehash: Create chartable
# conmakehash: Create arrays for initializing the kernel console tables
-host-progs := conmakehash kallsyms pnmtologo bin2c
+hostprogs-$(CONFIG_KALLSYMS) += kallsyms
+hostprogs-$(CONFIG_LOGO) += pnmtologo
+hostprogs-$(CONFIG_VT) += conmakehash
+hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
+hostprogs-$(CONFIG_IKCONFIG) += bin2c
+
+host-progs := $(sort $(hostprogs-y))
always := $(host-progs)
-subdir-$(CONFIG_MODVERSIONS) += genksyms
-subdir-y += mod
+subdir-$(CONFIG_MODVERSIONS) += genksyms
+subdir-$(CONFIG_MODULES) += mod
# Let clean descend into subdirs
subdir- += basic lxdialog kconfig package
^ permalink raw reply [flat|nested] 14+ messages in thread* [5/12] kbuild: Use LINUXINCLUDE to specify include/ directory
2004-08-13 19:28 kbuild updates Sam Ravnborg
` (3 preceding siblings ...)
2004-08-13 19:47 ` [4/12] kbuild: Selective compile of targets in scripts/ Sam Ravnborg
@ 2004-08-13 19:47 ` Sam Ravnborg
2004-08-13 19:48 ` [6/12] kbuild: Accept absolute paths in clean-files and introduce clean-dirs Sam Ravnborg
` (6 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:47 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/08 21:54:01+02:00 sam@mars.ravnborg.org
# kbuild: Use LINUXINCLUDE to specify include/ directory
#
# Peter Chubb <peterc@gelato.unsw.edu.au> reported that building i386
# on a non-i386 platform failed, because gcc could not locate boot.h.
# Root cause was the extra include2 directory used when using O=
# to specify the output directory.
# Added LINUXINCLUDE as a portable way to specify the include/
# directory, and changed the two users.
# This avoids hardcoding 'include2' in non-kbuild core files.
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# arch/ppc64/boot/Makefile
# 2004/08/08 21:53:44+02:00 sam@mars.ravnborg.org +1 -1
# Introduce usage of LINUXINCLUDE
#
# arch/i386/boot/Makefile
# 2004/08/08 21:53:44+02:00 sam@mars.ravnborg.org +1 -1
# Use LINUXINCLUDE to enable cross compilation.
# This alos makes build locate the same boot.h when built with and wihtout O=
#
# Makefile
# 2004/08/08 21:53:44+02:00 sam@mars.ravnborg.org +7 -3
# Introduced LINUXINCLUDE - to allow portable reference to the include/
# directory when assing to HOSTCFLAGS
#
diff -Nru a/Makefile b/Makefile
--- a/Makefile 2004-08-13 21:08:49 +02:00
+++ b/Makefile 2004-08-13 21:08:49 +02:00
@@ -294,8 +294,12 @@
NOSTDINC_FLAGS = -nostdinc -iwithprefix include
-CPPFLAGS := -D__KERNEL__ -Iinclude \
- $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
+# Use LINUXINCLUDE when you must reference the include/ directory.
+# Needed to be compatible with the O= option
+LINUXINCLUDE := -Iinclude \
+ $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
+
+CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common
@@ -306,7 +310,7 @@
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK
-export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
+export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
diff -Nru a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile
--- a/arch/i386/boot/Makefile 2004-08-13 21:08:49 +02:00
+++ b/arch/i386/boot/Makefile 2004-08-13 21:08:49 +02:00
@@ -31,7 +31,7 @@
host-progs := tools/build
-HOSTCFLAGS_build.o := -Iinclude
+HOSTCFLAGS_build.o := $(LINUXINCLUDE)
# ---------------------------------------------------------------------------
diff -Nru a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile
--- a/arch/ppc64/boot/Makefile 2004-08-13 21:08:49 +02:00
+++ b/arch/ppc64/boot/Makefile 2004-08-13 21:08:49 +02:00
@@ -25,7 +25,7 @@
BOOTCC := $(CROSS32_COMPILE)gcc
HOSTCC := gcc
-BOOTCFLAGS := $(HOSTCFLAGS) -Iinclude -fno-builtin
+BOOTCFLAGS := $(HOSTCFLAGS) $(LINUXINCLUDE) -fno-builtin
BOOTAS := $(CROSS32_COMPILE)as
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional
BOOTLD := $(CROSS32_COMPILE)ld
^ permalink raw reply [flat|nested] 14+ messages in thread* [6/12] kbuild: Accept absolute paths in clean-files and introduce clean-dirs
2004-08-13 19:28 kbuild updates Sam Ravnborg
` (4 preceding siblings ...)
2004-08-13 19:47 ` [5/12] kbuild: Use LINUXINCLUDE to specify include/ directory Sam Ravnborg
@ 2004-08-13 19:48 ` Sam Ravnborg
2004-08-13 19:49 ` [7/12] kbuild: Separate out host-progs handling Sam Ravnborg
` (5 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:48 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/09 20:01:02+02:00 sam@mars.ravnborg.org
# kbuild: Accept absolute paths in clean-files and introduce clean-dirs
#
# Teach kbuild to accept absolute paths in clean-files. This avoids using
# clean-rules in several places.
# Introduced clean-dirs to delete complete directories.
# Kept clean-rule - but do not print anything when used.
# Cleaned up a few places now the infrastructure are improved.
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# scripts/package/Makefile
# 2004/08/09 20:00:46+02:00 sam@mars.ravnborg.org +3 -3
# Use the fact that kbuild now knows of absolute paths in clean-files, and also
# know how to delete directories.
# This killed use of clean-rule in this file - good.
#
# scripts/Makefile.clean
# 2004/08/09 20:00:46+02:00 sam@mars.ravnborg.org +22 -8
# Teach Makefile.clean about absolute pathnames in clean-files.
# Introduce clean-dirs.
#
# Documentation/kbuild/makefiles.txt
# 2004/08/09 20:00:46+02:00 sam@mars.ravnborg.org +11 -2
# Document the new clean-dirs variable, and the changed behaviour of clean-files.
#
# Documentation/DocBook/Makefile
# 2004/08/09 20:00:46+02:00 sam@mars.ravnborg.org +1 -3
# Use clean-dirs to remove directories
#
diff -Nru a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
--- a/Documentation/DocBook/Makefile 2004-08-13 21:08:35 +02:00
+++ b/Documentation/DocBook/Makefile 2004-08-13 21:08:35 +02:00
@@ -185,9 +185,7 @@
$(patsubst %.sgml, %.9, $(DOCBOOKS)) \
$(C-procfs-example)
-ifneq ($(wildcard $(patsubst %.html,%,$(HTML))),)
-clean-rule := rm -rf $(wildcard $(patsubst %.html,%,$(HTML)))
-endif
+clean-dirs := $(patsubst %.sgml,%,$(DOCBOOKS))
#man put files in man subdir - traverse down
subdir- := man/
diff -Nru a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
--- a/Documentation/kbuild/makefiles.txt 2004-08-13 21:08:35 +02:00
+++ b/Documentation/kbuild/makefiles.txt 2004-08-13 21:08:35 +02:00
@@ -547,8 +547,17 @@
clean-files := devlist.h classlist.h
When executing "make clean", the two files "devlist.h classlist.h" will
-be deleted. Kbuild knows that files specified by $(clean-files) are
-located in the same directory as the makefile.
+be deleted. Kbuild will assume files to be in same relative directory as the
+Makefile except if an absolute path is specified (path starting with '/').
+
+To delete a directory hirachy use:
+ Example:
+ #scripts/package/Makefile
+ clean-dirs := $(objtree)/debian/
+
+This will delete the directory debian, including all subdirectories.
+Kbuild will assume the directories to be in the same relative path as the
+Makefile if no absolute path is specified (path does not start with '/').
Usually kbuild descends down in subdirectories due to "obj-* := dir/",
but in the architecture makefiles where the kbuild infrastructure
diff -Nru a/scripts/Makefile.clean b/scripts/Makefile.clean
--- a/scripts/Makefile.clean 2004-08-13 21:08:35 +02:00
+++ b/scripts/Makefile.clean 2004-08-13 21:08:35 +02:00
@@ -29,21 +29,35 @@
# Add subdir path
subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
-__clean-files := $(wildcard $(addprefix $(obj)/, \
- $(extra-y) $(EXTRA_TARGETS) $(always) $(host-progs) \
- $(targets) $(clean-files)))
+__clean-files := $(extra-y) $(EXTRA_TARGETS) $(always) $(host-progs) \
+ $(targets) $(clean-files)
+__clean-files := $(wildcard \
+ $(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \
+ $(filter /%, $(__clean-files)))
+__clean-dirs := $(wildcard \
+ $(addprefix $(obj)/, $(filter-out /%, $(clean-dirs))) \
+ $(filter /%, $(clean-dirs)))
# ==========================================================================
-quiet_cmd_clean = CLEAN $(obj)
- cmd_clean = rm -f $(__clean-files); $(clean-rule)
+quiet_cmd_clean = CLEAN $(obj)
+ cmd_clean = rm -f $(__clean-files)
+quiet_cmd_cleandir = CLEAN $(__clean-dirs)
+ cmd_cleandir = rm -rf $(__clean-dirs)
+
__clean: $(subdir-ymn)
-ifneq ($(strip $(__clean-files) $(clean-rule)),)
+ifneq ($(strip $(__clean-files)),)
+$(call cmd,clean)
-else
- @:
endif
+ifneq ($(strip $(__clean-dirs)),)
+ +$(call cmd,cleandir)
+endif
+ifneq ($(strip $(clean-rule)),)
+ +$(clean-rule)
+endif
+ @:
+
# ===========================================================================
# Generic stuff
diff -Nru a/scripts/package/Makefile b/scripts/package/Makefile
--- a/scripts/package/Makefile 2004-08-13 21:08:35 +02:00
+++ b/scripts/package/Makefile 2004-08-13 21:08:35 +02:00
@@ -51,7 +51,7 @@
$(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
rm ../$(KERNELPATH).tar.gz
-clean-rule += rm -f $(objtree)/kernel.spec
+clean-files := $(objtree)/kernel.spec
# binrpm-pkg
.PHONY: binrpm-pkg
@@ -67,7 +67,7 @@
$(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $<
-clean-rule += rm -f $(objtree)/binkernel.spec
+clean-files += $(objtree)/binkernel.spec
# Deb target
# ---------------------------------------------------------------------------
@@ -77,7 +77,7 @@
$(MAKE)
$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
-clean-rule += && rm -rf $(objtree)/debian/
+clean-dirs += $(objtree)/debian/
# Help text displayed when executing 'make help'
^ permalink raw reply [flat|nested] 14+ messages in thread* [7/12] kbuild: Separate out host-progs handling
2004-08-13 19:28 kbuild updates Sam Ravnborg
` (5 preceding siblings ...)
2004-08-13 19:48 ` [6/12] kbuild: Accept absolute paths in clean-files and introduce clean-dirs Sam Ravnborg
@ 2004-08-13 19:49 ` Sam Ravnborg
2004-08-14 8:04 ` Coywolf Qi Hunt
2004-08-13 19:50 ` [8/12] kbuild: Introduce hostprogs-y, deprecate host-progs Sam Ravnborg
` (4 subsequent siblings)
11 siblings, 1 reply; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:49 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/10 20:09:55+02:00 sam@mars.ravnborg.org
# kbuild: Separate out host-progs handling
#
# Concentrating all host-progs functionality in one file made a more
# readable Makefile.lib - and allow for potential reuse of host-progs
# functionality.
# Processing of host-progs related stuff are avoided when no host-progs are specified.
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# scripts/Makefile.host
# 2004/08/10 20:09:38+02:00 sam@mars.ravnborg.org +152 -0
#
# scripts/Makefile.lib
# 2004/08/10 20:09:38+02:00 sam@mars.ravnborg.org +0 -49
# Move host-progs functionality to scripts/Makefile.host
#
# scripts/Makefile.host
# 2004/08/10 20:09:38+02:00 sam@mars.ravnborg.org +0 -0
# BitKeeper file /home/sam/bk/kbuild/scripts/Makefile.host
#
# scripts/Makefile.build
# 2004/08/10 20:09:38+02:00 sam@mars.ravnborg.org +5 -84
# Move host-progs functionality to scripts/Makefile.host
#
diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
--- a/scripts/Makefile.build 2004-08-13 21:08:23 +02:00
+++ b/scripts/Makefile.build 2004-08-13 21:08:23 +02:00
@@ -14,6 +14,11 @@
include scripts/Makefile.lib
+# Do not include host-progs rules unles needed
+ifdef host-progs
+include scripts/Makefile.host
+endif
+
ifneq ($(KBUILD_SRC),)
# Create output directory if not already present
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
@@ -275,90 +280,6 @@
targets += $(multi-used-y) $(multi-used-m)
-# Compile programs on the host
-# ===========================================================================
-# host-progs := bin2hex
-# Will compile bin2hex.c and create an executable named bin2hex
-#
-# host-progs := lxdialog
-# lxdialog-objs := checklist.o lxdialog.o
-# Will compile lxdialog.c and checklist.c, and then link the executable
-# lxdialog, based on checklist.o and lxdialog.o
-#
-# host-progs := qconf
-# qconf-cxxobjs := qconf.o
-# qconf-objs := menu.o
-# Will compile qconf as a C++ program, and menu as a C program.
-# They are linked as C++ code to the executable qconf
-
-# host-progs := conf
-# conf-objs := conf.o libkconfig.so
-# libkconfig-objs := expr.o type.o
-# Will create a shared library named libkconfig.so that consist of
-# expr.o and type.o (they are both compiled as C code and the object file
-# are made as position independent code).
-# conf.c is compiled as a c program, and conf.o is linked together with
-# libkconfig.so as the executable conf.
-# Note: Shared libraries consisting of C++ files are not supported
-#
-
-# Create executable from a single .c file
-# host-csingle -> Executable
-quiet_cmd_host-csingle = HOSTCC $@
- cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $<
-$(host-csingle): %: %.c FORCE
- $(call if_changed_dep,host-csingle)
-
-# Link an executable based on list of .o files, all plain c
-# host-cmulti -> executable
-quiet_cmd_host-cmulti = HOSTLD $@
- cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
- $(addprefix $(obj)/,$($(@F)-objs)) \
- $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
-$(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE
- $(call if_changed,host-cmulti)
-
-# Create .o file from a single .c file
-# host-cobjs -> .o
-quiet_cmd_host-cobjs = HOSTCC $@
- cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $<
-$(host-cobjs): %.o: %.c FORCE
- $(call if_changed_dep,host-cobjs)
-
-# Link an executable based on list of .o files, a mixture of .c and .cc
-# host-cxxmulti -> executable
-quiet_cmd_host-cxxmulti = HOSTLD $@
- cmd_host-cxxmulti = $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \
- $(foreach o,objs cxxobjs,\
- $(addprefix $(obj)/,$($(@F)-$(o)))) \
- $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
-$(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE
- $(call if_changed,host-cxxmulti)
-
-# Create .o file from a single .cc (C++) file
-quiet_cmd_host-cxxobjs = HOSTCXX $@
- cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $<
-$(host-cxxobjs): %.o: %.cc FORCE
- $(call if_changed_dep,host-cxxobjs)
-
-# Compile .c file, create position independent .o file
-# host-cshobjs -> .o
-quiet_cmd_host-cshobjs = HOSTCC -fPIC $@
- cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
-$(host-cshobjs): %.o: %.c FORCE
- $(call if_changed_dep,host-cshobjs)
-
-# Link a shared library, based on position independent .o files
-# *.o -> .so shared library (host-cshlib)
-quiet_cmd_host-cshlib = HOSTLLD -shared $@
- cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \
- $(addprefix $(obj)/,$($(@F:.so=-objs))) \
- $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
-$(host-cshlib): %: $(host-cshobjs) FORCE
- $(call if_changed,host-cshlib)
-
-targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\
- $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs)
# Descending
# ---------------------------------------------------------------------------
diff -Nru a/scripts/Makefile.host b/scripts/Makefile.host
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/scripts/Makefile.host 2004-08-13 21:08:23 +02:00
@@ -0,0 +1,152 @@
+# ==========================================================================
+# Building binaries on the host system
+# Binaries are used during the compilation of the kernel, for example
+# to preprocess a data file.
+#
+# Both C and C++ is supported, but preferred language is C for such utilities.
+#
+# Samle syntax (see Documentation/kbuild/makefile.txt for reference)
+# host-progs := bin2hex
+# Will compile bin2hex.c and create an executable named bin2hex
+#
+# host-progs := lxdialog
+# lxdialog-objs := checklist.o lxdialog.o
+# Will compile lxdialog.c and checklist.c, and then link the executable
+# lxdialog, based on checklist.o and lxdialog.o
+#
+# host-progs := qconf
+# qconf-cxxobjs := qconf.o
+# qconf-objs := menu.o
+# Will compile qconf as a C++ program, and menu as a C program.
+# They are linked as C++ code to the executable qconf
+
+# host-progs := conf
+# conf-objs := conf.o libkconfig.so
+# libkconfig-objs := expr.o type.o
+# Will create a shared library named libkconfig.so that consist of
+# expr.o and type.o (they are both compiled as C code and the object file
+# are made as position independent code).
+# conf.c is compiled as a c program, and conf.o is linked together with
+# libkconfig.so as the executable conf.
+# Note: Shared libraries consisting of C++ files are not supported
+
+# host-progs := tools/build may have been specified. Retreive directory
+obj-dirs += $(foreach f,$(host-progs), $(if $(dir $(f)),$(dir $(f))))
+obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs))))
+
+
+# C code
+# Executables compiled from a single .c file
+host-csingle := $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m)))
+
+# C executables linked based on several .o files
+host-cmulti := $(foreach m,$(host-progs),\
+ $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
+
+# Object (.o) files compiled from .c files
+host-cobjs := $(sort $(foreach m,$(host-progs),$($(m)-objs)))
+
+# C++ code
+# C++ executables compiled from at least on .cc file
+# and zero or more .c files
+host-cxxmulti := $(foreach m,$(host-progs),$(if $($(m)-cxxobjs),$(m)))
+
+# C++ Object (.o) files compiled from .cc files
+host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
+
+# Shared libaries (only .c supported)
+# Shared libraries (.so) - all .so files referenced in "xxx-objs"
+host-cshlib := $(sort $(filter %.so, $(host-cobjs)))
+# Remove .so files from "xxx-objs"
+host-cobjs := $(filter-out %.so,$(host-cobjs))
+
+#Object (.o) files used by the shared libaries
+host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
+
+host-progs := $(addprefix $(obj)/,$(host-progs))
+host-csingle := $(addprefix $(obj)/,$(host-csingle))
+host-cmulti := $(addprefix $(obj)/,$(host-cmulti))
+host-cobjs := $(addprefix $(obj)/,$(host-cobjs))
+host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti))
+host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs))
+host-cshlib := $(addprefix $(obj)/,$(host-cshlib))
+host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs))
+
+#####
+# Handle options to gcc. Support building with separate output directory
+
+_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o)
+_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o)
+
+ifeq ($(KBUILD_SRC),)
+__hostc_flags = $(_hostc_flags)
+__hostcxx_flags = $(_hostcxx_flags)
+else
+__hostc_flags = -I$(obj) $(call flags,_hostc_flags)
+__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
+endif
+
+hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
+hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
+
+#####
+# Compile programs on the host
+
+# Create executable from a single .c file
+# host-csingle -> Executable
+quiet_cmd_host-csingle = HOSTCC $@
+ cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $<
+$(host-csingle): %: %.c FORCE
+ $(call if_changed_dep,host-csingle)
+
+# Link an executable based on list of .o files, all plain c
+# host-cmulti -> executable
+quiet_cmd_host-cmulti = HOSTLD $@
+ cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
+ $(addprefix $(obj)/,$($(@F)-objs)) \
+ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
+$(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE
+ $(call if_changed,host-cmulti)
+
+# Create .o file from a single .c file
+# host-cobjs -> .o
+quiet_cmd_host-cobjs = HOSTCC $@
+ cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $<
+$(host-cobjs): %.o: %.c FORCE
+ $(call if_changed_dep,host-cobjs)
+
+# Link an executable based on list of .o files, a mixture of .c and .cc
+# host-cxxmulti -> executable
+quiet_cmd_host-cxxmulti = HOSTLD $@
+ cmd_host-cxxmulti = $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \
+ $(foreach o,objs cxxobjs,\
+ $(addprefix $(obj)/,$($(@F)-$(o)))) \
+ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
+$(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE
+ $(call if_changed,host-cxxmulti)
+
+# Create .o file from a single .cc (C++) file
+quiet_cmd_host-cxxobjs = HOSTCXX $@
+ cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $<
+$(host-cxxobjs): %.o: %.cc FORCE
+ $(call if_changed_dep,host-cxxobjs)
+
+# Compile .c file, create position independent .o file
+# host-cshobjs -> .o
+quiet_cmd_host-cshobjs = HOSTCC -fPIC $@
+ cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
+$(host-cshobjs): %.o: %.c FORCE
+ $(call if_changed_dep,host-cshobjs)
+
+# Link a shared library, based on position independent .o files
+# *.o -> .so shared library (host-cshlib)
+quiet_cmd_host-cshlib = HOSTLLD -shared $@
+ cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \
+ $(addprefix $(obj)/,$($(@F:.so=-objs))) \
+ $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
+$(host-cshlib): %: $(host-cshobjs) FORCE
+ $(call if_changed,host-cshlib)
+
+targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\
+ $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs)
+
diff -Nru a/scripts/Makefile.lib b/scripts/Makefile.lib
--- a/scripts/Makefile.lib 2004-08-13 21:08:23 +02:00
+++ b/scripts/Makefile.lib 2004-08-13 21:08:23 +02:00
@@ -60,41 +60,11 @@
# $(obj-dirs) is a list of directories that contain object files
obj-dirs := $(dir $(multi-objs) $(subdir-obj-y))
-obj-dirs += $(foreach f,$(host-progs), $(if $(dir $(f)),$(dir $(f))))
-obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs))))
# Replace multi-part objects by their individual parts, look at local dir only
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
-# C code
-# Executables compiled from a single .c file
-host-csingle := $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m)))
-
-# C executables linked based on several .o files
-host-cmulti := $(foreach m,$(host-progs),\
- $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
-
-# Object (.o) files compiled from .c files
-host-cobjs := $(sort $(foreach m,$(host-progs),$($(m)-objs)))
-
-# C++ code
-# C++ executables compiled from at least on .cc file
-# and zero or more .c files
-host-cxxmulti := $(foreach m,$(host-progs),$(if $($(m)-cxxobjs),$(m)))
-
-# C++ Object (.o) files compiled from .cc files
-host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
-
-# Shared libaries (only .c supported)
-# Shared libraries (.so) - all .so files referenced in "xxx-objs"
-host-cshlib := $(sort $(filter %.so, $(host-cobjs)))
-# Remove .so files from "xxx-objs"
-host-cobjs := $(filter-out %.so,$(host-cobjs))
-
-#Object (.o) files used by the shared libaries
-host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
-
# Add subdir path
extra-y := $(addprefix $(obj)/,$(extra-y))
@@ -113,14 +83,6 @@
multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
-host-progs := $(addprefix $(obj)/,$(host-progs))
-host-csingle := $(addprefix $(obj)/,$(host-csingle))
-host-cmulti := $(addprefix $(obj)/,$(host-cmulti))
-host-cobjs := $(addprefix $(obj)/,$(host-cobjs))
-host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti))
-host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs))
-host-cshlib := $(addprefix $(obj)/,$(host-cshlib))
-host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs))
# The temporary file to save gcc -MD generated dependencies must not
# contain a comma
@@ -136,12 +98,8 @@
basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F)))
modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname))))
-
_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o)
_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
-_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o)
-_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o)
-
# If building the kernel in a separate objtree expand all occurrences
# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
@@ -149,8 +107,6 @@
ifeq ($(KBUILD_SRC),)
__c_flags = $(_c_flags)
__a_flags = $(_a_flags)
-__hostc_flags = $(_hostc_flags)
-__hostcxx_flags = $(_hostcxx_flags)
else
# Prefix -I with $(srctree) if it is not an absolute path
@@ -164,8 +120,6 @@
# FIXME: Replace both with specific CFLAGS* statements in the makefiles
__c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags)
__a_flags = $(call flags,_a_flags)
-__hostc_flags = -I$(obj) $(call flags,_hostc_flags)
-__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
endif
c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
@@ -174,9 +128,6 @@
a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
$(__a_flags) $(modkern_aflags)
-
-hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
-hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS)
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [7/12] kbuild: Separate out host-progs handling
2004-08-13 19:49 ` [7/12] kbuild: Separate out host-progs handling Sam Ravnborg
@ 2004-08-14 8:04 ` Coywolf Qi Hunt
0 siblings, 0 replies; 14+ messages in thread
From: Coywolf Qi Hunt @ 2004-08-14 8:04 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kernel, Andrew Morton, Linus Torvalds
Sam Ravnborg wrote:
># This is a BitKeeper generated diff -Nru style patch.
>#
># ChangeSet
># 2004/08/10 20:09:55+02:00 sam@mars.ravnborg.org
># kbuild: Separate out host-progs handling
>#
># Concentrating all host-progs functionality in one file made a more
># readable Makefile.lib - and allow for potential reuse of host-progs
># functionality.
># Processing of host-progs related stuff are avoided when no host-progs are specified.
>#
># Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
>#
># scripts/Makefile.host
># 2004/08/10 20:09:38+02:00 sam@mars.ravnborg.org +152 -0
>#
># scripts/Makefile.lib
># 2004/08/10 20:09:38+02:00 sam@mars.ravnborg.org +0 -49
># Move host-progs functionality to scripts/Makefile.host
>#
># scripts/Makefile.host
># 2004/08/10 20:09:38+02:00 sam@mars.ravnborg.org +0 -0
># BitKeeper file /home/sam/bk/kbuild/scripts/Makefile.host
>#
># scripts/Makefile.build
># 2004/08/10 20:09:38+02:00 sam@mars.ravnborg.org +5 -84
># Move host-progs functionality to scripts/Makefile.host
>#
>diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
>--- a/scripts/Makefile.build 2004-08-13 21:08:23 +02:00
>+++ b/scripts/Makefile.build 2004-08-13 21:08:23 +02:00
>@@ -14,6 +14,11 @@
>
> include scripts/Makefile.lib
>
>+# Do not include host-progs rules unles needed
>
>
A typo: unless
--
Coywolf Qi Hunt
Homepage http://greatcn.org/~coywolf/
Admin of http://GreatCN.org and http://LoveCN.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* [8/12] kbuild: Introduce hostprogs-y, deprecate host-progs
2004-08-13 19:28 kbuild updates Sam Ravnborg
` (6 preceding siblings ...)
2004-08-13 19:49 ` [7/12] kbuild: Separate out host-progs handling Sam Ravnborg
@ 2004-08-13 19:50 ` Sam Ravnborg
2004-08-13 19:51 ` [9/12] kbuild: Replace host-progs with hostprogs-y Sam Ravnborg
` (3 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:50 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/10 21:38:42+02:00 sam@mars.ravnborg.org
# kbuild: Introduce hostprogs-y, deprecate host-progs
#
# Introducing hostprogs-y allows a user to use the typical Kbuild
# pattern in a Kbuild file:
# hostprogs-$(CONFIG_KALLSYMS) += ...
#
# And then during cleaning the referenced file are still deleted.
# Deprecate the old host-progs assignment but kept the functionlity.
#
# External modules will continue to use host-progs for a while - drawback is
# that they now see a warning.
# Workaround - just assign both variables:
# hostprogs-y := foo
# host-progs := $(hostprogs-y)
#
# All in-kernel users will be converted in next patch.
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# scripts/Makefile.host
# 2004/08/10 21:38:27+02:00 sam@mars.ravnborg.org +14 -12
# Replace host-progs with hostprogs-y (and hostprogs-m)
#
# scripts/Makefile.clean
# 2004/08/10 21:38:27+02:00 sam@mars.ravnborg.org +4 -2
# Introduced the new hostprogs variant, and kept the old one
#
# scripts/Makefile.build
# 2004/08/10 21:38:27+02:00 sam@mars.ravnborg.org +6 -1
# Deprecate host-progs, replace it with hostprogs-y.
#
# Documentation/kbuild/makefiles.txt
# 2004/08/10 21:38:27+02:00 sam@mars.ravnborg.org +26 -11
# Replcae host-progs with hostprogs-y
#
diff -Nru a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
--- a/Documentation/kbuild/makefiles.txt 2004-08-13 21:08:12 +02:00
+++ b/Documentation/kbuild/makefiles.txt 2004-08-13 21:08:12 +02:00
@@ -25,6 +25,7 @@
--- 4.4 Using C++ for host programs
--- 4.5 Controlling compiler options for host programs
--- 4.6 When host programs are actually built
+ --- 4.7 Using hostprogs-$(CONFIG_FOO)
=== 5 Kbuild clean infrastructure
@@ -387,7 +388,7 @@
Two steps are required in order to use a host executable.
The first step is to tell kbuild that a host program exists. This is
-done utilising the variable host-prog.
+done utilising the variable hostprogs-y.
The second step is to add an explicit dependency to the executable.
This can be done in two ways. Either add the dependency in a rule,
@@ -402,7 +403,7 @@
built on the build host.
Example:
- host-progs := bin2hex
+ hostprogs-y := bin2hex
Kbuild assumes in the above example that bin2hex is made from a single
c-source file named bin2hex.c located in the same directory as
@@ -418,7 +419,7 @@
Example:
#scripts/lxdialog/Makefile
- host-progs := lxdialog
+ hostprogs-y := lxdialog
lxdialog-objs := checklist.o lxdialog.o
Objects with extension .o are compiled from the corresponding .c
@@ -438,7 +439,7 @@
Example:
#scripts/kconfig/Makefile
- host-progs := conf
+ hostprogs-y := conf
conf-objs := conf.o libkconfig.so
libkconfig-objs := expr.o type.o
@@ -457,7 +458,7 @@
Example:
#scripts/kconfig/Makefile
- host-progs := qconf
+ hostprogs-y := qconf
qconf-cxxobjs := qconf.o
In the example above the executable is composed of the C++ file
@@ -468,7 +469,7 @@
Example:
#scripts/kconfig/Makefile
- host-progs := qconf
+ hostprogs-y := qconf
qconf-cxxobjs := qconf.o
qconf-objs := check.o
@@ -509,7 +510,7 @@
Example:
#drivers/pci/Makefile
- host-progs := gen-devlist
+ hostprogs-y := gen-devlist
$(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist
( cd $(obj); ./gen-devlist ) < $<
@@ -524,18 +525,32 @@
Example:
#scripts/lxdialog/Makefile
- host-progs := lxdialog
- always := $(host-progs)
+ hostprogs-y := lxdialog
+ always := $(hostprogs-y)
This will tell kbuild to build lxdialog even if not referenced in
any rule.
+--- 4.7 Using hostprogs-$(CONFIG_FOO)
+
+ A typcal pattern in a Kbuild file lok like this:
+
+ Example:
+ #scripts/Makefile
+ hostprogs-$(CONFIG_KALLSYMS) += kallsyms
+
+ Kbuild knows about both 'y' for built-in and 'm' for module.
+ So if a config symbol evaluate to 'm', kbuild will still build
+ the binary. In other words Kbuild handle hostprogs-m exactly
+ like hostprogs-y. But only hostprogs-y is recommend used
+ when no CONFIG symbol are involved.
+
=== 5 Kbuild clean infrastructure
"make clean" deletes most generated files in the src tree where the kernel
is compiled. This includes generated files such as host programs.
-Kbuild knows targets listed in $(host-progs), $(always), $(extra-y) and
-$(targets). They are all deleted during "make clean".
+Kbuild knows targets listed in $(hostprogs-y), $(hostprogs-m), $(always),
+$(extra-y) and $(targets). They are all deleted during "make clean".
Files matching the patterns "*.[oas]", "*.ko", plus some additional files
generated by kbuild are deleted all over the kernel src tree when
"make clean" is executed.
diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
--- a/scripts/Makefile.build 2004-08-13 21:08:12 +02:00
+++ b/scripts/Makefile.build 2004-08-13 21:08:12 +02:00
@@ -14,8 +14,13 @@
include scripts/Makefile.lib
-# Do not include host-progs rules unles needed
ifdef host-progs
+$(warning kbuild: $(obj)/Makefile - Usage of host-progs is deprecated. Please replace with hostprogs-y!)
+hostprogs-y += $(host-progs)
+endif
+
+# Do not include host rules unles needed
+ifneq ($(hostprogs-y)$(hostprogs-m),)
include scripts/Makefile.host
endif
diff -Nru a/scripts/Makefile.clean b/scripts/Makefile.clean
--- a/scripts/Makefile.clean 2004-08-13 21:08:12 +02:00
+++ b/scripts/Makefile.clean 2004-08-13 21:08:12 +02:00
@@ -29,8 +29,10 @@
# Add subdir path
subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
-__clean-files := $(extra-y) $(EXTRA_TARGETS) $(always) $(host-progs) \
- $(targets) $(clean-files)
+__clean-files := $(extra-y) $(EXTRA_TARGETS) $(always) \
+ $(targets) $(clean-files) \
+ $(host-progs) \
+ $(hostprogs-y) $(hostprogs-m) $(hostprogs-)
__clean-files := $(wildcard \
$(addprefix $(obj)/, $(filter-out /%, $(__clean-files))) \
$(filter /%, $(__clean-files)))
diff -Nru a/scripts/Makefile.host b/scripts/Makefile.host
--- a/scripts/Makefile.host 2004-08-13 21:08:12 +02:00
+++ b/scripts/Makefile.host 2004-08-13 21:08:12 +02:00
@@ -6,21 +6,21 @@
# Both C and C++ is supported, but preferred language is C for such utilities.
#
# Samle syntax (see Documentation/kbuild/makefile.txt for reference)
-# host-progs := bin2hex
+# hostprogs-y := bin2hex
# Will compile bin2hex.c and create an executable named bin2hex
#
-# host-progs := lxdialog
+# hostprogs-y := lxdialog
# lxdialog-objs := checklist.o lxdialog.o
# Will compile lxdialog.c and checklist.c, and then link the executable
# lxdialog, based on checklist.o and lxdialog.o
#
-# host-progs := qconf
+# hostprogs-y := qconf
# qconf-cxxobjs := qconf.o
# qconf-objs := menu.o
# Will compile qconf as a C++ program, and menu as a C program.
# They are linked as C++ code to the executable qconf
-# host-progs := conf
+# hostprogs-y := conf
# conf-objs := conf.o libkconfig.so
# libkconfig-objs := expr.o type.o
# Will create a shared library named libkconfig.so that consist of
@@ -28,28 +28,30 @@
# are made as position independent code).
# conf.c is compiled as a c program, and conf.o is linked together with
# libkconfig.so as the executable conf.
-# Note: Shared libraries consisting of C++ files are not supported
+# Note: Shared libraries consisting of C++ files are not supported
-# host-progs := tools/build may have been specified. Retreive directory
-obj-dirs += $(foreach f,$(host-progs), $(if $(dir $(f)),$(dir $(f))))
+__hostprogs := $(hostprogs-y)$(hostprogs-m)
+
+# hostprogs-y := tools/build may have been specified. Retreive directory
+obj-dirs += $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs))))
# C code
# Executables compiled from a single .c file
-host-csingle := $(foreach m,$(host-progs),$(if $($(m)-objs),,$(m)))
+host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
# C executables linked based on several .o files
-host-cmulti := $(foreach m,$(host-progs),\
+host-cmulti := $(foreach m,$(__hostprogs),\
$(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
# Object (.o) files compiled from .c files
-host-cobjs := $(sort $(foreach m,$(host-progs),$($(m)-objs)))
+host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
# C++ code
# C++ executables compiled from at least on .cc file
# and zero or more .c files
-host-cxxmulti := $(foreach m,$(host-progs),$(if $($(m)-cxxobjs),$(m)))
+host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m)))
# C++ Object (.o) files compiled from .cc files
host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))
@@ -63,7 +65,7 @@
#Object (.o) files used by the shared libaries
host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs))))
-host-progs := $(addprefix $(obj)/,$(host-progs))
+__hostprogs := $(addprefix $(obj)/,$(__hostprogs))
host-csingle := $(addprefix $(obj)/,$(host-csingle))
host-cmulti := $(addprefix $(obj)/,$(host-cmulti))
host-cobjs := $(addprefix $(obj)/,$(host-cobjs))
^ permalink raw reply [flat|nested] 14+ messages in thread* [9/12] kbuild: Replace host-progs with hostprogs-y
2004-08-13 19:28 kbuild updates Sam Ravnborg
` (7 preceding siblings ...)
2004-08-13 19:50 ` [8/12] kbuild: Introduce hostprogs-y, deprecate host-progs Sam Ravnborg
@ 2004-08-13 19:51 ` Sam Ravnborg
2004-08-13 19:51 ` [10/12] kbuild: Fix hostprogs-y Sam Ravnborg
` (2 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:51 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/10 21:42:56+02:00 sam@mars.ravnborg.org
# kbuild: Replace host-progs with hostprogs-y
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# usr/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# sound/oss/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# scripts/mod/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +2 -2
# Replace host-progs with hostprogs-y
#
# scripts/lxdialog/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +2 -2
# Replace host-progs with hostprogs-y
#
# scripts/kconfig/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# scripts/genksyms/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +2 -2
# Replace host-progs with hostprogs-y
#
# scripts/basic/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +2 -2
# Replace host-progs with hostprogs-y
#
# scripts/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -2
# Replace host-progs with hostprogs-y
#
# lib/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# drivers/zorro/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# drivers/pci/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# drivers/media/dvb/ttpci/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# drivers/md/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# drivers/atm/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# arch/x86_64/boot/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# arch/um/sys-i386/util/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +2 -2
# Replace host-progs with hostprogs-y
#
# arch/sparc64/boot/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# arch/sparc/boot/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# arch/ppc64/boot/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# arch/ppc/boot/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +2 -2
# Replace host-progs with hostprogs-y
#
# arch/i386/boot/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
# arch/alpha/boot/Makefile
# 2004/08/10 21:42:40+02:00 sam@mars.ravnborg.org +1 -1
# Replace host-progs with hostprogs-y
#
diff -Nru a/arch/alpha/boot/Makefile b/arch/alpha/boot/Makefile
--- a/arch/alpha/boot/Makefile 2004-08-13 21:08:01 +02:00
+++ b/arch/alpha/boot/Makefile 2004-08-13 21:08:01 +02:00
@@ -8,7 +8,7 @@
# Copyright (C) 1994 by Linus Torvalds
#
-host-progs := tools/mkbb tools/objstrip
+hostprogs-y := tools/mkbb tools/objstrip
targets := vmlinux.gz vmlinux \
vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
tools/bootpzh bootloader bootpheader bootpzheader
diff -Nru a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile
--- a/arch/i386/boot/Makefile 2004-08-13 21:08:01 +02:00
+++ b/arch/i386/boot/Makefile 2004-08-13 21:08:01 +02:00
@@ -29,7 +29,7 @@
zImage bzImage
subdir- := compressed
-host-progs := tools/build
+hostprogs-y := tools/build
HOSTCFLAGS_build.o := $(LINUXINCLUDE)
diff -Nru a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile
--- a/arch/ppc/boot/Makefile 2004-08-13 21:08:01 +02:00
+++ b/arch/ppc/boot/Makefile 2004-08-13 21:08:01 +02:00
@@ -23,12 +23,12 @@
# for cleaning
subdir- += simple openfirmware
-host-progs := $(addprefix utils/, addnote mknote hack-coff mkprep mkbugboot mktree)
+hostprogs-y := $(addprefix utils/, addnote mknote hack-coff mkprep mkbugboot mktree)
.PHONY: $(BOOT_TARGETS) $(bootdir-y)
$(BOOT_TARGETS): $(bootdir-y)
$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
- $(addprefix $(obj)/,$(host-progs))
+ $(addprefix $(obj)/,$(hostprogs-y))
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
diff -Nru a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile
--- a/arch/ppc64/boot/Makefile 2004-08-13 21:08:01 +02:00
+++ b/arch/ppc64/boot/Makefile 2004-08-13 21:08:01 +02:00
@@ -58,7 +58,7 @@
src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
-host-progs := piggy addnote addSystemMap addRamDisk
+hostprogs-y := piggy addnote addSystemMap addRamDisk
targets += zImage zImage.initrd imagesize.c \
$(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
$(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
diff -Nru a/arch/sparc/boot/Makefile b/arch/sparc/boot/Makefile
--- a/arch/sparc/boot/Makefile 2004-08-13 21:08:01 +02:00
+++ b/arch/sparc/boot/Makefile 2004-08-13 21:08:01 +02:00
@@ -7,7 +7,7 @@
ROOT_IMG := /usr/src/root.img
ELFTOAOUT := elftoaout
-host-progs := piggyback btfixupprep
+hostprogs-y := piggyback btfixupprep
targets := tftpboot.img btfix.o btfix.S image
quiet_cmd_elftoaout = ELFTOAOUT $@
diff -Nru a/arch/sparc64/boot/Makefile b/arch/sparc64/boot/Makefile
--- a/arch/sparc64/boot/Makefile 2004-08-13 21:08:01 +02:00
+++ b/arch/sparc64/boot/Makefile 2004-08-13 21:08:01 +02:00
@@ -7,7 +7,7 @@
ROOT_IMG := /usr/src/root.img
ELFTOAOUT := elftoaout
-host-progs := piggyback
+hostprogs-y := piggyback
targets := image tftpboot.img vmlinux.aout
quiet_cmd_elftoaout = ELF2AOUT $@
diff -Nru a/arch/um/sys-i386/util/Makefile b/arch/um/sys-i386/util/Makefile
--- a/arch/um/sys-i386/util/Makefile 2004-08-13 21:08:01 +02:00
+++ b/arch/um/sys-i386/util/Makefile 2004-08-13 21:08:01 +02:00
@@ -1,6 +1,6 @@
-host-progs := mk_sc
-always := $(host-progs) mk_thread
+hostprogs-y := mk_sc
+always := $(hostprogs-y) mk_thread
targets := mk_thread_kern.o mk_thread_user.o
mk_sc-objs := mk_sc.o
diff -Nru a/arch/x86_64/boot/Makefile b/arch/x86_64/boot/Makefile
--- a/arch/x86_64/boot/Makefile 2004-08-13 21:08:01 +02:00
+++ b/arch/x86_64/boot/Makefile 2004-08-13 21:08:01 +02:00
@@ -30,7 +30,7 @@
EXTRA_CFLAGS := -m32
-host-progs := tools/build
+hostprogs-y := tools/build
subdir- := compressed/ #Let make clean descend in compressed/
# ---------------------------------------------------------------------------
diff -Nru a/drivers/atm/Makefile b/drivers/atm/Makefile
--- a/drivers/atm/Makefile 2004-08-13 21:08:01 +02:00
+++ b/drivers/atm/Makefile 2004-08-13 21:08:01 +02:00
@@ -3,7 +3,7 @@
#
fore_200e-objs := fore200e.o
-host-progs := fore200e_mkfirm
+hostprogs-y := fore200e_mkfirm
# Files generated that shall be removed upon make clean
clean-files := atmsar11.bin atmsar11.bin1 atmsar11.bin2 pca200e.bin \
diff -Nru a/drivers/md/Makefile b/drivers/md/Makefile
--- a/drivers/md/Makefile 2004-08-13 21:08:01 +02:00
+++ b/drivers/md/Makefile 2004-08-13 21:08:01 +02:00
@@ -10,7 +10,7 @@
raid6int1.o raid6int2.o raid6int4.o \
raid6int8.o raid6int16.o raid6int32.o \
raid6mmx.o raid6sse1.o raid6sse2.o
-host-progs := mktables
+hostprogs-y := mktables
# Note: link order is important. All raid personalities
# and xor.o must come before md.o, as they each initialise
diff -Nru a/drivers/media/dvb/ttpci/Makefile b/drivers/media/dvb/ttpci/Makefile
--- a/drivers/media/dvb/ttpci/Makefile 2004-08-13 21:08:01 +02:00
+++ b/drivers/media/dvb/ttpci/Makefile 2004-08-13 21:08:01 +02:00
@@ -13,7 +13,7 @@
EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
-host-progs := fdump
+hostprogs-y := fdump
ifdef CONFIG_DVB_AV7110_FIRMWARE
$(obj)/av7110.o: $(obj)/fdump $(obj)/av7110_firm.h
diff -Nru a/drivers/pci/Makefile b/drivers/pci/Makefile
--- a/drivers/pci/Makefile 2004-08-13 21:08:01 +02:00
+++ b/drivers/pci/Makefile 2004-08-13 21:08:01 +02:00
@@ -35,7 +35,7 @@
obj-y += syscall.o
endif
-host-progs := gen-devlist
+hostprogs-y := gen-devlist
# Dependencies on generated files need to be listed explicitly
$(obj)/names.o: $(obj)/devlist.h $(obj)/classlist.h
diff -Nru a/drivers/zorro/Makefile b/drivers/zorro/Makefile
--- a/drivers/zorro/Makefile 2004-08-13 21:08:01 +02:00
+++ b/drivers/zorro/Makefile 2004-08-13 21:08:01 +02:00
@@ -5,7 +5,7 @@
obj-$(CONFIG_ZORRO) += zorro.o zorro-driver.o zorro-sysfs.o names.o
obj-$(CONFIG_PROC_FS) += proc.o
-host-progs := gen-devlist
+hostprogs-y := gen-devlist
# Files generated that shall be removed upon make clean
clean-files := devlist.h
diff -Nru a/lib/Makefile b/lib/Makefile
--- a/lib/Makefile 2004-08-13 21:08:01 +02:00
+++ b/lib/Makefile 2004-08-13 21:08:01 +02:00
@@ -25,7 +25,7 @@
obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/
obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/
-host-progs := gen_crc32table
+hostprogs-y := gen_crc32table
clean-files := crc32table.h
$(obj)/crc32.o: $(obj)/crc32table.h
diff -Nru a/scripts/Makefile b/scripts/Makefile
--- a/scripts/Makefile 2004-08-13 21:08:01 +02:00
+++ b/scripts/Makefile 2004-08-13 21:08:01 +02:00
@@ -13,8 +13,7 @@
hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
hostprogs-$(CONFIG_IKCONFIG) += bin2c
-host-progs := $(sort $(hostprogs-y))
-always := $(host-progs)
+always := $(hostprogs-y)
subdir-$(CONFIG_MODVERSIONS) += genksyms
subdir-$(CONFIG_MODULES) += mod
diff -Nru a/scripts/basic/Makefile b/scripts/basic/Makefile
--- a/scripts/basic/Makefile 2004-08-13 21:08:01 +02:00
+++ b/scripts/basic/Makefile 2004-08-13 21:08:01 +02:00
@@ -11,8 +11,8 @@
# include/config/...
# docproc: Used in Documentation/docbook
-host-progs := fixdep split-include docproc
-always := $(host-progs)
+hostprogs-y := fixdep split-include docproc
+always := $(hostprogs-y)
# fixdep is needed to compile other host programs
$(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep
diff -Nru a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
--- a/scripts/genksyms/Makefile 2004-08-13 21:08:01 +02:00
+++ b/scripts/genksyms/Makefile 2004-08-13 21:08:01 +02:00
@@ -1,6 +1,6 @@
-host-progs := genksyms
-always := $(host-progs)
+hostprogs-y := genksyms
+always := $(hostprogs-y)
genksyms-objs := genksyms.o parse.o lex.o
diff -Nru a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
--- a/scripts/kconfig/Makefile 2004-08-13 21:08:01 +02:00
+++ b/scripts/kconfig/Makefile 2004-08-13 21:08:01 +02:00
@@ -67,7 +67,7 @@
libkconfig-objs := zconf.tab.o
-host-progs := conf mconf qconf gconf
+hostprogs-y := conf mconf qconf gconf
conf-objs := conf.o libkconfig.so
mconf-objs := mconf.o libkconfig.so
diff -Nru a/scripts/lxdialog/Makefile b/scripts/lxdialog/Makefile
--- a/scripts/lxdialog/Makefile 2004-08-13 21:08:01 +02:00
+++ b/scripts/lxdialog/Makefile 2004-08-13 21:08:01 +02:00
@@ -15,8 +15,8 @@
endif
endif
-host-progs := lxdialog
-always := ncurses $(host-progs)
+hostprogs-y := lxdialog
+always := ncurses $(hostprogs-y)
lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \
util.o lxdialog.o msgbox.o
diff -Nru a/scripts/mod/Makefile b/scripts/mod/Makefile
--- a/scripts/mod/Makefile 2004-08-13 21:08:01 +02:00
+++ b/scripts/mod/Makefile 2004-08-13 21:08:01 +02:00
@@ -1,5 +1,5 @@
-host-progs := modpost mk_elfconfig
-always := $(host-progs) empty.o
+hostprogs-y := modpost mk_elfconfig
+always := $(hostprogs-y) empty.o
modpost-objs := modpost.o file2alias.o sumversion.o
diff -Nru a/sound/oss/Makefile b/sound/oss/Makefile
--- a/sound/oss/Makefile 2004-08-13 21:08:01 +02:00
+++ b/sound/oss/Makefile 2004-08-13 21:08:01 +02:00
@@ -103,7 +103,7 @@
vidc_mod-objs := vidc.o vidc_fill.o
wavefront-objs := wavfront.o wf_midi.o yss225.o
-host-progs := bin2hex hex2hex
+hostprogs-y := bin2hex hex2hex
# Files generated that shall be removed upon make clean
clean-files := maui_boot.h msndperm.c msndinit.c pndsperm.c pndspini.c \
diff -Nru a/usr/Makefile b/usr/Makefile
--- a/usr/Makefile 2004-08-13 21:08:01 +02:00
+++ b/usr/Makefile 2004-08-13 21:08:01 +02:00
@@ -1,7 +1,7 @@
obj-y := initramfs_data.o
-host-progs := gen_init_cpio
+hostprogs-y := gen_init_cpio
clean-files := initramfs_data.cpio.gz
^ permalink raw reply [flat|nested] 14+ messages in thread* [10/12] kbuild: Fix hostprogs-y
2004-08-13 19:28 kbuild updates Sam Ravnborg
` (8 preceding siblings ...)
2004-08-13 19:51 ` [9/12] kbuild: Replace host-progs with hostprogs-y Sam Ravnborg
@ 2004-08-13 19:51 ` Sam Ravnborg
2004-08-13 19:52 ` [11/12] kbuild: Use POSIX headers for ntoh functions Sam Ravnborg
2004-08-13 19:52 ` [12/12] kbuild: __crc_* symbols in System.map Sam Ravnborg
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:51 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/10 21:56:40+02:00 sam@mars.ravnborg.org
# kbuild: Fix hostprogs-y
#
# Allow the same target to be specified more than once without causing a warnign from make.
# The same target may be specified twice when using the following pattern:
# hostprogs-$(CONFIG_FOO) += program
# hostprogs-$(CONFIG_BAR) += program
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# scripts/Makefile.host
# 2004/08/10 21:56:24+02:00 sam@mars.ravnborg.org +1 -1
# Allow same target to be specified more than once
#
diff -Nru a/scripts/Makefile.host b/scripts/Makefile.host
--- a/scripts/Makefile.host 2004-08-13 21:07:50 +02:00
+++ b/scripts/Makefile.host 2004-08-13 21:07:50 +02:00
@@ -30,7 +30,7 @@
# libkconfig.so as the executable conf.
# Note: Shared libraries consisting of C++ files are not supported
-__hostprogs := $(hostprogs-y)$(hostprogs-m)
+__hostprogs := $(sort $(hostprogs-y)$(hostprogs-m))
# hostprogs-y := tools/build may have been specified. Retreive directory
obj-dirs += $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f))))
^ permalink raw reply [flat|nested] 14+ messages in thread* [11/12] kbuild: Use POSIX headers for ntoh functions
2004-08-13 19:28 kbuild updates Sam Ravnborg
` (9 preceding siblings ...)
2004-08-13 19:51 ` [10/12] kbuild: Fix hostprogs-y Sam Ravnborg
@ 2004-08-13 19:52 ` Sam Ravnborg
2004-08-13 19:52 ` [12/12] kbuild: __crc_* symbols in System.map Sam Ravnborg
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:52 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/10 22:11:50+02:00 sam@mars.ravnborg.org
# kbuild: Use POSIX headers for ntoh functions
#
# From: Benno <benjl@cse.unsw.edu.au>
# When compiling Linux on Mac OSX I had trouble with scripts/sumversion.c.
# It includes <netinet/in.h> to obtain to definitions of htonl and ntohl.
#
# On Mac OSX these are found in <arpa/inet.h>. After checking the POSIX
# specification it appears that this is the correct place to get
# the definitons for these functions.
#
# (http://www.opengroup.org/onlinepubs/009695399/functions/htonl.html)
#
# Using this header also appears to work on Linux (at least with
# Glibc-2.3.2).
#
# It seems clearer to me to go with the POSIX standard than implementing
# #if __APPLE__ style macros, but if such an approach is preferred I can
# supply patches for that instead.
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# scripts/mod/sumversion.c
# 2004/08/10 22:11:33+02:00 sam@mars.ravnborg.org +1 -1
# Use correct POSIX header for ntoh functions
#
# scripts/basic/fixdep.c
# 2004/08/10 22:11:33+02:00 sam@mars.ravnborg.org +1 -1
# Use correct POSIX header for ntoh functions
#
diff -Nru a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
--- a/scripts/basic/fixdep.c 2004-08-13 21:07:40 +02:00
+++ b/scripts/basic/fixdep.c 2004-08-13 21:07:40 +02:00
@@ -104,7 +104,7 @@
#include <stdio.h>
#include <limits.h>
#include <ctype.h>
-#include <netinet/in.h>
+#include <arpa/inet.h>
#define INT_CONF ntohl(0x434f4e46)
#define INT_ONFI ntohl(0x4f4e4649)
diff -Nru a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
--- a/scripts/mod/sumversion.c 2004-08-13 21:07:40 +02:00
+++ b/scripts/mod/sumversion.c 2004-08-13 21:07:40 +02:00
@@ -1,4 +1,4 @@
-#include <netinet/in.h>
+#include <arpa/inet.h>
#include <stdint.h>
#include <ctype.h>
#include <errno.h>
^ permalink raw reply [flat|nested] 14+ messages in thread* [12/12] kbuild: __crc_* symbols in System.map
2004-08-13 19:28 kbuild updates Sam Ravnborg
` (10 preceding siblings ...)
2004-08-13 19:52 ` [11/12] kbuild: Use POSIX headers for ntoh functions Sam Ravnborg
@ 2004-08-13 19:52 ` Sam Ravnborg
11 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2004-08-13 19:52 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Linus Torvalds
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/08/13 20:14:30+02:00 sam@mars.ravnborg.org
# kbuild: __crc_* symbols in System.map
#
# David S. Miller <davem@redhat.com> wrote:
# Shouldn't we be grepping __crc_ symbols out of the System.map file?
#
# For one thing, these can confuse readprofile. It's algorithm is
# to start at _stext, then stop when it sees a line in the System.map
# which is not text (mode is one of 'T' 't' 'W' or 'w')
#
# It will exit early if there are some intermixed __crc_* things in
# there (since they are are mode 'A').
#
# For example, in my current sparc64 kernel I have this:
#
# 00000000004cef80 t do_split
# 00000000004cf2a0 t add_dirent_to_buf
# 00000000004cf5a7 A __crc_init_special_inode
# 00000000004cf640 t make_indexed_dir
# 00000000004cf900 t ext3_add_entry
#
# So no symbols after add_dirent_to_buf will be shown in the profiling
# output of readprofile.
#
# Implementation ported to mksysmap by Sam.
# Included two System.map related fixes:
# - Print "SYSMAP System.map" during build
# - Sort symbols in System.map
#
# Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
#
# scripts/mksysmap
# 2004/08/13 20:14:14+02:00 sam@mars.ravnborg.org +8 -1
# Remove __crc_ symbols from System.map
# Now also sort the output; '-n' option to nm
#
# Makefile
# 2004/08/13 20:14:14+02:00 sam@mars.ravnborg.org +6 -6
# Print out:
# SYSMAP System.map
# during build.
#
diff -Nru a/Makefile b/Makefile
--- a/Makefile 2004-08-13 21:07:25 +02:00
+++ b/Makefile 2004-08-13 21:07:25 +02:00
@@ -608,12 +608,12 @@
define rule_vmlinux
$(rule_vmlinux__);
- $(Q)$(if $($(quiet)cmd_sysmap), \
- echo ' $($(quiet)cmd_sysmap) $@' &&) \
- $(cmd_sysmap) $@ System.map; \
- if [ $$? -ne 0 ]; then \
- rm -f $@; \
- /bin/false; \
+ $(Q)$(if $($(quiet)cmd_sysmap), \
+ echo ' $($(quiet)cmd_sysmap) System.map' &&) \
+ $(cmd_sysmap) $@ System.map; \
+ if [ $$? -ne 0 ]; then \
+ rm -f $@; \
+ /bin/false; \
fi;
$(rule_verify_kallsyms)
endef
diff -Nru a/scripts/mksysmap b/scripts/mksysmap
--- a/scripts/mksysmap 2004-08-13 21:07:25 +02:00
+++ b/scripts/mksysmap 2004-08-13 21:07:25 +02:00
@@ -51,4 +51,11 @@
# U - undefined global symbols
# w - local weak symbols
-nm $1 | grep -v ' [aUw] ' > $2
+# readprofile starts reading symbols when _stext is found, and
+# continue until it finds a symbol which is not either of 'T', 't',
+# 'W' or 'w'. __crc_ are 'A' and placed in the middle
+# so we just ignore them to let readprofile continue to work.
+# (At least sparc64 has __crc_ in the middle).
+
+$NM -n $1 | grep -v '\( [aUw] \)\|\(__crc_\)' > $2
+
^ permalink raw reply [flat|nested] 14+ messages in thread