Commit 152d38aa authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Use normal rule for preprocessing vmlinux.lds.S

Use the same rule as in Rules.make for preprocessing 
vmlinux.lds.S, that also gives automatic dependency tracking.
This means we should also use the standard AFLAGS_... instead
of CPPFLAGS_... to provide specific additional flags.
parent a70dba80
...@@ -164,6 +164,9 @@ export srctree objtree ...@@ -164,6 +164,9 @@ export srctree objtree
SUBDIRS := init kernel mm fs ipc lib drivers sound net security SUBDIRS := init kernel mm fs ipc lib drivers sound net security
# The temporary file to save gcc -MD generated dependencies must not
# contain a comma
depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
noconfig_targets := xconfig menuconfig config oldconfig randconfig \ noconfig_targets := xconfig menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig allmodconfig \ defconfig allyesconfig allnoconfig allmodconfig \
...@@ -318,8 +321,12 @@ prepare: include/linux/version.h include/asm include/config/MARKER ...@@ -318,8 +321,12 @@ prepare: include/linux/version.h include/asm include/config/MARKER
# This can be used by arch/$ARCH/Makefile to preprocess # This can be used by arch/$ARCH/Makefile to preprocess
# their vmlinux.lds.S file # their vmlinux.lds.S file
arch/$(ARCH)/vmlinux.lds.s: arch/$(ARCH)/vmlinux.lds.S AFLAGS_vmlinux.lds.o += -P -C -U$(ARCH)
$(CPP) $(CPPFLAGS) $(CPPFLAGS_$@) -P -C -U$(ARCH) $< -o $@
arch/$(ARCH)/vmlinux.lds.s: arch/$(ARCH)/vmlinux.lds.S FORCE
$(call if_changed_dep,as_s_S)
targets += arch/$(ARCH)/vmlinux.lds.s
# Single targets # Single targets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -782,13 +789,34 @@ endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) ...@@ -782,13 +789,34 @@ endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
# FIXME Should go into a make.lib or something # FIXME Should go into a make.lib or something
# =========================================================================== # ===========================================================================
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
quiet_cmd_as_s_S = CPP $(echo_target)
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
# read all saved command lines # read all saved command lines
cmd_files := $(wildcard .*.cmd) targets := $(wildcard $(sort $(targets)))
cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
ifneq ($(cmd_files),) ifneq ($(cmd_files),)
include $(cmd_files) include $(cmd_files)
endif endif
# execute the command and also postprocess generated .d dependencies
# file
if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
$(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
$(cmd_$(1)); \
$(TOPDIR)/scripts/fixdep $(depfile) $@ $(TOPDIR) '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \
rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
# Usage: $(call if_changed_rule,foo) # Usage: $(call if_changed_rule,foo)
# will check if $(cmd_foo) changed, or any of the prequisites changed, # will check if $(cmd_foo) changed, or any of the prequisites changed,
# and if so will execute $(rule_foo) # and if so will execute $(rule_foo)
......
...@@ -96,9 +96,6 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot ...@@ -96,9 +96,6 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/$(ARCH)/vmlinux.lds.s vmlinux: arch/$(ARCH)/vmlinux.lds.s
arch/$(ARCH)/vmlinux.lds.s: arch/$(ARCH)/vmlinux.lds.S
$(CPP) $(CPPFLAGS) $(CPPFLAGS_$@) -D__ASSEMBLY__ -P -C -U$(ARCH) $< -o $@
compressed: vmlinux compressed: vmlinux
$(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux-tmp $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux-tmp
gzip vmlinux-tmp gzip vmlinux-tmp
......
...@@ -149,7 +149,7 @@ endif ...@@ -149,7 +149,7 @@ endif
vmlinux: arch/mips64/vmlinux.lds.s vmlinux: arch/mips64/vmlinux.lds.s
CPPFLAGS_arch/mips64/vmlinux.lds.s := -imacros $(srctree)/include/asm-mips64/sn/mapped_kernel.h AFLAGS_vmlinux.lds.o := -imacros $(srctree)/include/asm-mips64/sn/mapped_kernel.h
ifdef CONFIG_MAPPED_KERNEL ifdef CONFIG_MAPPED_KERNEL
vmlinux.64: vmlinux vmlinux.64: vmlinux
......
...@@ -72,9 +72,7 @@ endif ...@@ -72,9 +72,7 @@ endif
vmlinux: arch/sh/vmlinux.lds.s vmlinux: arch/sh/vmlinux.lds.s
CPPFLAGS_arch/sh/vmlinux.lds.s := -traditional AFLAGS_vmlinux.lds.o := -traditional
FORCE: ;
zImage: vmlinux zImage: vmlinux
@$(MAKEBOOT) zImage @$(MAKEBOOT) zImage
......
...@@ -67,8 +67,8 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" ...@@ -67,8 +67,8 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
# first line. # first line.
if [ -r $TARGET ] && \ if [ -r $TARGET ] && \
grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' $TARGET > .tmpver.1 && \ grep -v 'auto generated\|UTS_VERSION\|LINUX_COMPILE_TIME' $TARGET > .tmpver.1 && \
grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' .tmpcompile > .tmpver.2 && \ grep -v 'auto generated\|UTS_VERSION\|LINUX_COMPILE_TIME' .tmpcompile > .tmpver.2 && \
cmp -s .tmpver.1 .tmpver.2; then cmp -s .tmpver.1 .tmpver.2; then
echo ' (unchanged)' echo ' (unchanged)'
rm -f .tmpcompile rm -f .tmpcompile
......
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