Commit 744dbb74 authored by Sam Ravnborg's avatar Sam Ravnborg

Merge mars.ravnborg.org:/home/sam/bk/kbuild-mm

into mars.ravnborg.org:/home/sam/bk/kbuild
parents 4d802161 29d28b2a
...@@ -185,9 +185,7 @@ clean-files := $(DOCBOOKS) \ ...@@ -185,9 +185,7 @@ clean-files := $(DOCBOOKS) \
$(patsubst %.sgml, %.9, $(DOCBOOKS)) \ $(patsubst %.sgml, %.9, $(DOCBOOKS)) \
$(C-procfs-example) $(C-procfs-example)
ifneq ($(wildcard $(patsubst %.html,%,$(HTML))),) clean-dirs := $(patsubst %.sgml,%,$(DOCBOOKS))
clean-rule := rm -rf $(wildcard $(patsubst %.html,%,$(HTML)))
endif
#man put files in man subdir - traverse down #man put files in man subdir - traverse down
subdir- := man/ subdir- := man/
...@@ -25,6 +25,7 @@ This document describes the Linux kernel Makefiles. ...@@ -25,6 +25,7 @@ This document describes the Linux kernel Makefiles.
--- 4.4 Using C++ for host programs --- 4.4 Using C++ for host programs
--- 4.5 Controlling compiler options for host programs --- 4.5 Controlling compiler options for host programs
--- 4.6 When host programs are actually built --- 4.6 When host programs are actually built
--- 4.7 Using hostprogs-$(CONFIG_FOO)
=== 5 Kbuild clean infrastructure === 5 Kbuild clean infrastructure
...@@ -387,7 +388,7 @@ compilation stage. ...@@ -387,7 +388,7 @@ compilation stage.
Two steps are required in order to use a host executable. 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 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. 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, This can be done in two ways. Either add the dependency in a rule,
...@@ -402,7 +403,7 @@ Both possibilities are described in the following. ...@@ -402,7 +403,7 @@ Both possibilities are described in the following.
built on the build host. built on the build host.
Example: Example:
host-progs := bin2hex hostprogs-y := bin2hex
Kbuild assumes in the above example that bin2hex is made from a single 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 c-source file named bin2hex.c located in the same directory as
...@@ -418,7 +419,7 @@ Both possibilities are described in the following. ...@@ -418,7 +419,7 @@ Both possibilities are described in the following.
Example: Example:
#scripts/lxdialog/Makefile #scripts/lxdialog/Makefile
host-progs := lxdialog hostprogs-y := lxdialog
lxdialog-objs := checklist.o lxdialog.o lxdialog-objs := checklist.o lxdialog.o
Objects with extension .o are compiled from the corresponding .c Objects with extension .o are compiled from the corresponding .c
...@@ -438,7 +439,7 @@ Both possibilities are described in the following. ...@@ -438,7 +439,7 @@ Both possibilities are described in the following.
Example: Example:
#scripts/kconfig/Makefile #scripts/kconfig/Makefile
host-progs := conf hostprogs-y := conf
conf-objs := conf.o libkconfig.so conf-objs := conf.o libkconfig.so
libkconfig-objs := expr.o type.o libkconfig-objs := expr.o type.o
...@@ -457,7 +458,7 @@ Both possibilities are described in the following. ...@@ -457,7 +458,7 @@ Both possibilities are described in the following.
Example: Example:
#scripts/kconfig/Makefile #scripts/kconfig/Makefile
host-progs := qconf hostprogs-y := qconf
qconf-cxxobjs := qconf.o qconf-cxxobjs := qconf.o
In the example above the executable is composed of the C++ file In the example above the executable is composed of the C++ file
...@@ -468,7 +469,7 @@ Both possibilities are described in the following. ...@@ -468,7 +469,7 @@ Both possibilities are described in the following.
Example: Example:
#scripts/kconfig/Makefile #scripts/kconfig/Makefile
host-progs := qconf hostprogs-y := qconf
qconf-cxxobjs := qconf.o qconf-cxxobjs := qconf.o
qconf-objs := check.o qconf-objs := check.o
...@@ -509,7 +510,7 @@ Both possibilities are described in the following. ...@@ -509,7 +510,7 @@ Both possibilities are described in the following.
Example: Example:
#drivers/pci/Makefile #drivers/pci/Makefile
host-progs := gen-devlist hostprogs-y := gen-devlist
$(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist $(obj)/devlist.h: $(src)/pci.ids $(obj)/gen-devlist
( cd $(obj); ./gen-devlist ) < $< ( cd $(obj); ./gen-devlist ) < $<
...@@ -524,18 +525,32 @@ Both possibilities are described in the following. ...@@ -524,18 +525,32 @@ Both possibilities are described in the following.
Example: Example:
#scripts/lxdialog/Makefile #scripts/lxdialog/Makefile
host-progs := lxdialog hostprogs-y := lxdialog
always := $(host-progs) always := $(hostprogs-y)
This will tell kbuild to build lxdialog even if not referenced in This will tell kbuild to build lxdialog even if not referenced in
any rule. 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 === 5 Kbuild clean infrastructure
"make clean" deletes most generated files in the src tree where the kernel "make clean" deletes most generated files in the src tree where the kernel
is compiled. This includes generated files such as host programs. is compiled. This includes generated files such as host programs.
Kbuild knows targets listed in $(host-progs), $(always), $(extra-y) and Kbuild knows targets listed in $(hostprogs-y), $(hostprogs-m), $(always),
$(targets). They are all deleted during "make clean". $(extra-y) and $(targets). They are all deleted during "make clean".
Files matching the patterns "*.[oas]", "*.ko", plus some additional files Files matching the patterns "*.[oas]", "*.ko", plus some additional files
generated by kbuild are deleted all over the kernel src tree when generated by kbuild are deleted all over the kernel src tree when
"make clean" is executed. "make clean" is executed.
...@@ -547,8 +562,17 @@ Additional files can be specified in kbuild makefiles by use of $(clean-files). ...@@ -547,8 +562,17 @@ Additional files can be specified in kbuild makefiles by use of $(clean-files).
clean-files := devlist.h classlist.h clean-files := devlist.h classlist.h
When executing "make clean", the two files "devlist.h classlist.h" will When executing "make clean", the two files "devlist.h classlist.h" will
be deleted. Kbuild knows that files specified by $(clean-files) are be deleted. Kbuild will assume files to be in same relative directory as the
located in the same directory as the makefile. 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/", Usually kbuild descends down in subdirectories due to "obj-* := dir/",
but in the architecture makefiles where the kbuild infrastructure but in the architecture makefiles where the kbuild infrastructure
......
...@@ -294,8 +294,12 @@ AFLAGS_KERNEL = ...@@ -294,8 +294,12 @@ AFLAGS_KERNEL =
NOSTDINC_FLAGS = -nostdinc -iwithprefix include NOSTDINC_FLAGS = -nostdinc -iwithprefix include
CPPFLAGS := -D__KERNEL__ -Iinclude \ # Use LINUXINCLUDE when you must reference the include/ directory.
$(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include) # 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 \ CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common -fno-strict-aliasing -fno-common
...@@ -306,7 +310,7 @@ export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ ...@@ -306,7 +310,7 @@ export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK 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 CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
...@@ -538,8 +542,9 @@ define rule_vmlinux__ ...@@ -538,8 +542,9 @@ define rule_vmlinux__
echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
endef 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 LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds.s
# Generate section listing all symbols and add it into vmlinux # Generate section listing all symbols and add it into vmlinux
...@@ -570,8 +575,10 @@ endif ...@@ -570,8 +575,10 @@ endif
kallsyms.o := .tmp_kallsyms$(last_kallsyms).o kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
define rule_verify_kallsyms define rule_verify_kallsyms
@$(call do_system_map, .tmp_vmlinux$(last_kallsyms), .tmp_System.map) $(Q)$(if $($(quiet)cmd_sysmap), \
@cmp -s System.map .tmp_System.map || \ 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) (echo Inconsistent kallsyms data, try setting CONFIG_KALLSYMS_EXTRA_PASS ; rm .tmp_kallsyms* ; false)
endef endef
...@@ -581,7 +588,7 @@ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--al ...@@ -581,7 +588,7 @@ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--al
.tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
$(call if_changed_dep,as_o_S) $(call if_changed_dep,as_o_S)
.tmp_kallsyms%.S: .tmp_vmlinux% .tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS)
$(call cmd,kallsyms) $(call cmd,kallsyms)
.tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE .tmp_vmlinux1: $(vmlinux-objs) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
...@@ -595,11 +602,19 @@ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--al ...@@ -595,11 +602,19 @@ cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--al
endif 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 define rule_vmlinux
$(rule_vmlinux__); \ $(rule_vmlinux__);
$(call do_system_map, $@, System.map) $(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) $(rule_verify_kallsyms)
endef endef
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# Copyright (C) 1994 by Linus Torvalds # Copyright (C) 1994 by Linus Torvalds
# #
host-progs := tools/mkbb tools/objstrip hostprogs-y := tools/mkbb tools/objstrip
targets := vmlinux.gz vmlinux \ targets := vmlinux.gz vmlinux \
vmlinux.nh tools/lxboot tools/bootlx tools/bootph \ vmlinux.nh tools/lxboot tools/bootlx tools/bootph \
tools/bootpzh bootloader bootpheader bootpzheader tools/bootpzh bootloader bootpheader bootpzheader
......
...@@ -29,9 +29,9 @@ targets := vmlinux.bin bootsect bootsect.o setup setup.o \ ...@@ -29,9 +29,9 @@ targets := vmlinux.bin bootsect bootsect.o setup setup.o \
zImage bzImage zImage bzImage
subdir- := compressed subdir- := compressed
host-progs := tools/build hostprogs-y := tools/build
HOSTCFLAGS_build.o := -Iinclude HOSTCFLAGS_build.o := $(LINUXINCLUDE)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -23,12 +23,12 @@ subdir-$(CONFIG_PPC_OF) += of1275 ...@@ -23,12 +23,12 @@ subdir-$(CONFIG_PPC_OF) += of1275
# for cleaning # for cleaning
subdir- += simple openfirmware 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) .PHONY: $(BOOT_TARGETS) $(bootdir-y)
$(BOOT_TARGETS): $(bootdir-y) $(BOOT_TARGETS): $(bootdir-y)
$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \ $(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
$(addprefix $(obj)/,$(host-progs)) $(addprefix $(obj)/,$(hostprogs-y))
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)
...@@ -25,7 +25,7 @@ CROSS32_COMPILE ?= ...@@ -25,7 +25,7 @@ CROSS32_COMPILE ?=
BOOTCC := $(CROSS32_COMPILE)gcc BOOTCC := $(CROSS32_COMPILE)gcc
HOSTCC := gcc HOSTCC := gcc
BOOTCFLAGS := $(HOSTCFLAGS) -Iinclude -fno-builtin BOOTCFLAGS := $(HOSTCFLAGS) $(LINUXINCLUDE) -fno-builtin
BOOTAS := $(CROSS32_COMPILE)as BOOTAS := $(CROSS32_COMPILE)as
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional
BOOTLD := $(CROSS32_COMPILE)ld BOOTLD := $(CROSS32_COMPILE)ld
...@@ -58,7 +58,7 @@ obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section))) ...@@ -58,7 +58,7 @@ obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section)))
src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(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 \ targets += zImage zImage.initrd imagesize.c \
$(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
$(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
......
...@@ -7,28 +7,52 @@ ...@@ -7,28 +7,52 @@
ROOT_IMG := /usr/src/root.img ROOT_IMG := /usr/src/root.img
ELFTOAOUT := elftoaout ELFTOAOUT := elftoaout
host-progs := piggyback btfixupprep hostprogs-y := piggyback btfixupprep
targets := tftpboot.img btfix.o btfix.s image targets := tftpboot.img btfix.o btfix.S image
quiet_cmd_elftoaout = ELFTOAOUT $@ quiet_cmd_elftoaout = ELFTOAOUT $@
cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@ cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
quiet_cmd_piggy = PIGGY $@ quiet_cmd_piggy = PIGGY $@
cmd_piggy = $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG) cmd_piggy = $(obj)/piggyback $@ $(obj)/System.map $(ROOT_IMG)
quiet_cmd_btfix = BTFIX $@ quiet_cmd_btfix = BTFIX $@
cmd_btfix = $(OBJDUMP) -x vmlinux | $(obj)/btfixupprep > $@ 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) BTOBJS := $(HEAD_Y) $(INIT_Y)
BTLIBS := $(CORE_Y) $(LIBS_Y) $(DRIVERS_Y) $(NET_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 $(obj)/image: $(obj)/btfix.o FORCE
$(call if_changed,ld) $(call if_changed_rule,image)
$(NM) $@ | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > $(obj)/System.map
$(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE $(obj)/tftpboot.img: $(obj)/piggyback $(obj)/System.map $(obj)/image FORCE
$(call if_changed,elftoaout) $(call if_changed,elftoaout)
$(call if_changed,piggy) $(call if_changed,piggy)
$(obj)/btfix.s: $(obj)/btfixupprep vmlinux FORCE $(obj)/btfix.S: $(obj)/btfixupprep vmlinux FORCE
$(call if_changed,btfix) $(call if_changed,btfix)
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
ROOT_IMG := /usr/src/root.img ROOT_IMG := /usr/src/root.img
ELFTOAOUT := elftoaout ELFTOAOUT := elftoaout
host-progs := piggyback hostprogs-y := piggyback
targets := image tftpboot.img vmlinux.aout targets := image tftpboot.img vmlinux.aout
quiet_cmd_elftoaout = ELF2AOUT $@ quiet_cmd_elftoaout = ELF2AOUT $@
......
host-progs := mk_sc hostprogs-y := mk_sc
always := $(host-progs) mk_thread always := $(hostprogs-y) mk_thread
targets := mk_thread_kern.o mk_thread_user.o targets := mk_thread_kern.o mk_thread_user.o
mk_sc-objs := mk_sc.o mk_sc-objs := mk_sc.o
......
...@@ -30,7 +30,7 @@ targets := vmlinux.bin bootsect bootsect.o \ ...@@ -30,7 +30,7 @@ targets := vmlinux.bin bootsect bootsect.o \
EXTRA_CFLAGS := -m32 EXTRA_CFLAGS := -m32
host-progs := tools/build hostprogs-y := tools/build
subdir- := compressed/ #Let make clean descend in compressed/ subdir- := compressed/ #Let make clean descend in compressed/
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
fore_200e-objs := fore200e.o fore_200e-objs := fore200e.o
host-progs := fore200e_mkfirm hostprogs-y := fore200e_mkfirm
# Files generated that shall be removed upon make clean # Files generated that shall be removed upon make clean
clean-files := atmsar11.bin atmsar11.bin1 atmsar11.bin2 pca200e.bin \ clean-files := atmsar11.bin atmsar11.bin1 atmsar11.bin2 pca200e.bin \
......
...@@ -10,7 +10,7 @@ raid6-objs := raid6main.o raid6algos.o raid6recov.o raid6tables.o \ ...@@ -10,7 +10,7 @@ raid6-objs := raid6main.o raid6algos.o raid6recov.o raid6tables.o \
raid6int1.o raid6int2.o raid6int4.o \ raid6int1.o raid6int2.o raid6int4.o \
raid6int8.o raid6int16.o raid6int32.o \ raid6int8.o raid6int16.o raid6int32.o \
raid6mmx.o raid6sse1.o raid6sse2.o raid6mmx.o raid6sse1.o raid6sse2.o
host-progs := mktables hostprogs-y := mktables
# Note: link order is important. All raid personalities # Note: link order is important. All raid personalities
# and xor.o must come before md.o, as they each initialise # and xor.o must come before md.o, as they each initialise
......
...@@ -13,7 +13,7 @@ obj-$(CONFIG_DVB_AV7110) += dvb-ttpci.o ttpci-eeprom.o ...@@ -13,7 +13,7 @@ obj-$(CONFIG_DVB_AV7110) += dvb-ttpci.o ttpci-eeprom.o
EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
host-progs := fdump hostprogs-y := fdump
ifdef CONFIG_DVB_AV7110_FIRMWARE ifdef CONFIG_DVB_AV7110_FIRMWARE
$(obj)/av7110.o: $(obj)/fdump $(obj)/av7110_firm.h $(obj)/av7110.o: $(obj)/fdump $(obj)/av7110_firm.h
......
...@@ -35,7 +35,7 @@ ifndef CONFIG_X86 ...@@ -35,7 +35,7 @@ ifndef CONFIG_X86
obj-y += syscall.o obj-y += syscall.o
endif endif
host-progs := gen-devlist hostprogs-y := gen-devlist
# Dependencies on generated files need to be listed explicitly # Dependencies on generated files need to be listed explicitly
$(obj)/names.o: $(obj)/devlist.h $(obj)/classlist.h $(obj)/names.o: $(obj)/devlist.h $(obj)/classlist.h
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
obj-$(CONFIG_ZORRO) += zorro.o zorro-driver.o zorro-sysfs.o names.o obj-$(CONFIG_ZORRO) += zorro.o zorro-driver.o zorro-sysfs.o names.o
obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_PROC_FS) += proc.o
host-progs := gen-devlist hostprogs-y := gen-devlist
# Files generated that shall be removed upon make clean # Files generated that shall be removed upon make clean
clean-files := devlist.h clean-files := devlist.h
......
...@@ -25,7 +25,7 @@ obj-$(CONFIG_LIBCRC32C) += libcrc32c.o ...@@ -25,7 +25,7 @@ obj-$(CONFIG_LIBCRC32C) += libcrc32c.o
obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/ obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/
obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/ obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/
host-progs := gen_crc32table hostprogs-y := gen_crc32table
clean-files := crc32table.h clean-files := crc32table.h
$(obj)/crc32.o: $(obj)/crc32table.h $(obj)/crc32.o: $(obj)/crc32table.h
......
...@@ -2,14 +2,21 @@ ...@@ -2,14 +2,21 @@
# scripts contains sources for various helper programs used throughout # scripts contains sources for various helper programs used throughout
# the kernel for the build process. # 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 # conmakehash: Create arrays for initializing the kernel console tables
host-progs := conmakehash kallsyms pnmtologo bin2c hostprogs-$(CONFIG_KALLSYMS) += kallsyms
always := $(host-progs) hostprogs-$(CONFIG_LOGO) += pnmtologo
hostprogs-$(CONFIG_VT) += conmakehash
hostprogs-$(CONFIG_PROM_CONSOLE) += conmakehash
hostprogs-$(CONFIG_IKCONFIG) += bin2c
subdir-$(CONFIG_MODVERSIONS) += genksyms always := $(hostprogs-y)
subdir-y += mod
subdir-$(CONFIG_MODVERSIONS) += genksyms
subdir-$(CONFIG_MODULES) += mod
# Let clean descend into subdirs # Let clean descend into subdirs
subdir- += basic lxdialog kconfig package subdir- += basic lxdialog kconfig package
...@@ -14,6 +14,16 @@ include $(obj)/Makefile ...@@ -14,6 +14,16 @@ include $(obj)/Makefile
include scripts/Makefile.lib include scripts/Makefile.lib
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
ifneq ($(KBUILD_SRC),) ifneq ($(KBUILD_SRC),)
# Create output directory if not already present # Create output directory if not already present
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
...@@ -275,90 +285,6 @@ $(multi-used-m) : %.o: $(multi-objs-m) FORCE ...@@ -275,90 +285,6 @@ $(multi-used-m) : %.o: $(multi-objs-m) FORCE
targets += $(multi-used-y) $(multi-used-m) 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 # Descending
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
...@@ -29,21 +29,37 @@ subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) ...@@ -29,21 +29,37 @@ subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
# Add subdir path # Add subdir path
subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
__clean-files := $(wildcard $(addprefix $(obj)/, \ __clean-files := $(extra-y) $(EXTRA_TARGETS) $(always) \
$(extra-y) $(EXTRA_TARGETS) $(always) $(host-progs) \ $(targets) $(clean-files) \
$(targets) $(clean-files))) $(host-progs) \
$(hostprogs-y) $(hostprogs-m) $(hostprogs-)
__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) quiet_cmd_clean = CLEAN $(obj)
cmd_clean = rm -f $(__clean-files); $(clean-rule) cmd_clean = rm -f $(__clean-files)
quiet_cmd_cleandir = CLEAN $(__clean-dirs)
cmd_cleandir = rm -rf $(__clean-dirs)
__clean: $(subdir-ymn) __clean: $(subdir-ymn)
ifneq ($(strip $(__clean-files) $(clean-rule)),) ifneq ($(strip $(__clean-files)),)
+$(call cmd,clean) +$(call cmd,clean)
else
@:
endif endif
ifneq ($(strip $(__clean-dirs)),)
+$(call cmd,cleandir)
endif
ifneq ($(strip $(clean-rule)),)
+$(clean-rule)
endif
@:
# =========================================================================== # ===========================================================================
# Generic stuff # Generic stuff
......
# ==========================================================================
# 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)
# hostprogs-y := bin2hex
# Will compile bin2hex.c and create an executable named bin2hex
#
# 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
#
# 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
# 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
# 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
__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))))
obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs))))
# C code
# Executables compiled from a single .c file
host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m)))
# C executables linked based on several .o files
host-cmulti := $(foreach m,$(__hostprogs),\
$(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m))))
# Object (.o) files compiled from .c files
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,$(__hostprogs),$(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))))
__hostprogs := $(addprefix $(obj)/,$(__hostprogs))
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)
...@@ -60,41 +60,11 @@ subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o) ...@@ -60,41 +60,11 @@ subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)
# $(obj-dirs) is a list of directories that contain object files # $(obj-dirs) is a list of directories that contain object files
obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) 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 # 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-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))) 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 # Add subdir path
extra-y := $(addprefix $(obj)/,$(extra-y)) extra-y := $(addprefix $(obj)/,$(extra-y))
...@@ -113,14 +83,6 @@ multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) ...@@ -113,14 +83,6 @@ multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) 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 # The temporary file to save gcc -MD generated dependencies must not
# contain a comma # contain a comma
...@@ -136,12 +98,8 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d) ...@@ -136,12 +98,8 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F)))
modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname)))) modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname))))
_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o)
_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*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 # If building the kernel in a separate objtree expand all occurrences
# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
...@@ -149,8 +107,6 @@ _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o) ...@@ -149,8 +107,6 @@ _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o)
ifeq ($(KBUILD_SRC),) ifeq ($(KBUILD_SRC),)
__c_flags = $(_c_flags) __c_flags = $(_c_flags)
__a_flags = $(_a_flags) __a_flags = $(_a_flags)
__hostc_flags = $(_hostc_flags)
__hostcxx_flags = $(_hostcxx_flags)
else else
# Prefix -I with $(srctree) if it is not an absolute path # Prefix -I with $(srctree) if it is not an absolute path
...@@ -164,8 +120,6 @@ flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) ...@@ -164,8 +120,6 @@ flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
# FIXME: Replace both with specific CFLAGS* statements in the makefiles # FIXME: Replace both with specific CFLAGS* statements in the makefiles
__c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags) __c_flags = $(call addtree,-I$(obj)) $(call flags,_c_flags)
__a_flags = $(call flags,_a_flags) __a_flags = $(call flags,_a_flags)
__hostc_flags = -I$(obj) $(call flags,_hostc_flags)
__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
endif endif
c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
...@@ -175,9 +129,6 @@ c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ ...@@ -175,9 +129,6 @@ c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
$(__a_flags) $(modkern_aflags) $(__a_flags) $(modkern_aflags)
hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS) ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS)
# Finds the multi-part object the current object will be linked into # Finds the multi-part object the current object will be linked into
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
# include/config/... # include/config/...
# docproc: Used in Documentation/docbook # docproc: Used in Documentation/docbook
host-progs := fixdep split-include docproc hostprogs-y := fixdep split-include docproc
always := $(host-progs) always := $(hostprogs-y)
# fixdep is needed to compile other host programs # fixdep is needed to compile other host programs
$(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep $(addprefix $(obj)/,$(filter-out fixdep,$(always))): $(obj)/fixdep
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#include <ctype.h> #include <ctype.h>
#include <netinet/in.h> #include <arpa/inet.h>
#define INT_CONF ntohl(0x434f4e46) #define INT_CONF ntohl(0x434f4e46)
#define INT_ONFI ntohl(0x4f4e4649) #define INT_ONFI ntohl(0x4f4e4649)
......
host-progs := genksyms hostprogs-y := genksyms
always := $(host-progs) always := $(hostprogs-y)
genksyms-objs := genksyms.o parse.o lex.o genksyms-objs := genksyms.o parse.o lex.o
......
...@@ -67,7 +67,7 @@ help: ...@@ -67,7 +67,7 @@ help:
libkconfig-objs := zconf.tab.o libkconfig-objs := zconf.tab.o
host-progs := conf mconf qconf gconf hostprogs-y := conf mconf qconf gconf
conf-objs := conf.o libkconfig.so conf-objs := conf.o libkconfig.so
mconf-objs := mconf.o libkconfig.so mconf-objs := mconf.o libkconfig.so
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h>
#include <unistd.h> #include <unistd.h>
#define LKC_DIRECT_LINK #define LKC_DIRECT_LINK
...@@ -268,6 +269,7 @@ int conf_write(const char *name) ...@@ -268,6 +269,7 @@ int conf_write(const char *name)
char dirname[128], tmpname[128], newname[128]; char dirname[128], tmpname[128], newname[128];
int type, l; int type, l;
const char *str; const char *str;
time_t now;
dirname[0] = 0; dirname[0] = 0;
if (name && name[0]) { if (name && name[0]) {
...@@ -301,14 +303,25 @@ int conf_write(const char *name) ...@@ -301,14 +303,25 @@ int conf_write(const char *name)
if (!out_h) if (!out_h)
return 1; return 1;
} }
sym = sym_lookup("KERNELRELEASE", 0);
sym_calc_value(sym);
time(&now);
fprintf(out, "#\n" fprintf(out, "#\n"
"# Automatically generated make config: don't edit\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) if (out_h)
fprintf(out_h, "/*\n" fprintf(out_h, "/*\n"
" * Automatically generated C config: don't edit\n" " * Automatically generated C config: don't edit\n"
" * Linux kernel version: %s\n"
" * %s"
" */\n" " */\n"
"#define AUTOCONF_INCLUDED\n"); "#define AUTOCONF_INCLUDED\n",
sym_get_string_value(sym),
ctime(&now));
if (!sym_change_count) if (!sym_change_count)
sym_clear_all_valid(); sym_clear_all_valid();
......
...@@ -15,8 +15,8 @@ endif ...@@ -15,8 +15,8 @@ endif
endif endif
endif endif
host-progs := lxdialog hostprogs-y := lxdialog
always := ncurses $(host-progs) always := ncurses $(hostprogs-y)
lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \
util.o lxdialog.o msgbox.o util.o lxdialog.o msgbox.o
......
#!/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
# 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
host-progs := modpost mk_elfconfig hostprogs-y := modpost mk_elfconfig
always := $(host-progs) empty.o always := $(hostprogs-y) empty.o
modpost-objs := modpost.o file2alias.o sumversion.o modpost-objs := modpost.o file2alias.o sumversion.o
......
#include <netinet/in.h> #include <arpa/inet.h>
#include <stdint.h> #include <stdint.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
......
...@@ -51,7 +51,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec ...@@ -51,7 +51,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec
$(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz $(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
rm ../$(KERNELPATH).tar.gz rm ../$(KERNELPATH).tar.gz
clean-rule += rm -f $(objtree)/kernel.spec clean-files := $(objtree)/kernel.spec
# binrpm-pkg # binrpm-pkg
.PHONY: binrpm-pkg .PHONY: binrpm-pkg
...@@ -67,7 +67,7 @@ binrpm-pkg: $(objtree)/binkernel.spec ...@@ -67,7 +67,7 @@ binrpm-pkg: $(objtree)/binkernel.spec
$(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $< $(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $<
clean-rule += rm -f $(objtree)/binkernel.spec clean-files += $(objtree)/binkernel.spec
# Deb target # Deb target
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -77,7 +77,7 @@ deb-pkg: ...@@ -77,7 +77,7 @@ deb-pkg:
$(MAKE) $(MAKE)
$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
clean-rule += && rm -rf $(objtree)/debian/ clean-dirs += $(objtree)/debian/
# Help text displayed when executing 'make help' # Help text displayed when executing 'make help'
......
...@@ -103,7 +103,7 @@ sb_lib-objs := sb_common.o sb_audio.o sb_midi.o sb_mixer.o sb_ess.o ...@@ -103,7 +103,7 @@ sb_lib-objs := sb_common.o sb_audio.o sb_midi.o sb_mixer.o sb_ess.o
vidc_mod-objs := vidc.o vidc_fill.o vidc_mod-objs := vidc.o vidc_fill.o
wavefront-objs := wavfront.o wf_midi.o yss225.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 # Files generated that shall be removed upon make clean
clean-files := maui_boot.h msndperm.c msndinit.c pndsperm.c pndspini.c \ clean-files := maui_boot.h msndperm.c msndinit.c pndsperm.c pndspini.c \
......
obj-y := initramfs_data.o obj-y := initramfs_data.o
host-progs := gen_init_cpio hostprogs-y := gen_init_cpio
clean-files := initramfs_data.cpio.gz clean-files := initramfs_data.cpio.gz
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment