The kbuild system takes advantage of an incorrect behavior in GNU make.
Once this behavior is fixed, all files in the kernel rebuild every time,
even if nothing has changed. This patch ensures kbuild works with both
the incorrect and correct behaviors of GNU make.
For more details on the incorrect behavior, see:
http://lists.gnu.org/archive/html/bug-make/2006-03/msg00003.html
Changes in this patch:
- Keep all targets that are to be marked .PHONY in a variable, PHONY.
- Add .PHONY: $(PHONY) to mark them properly.
- Remove any $(PHONY) files from the $? list when determining whether
targets are up-to-date or not.
Signed-off-by: Paul Smith <psmith@gnu.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
25 files changed:
###
# The targets that may be used.
###
# The targets that may be used.
-.PHONY: xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs
+PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs
BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
xmldocs: $(BOOKS)
BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
xmldocs: $(BOOKS)
#man put files in man subdir - traverse down
subdir- := man/
#man put files in man subdir - traverse down
subdir- := man/
+
+
+# Declare the contents of the .PHONY variable as phony. We keep that
+# information in a variable se we can use it in if_changed and friends.
+
+.PHONY: $(PHONY)
endif
# That's our default target when none is given on the command line
endif
# That's our default target when none is given on the command line
_all:
ifneq ($(KBUILD_OUTPUT),)
_all:
ifneq ($(KBUILD_OUTPUT),)
$(if $(KBUILD_OUTPUT),, \
$(error output directory "$(saved-output)" does not exist))
$(if $(KBUILD_OUTPUT),, \
$(error output directory "$(saved-output)" does not exist))
+PHONY += $(MAKECMDGOALS)
$(filter-out _all,$(MAKECMDGOALS)) _all:
$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
$(filter-out _all,$(MAKECMDGOALS)) _all:
$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
# If building an external module we do not care about the all: rule
# but instead _all depend on modules
# If building an external module we do not care about the all: rule
# but instead _all depend on modules
ifeq ($(KBUILD_EXTMOD),)
_all: all
else
ifeq ($(KBUILD_EXTMOD),)
_all: all
else
# Rules shared between *config targets and build targets
# Basic helpers built in scripts/
# Rules shared between *config targets and build targets
# Basic helpers built in scripts/
scripts_basic:
$(Q)$(MAKE) $(build)=scripts/basic
# To avoid any implicit rule to kick in, define an empty command.
scripts/basic/%: scripts_basic ;
scripts_basic:
$(Q)$(MAKE) $(build)=scripts/basic
# To avoid any implicit rule to kick in, define an empty command.
scripts/basic/%: scripts_basic ;
# outputmakefile generate a Makefile to be placed in output directory, if
# using a seperate output directory. This allows convinient use
# of make in output directory
# outputmakefile generate a Makefile to be placed in output directory, if
# using a seperate output directory. This allows convinient use
# of make in output directory
# Additional helpers built in scripts/
# Carefully list dependencies so we do not try to build scripts twice
# in parrallel
# Additional helpers built in scripts/
# Carefully list dependencies so we do not try to build scripts twice
# in parrallel
scripts: scripts_basic include/config/MARKER
$(Q)$(MAKE) $(build)=$(@)
scripts: scripts_basic include/config/MARKER
$(Q)$(MAKE) $(build)=$(@)
# make menuconfig etc.
# Error messages still appears in the original language
# make menuconfig etc.
# Error messages still appears in the original language
+PHONY += $(vmlinux-dirs)
$(vmlinux-dirs): prepare scripts
$(Q)$(MAKE) $(build)=$@
$(vmlinux-dirs): prepare scripts
$(Q)$(MAKE) $(build)=$@
# version.h and scripts_basic is processed / created.
# Listed in dependency order
# version.h and scripts_basic is processed / created.
# Listed in dependency order
-.PHONY: prepare archprepare prepare0 prepare1 prepare2 prepare3
+PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
# prepare-all is deprecated, use prepare as valid replacement
# prepare-all is deprecated, use prepare as valid replacement
# prepare3 is used to check if we are building in a separate output directory,
# and if so do:
# prepare3 is used to check if we are building in a separate output directory,
# and if so do:
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
depend dep:
@echo '*** Warning: make $@ is unnecessary now.'
depend dep:
@echo '*** Warning: make $@ is unnecessary now.'
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
@echo ' Building modules, stage 2.';
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
# Target to prepare building external modules
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
@echo ' Building modules, stage 2.';
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
# Target to prepare building external modules
+PHONY += modules_prepare
modules_prepare: prepare scripts
# Target to install modules
modules_prepare: prepare scripts
# Target to install modules
+PHONY += modules_install
modules_install: _modinst_ _modinst_post
modules_install: _modinst_ _modinst_post
_modinst_:
@if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
echo "Warning: you may need to install module-init-tools"; \
_modinst_:
@if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
echo "Warning: you may need to install module-init-tools"; \
else
depmod_opts := -b $(INSTALL_MOD_PATH) -r
endif
else
depmod_opts := -b $(INSTALL_MOD_PATH) -r
endif
_modinst_post: _modinst_
if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
_modinst_post: _modinst_
if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
clean: rm-files := $(CLEAN_FILES)
clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))
clean: rm-files := $(CLEAN_FILES)
clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))
-.PHONY: $(clean-dirs) clean archclean
+PHONY += $(clean-dirs) clean archclean
$(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
$(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts)
mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts)
-.PHONY: $(mrproper-dirs) mrproper archmrproper
+PHONY += $(mrproper-dirs) mrproper archmrproper
$(mrproper-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
$(mrproper-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
distclean: mrproper
@find $(srctree) $(RCS_FIND_IGNORE) \
distclean: mrproper
@find $(srctree) $(RCS_FIND_IGNORE) \
# rpm target kept for backward compatibility
package-dir := $(srctree)/scripts/package
# rpm target kept for backward compatibility
package-dir := $(srctree)/scripts/package
%pkg: FORCE
$(Q)$(MAKE) -f $(package-dir)/Makefile $@
%pkg: FORCE
$(Q)$(MAKE) -f $(package-dir)/Makefile $@
# We are always building modules
KBUILD_MODULES := 1
# We are always building modules
KBUILD_MODULES := 1
crmodverdir:
$(Q)rm -rf $(MODVERDIR)
$(Q)mkdir -p $(MODVERDIR)
crmodverdir:
$(Q)rm -rf $(MODVERDIR)
$(Q)mkdir -p $(MODVERDIR)
-.PHONY: $(objtree)/Module.symvers
+PHONY += $(objtree)/Module.symvers
$(objtree)/Module.symvers:
@test -e $(objtree)/Module.symvers || ( \
echo; \
$(objtree)/Module.symvers:
@test -e $(objtree)/Module.symvers || ( \
echo; \
echo )
module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
echo )
module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD))
-.PHONY: $(module-dirs) modules
+PHONY += $(module-dirs) modules
$(module-dirs): crmodverdir $(objtree)/Module.symvers
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
$(module-dirs): crmodverdir $(objtree)/Module.symvers
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
@echo ' Building modules, stage 2.';
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
@echo ' Building modules, stage 2.';
$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
+PHONY += modules_install
modules_install: _emodinst_ _emodinst_post
modules_install: _emodinst_ _emodinst_post
-install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
-.PHONY: _emodinst_
+install-dir := $(if $(INSTALL_MOD_DIR),$(INSTALL_MOD_DIR),extra)
+PHONY += _emodinst_
_emodinst_:
$(Q)rm -rf $(MODLIB)/$(install-dir)
$(Q)mkdir -p $(MODLIB)/$(install-dir)
_emodinst_:
$(Q)rm -rf $(MODLIB)/$(install-dir)
$(Q)mkdir -p $(MODLIB)/$(install-dir)
_emodinst_post: _emodinst_
$(call cmd,depmod)
clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
_emodinst_post: _emodinst_
$(call cmd,depmod)
clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
-.PHONY: $(clean-dirs) clean
+PHONY += $(clean-dirs) clean
$(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
$(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
+PHONY += prepare scripts
prepare: ;
scripts: ;
endif # KBUILD_EXTMOD
prepare: ;
scripts: ;
endif # KBUILD_EXTMOD
endif #ifeq ($(config-targets),1)
endif #ifeq ($(mixed-targets),1)
endif #ifeq ($(config-targets),1)
endif #ifeq ($(mixed-targets),1)
checkstack:
$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
$(PERL) $(src)/scripts/checkstack.pl $(ARCH)
checkstack:
$(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \
$(PERL) $(src)/scripts/checkstack.pl $(ARCH)
+
+
+# Declare the contents of the .PHONY variable as phony. We keep that
+# information in a variable se we can use it in if_changed and friends.
+.PHONY: $(PHONY)
+# This file is included by the global makefile so that you can add your own
+# architecture-specific flags and dependencies.
+#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
+PHONY += maketools FORCE
maketools: include/linux/version.h include/asm-arm/.arch FORCE
$(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h
maketools: include/linux/version.h include/asm-arm/.arch FORCE
$(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h
#
# arch/arm/boot/Makefile
#
#
# arch/arm/boot/Makefile
#
+# This file is included by the global makefile so that you can add your own
+# architecture-specific flags and dependencies.
+#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
$(call if_changed,objcopy)
@echo ' Kernel: $@ is ready'
$(call if_changed,objcopy)
@echo ' Kernel: $@ is ready'
initrd:
@test "$(INITRD_PHYS)" != "" || \
(echo This machine does not support INITRD; exit -1)
initrd:
@test "$(INITRD_PHYS)" != "" || \
(echo This machine does not support INITRD; exit -1)
#
# linux/arch/arm/boot/bootp/Makefile
#
#
# linux/arch/arm/boot/bootp/Makefile
#
+# This file is included by the global makefile so that you can add your own
+# architecture-specific flags and dependencies.
+#
LDFLAGS_bootp :=-p --no-undefined -X \
--defsym initrd_phys=$(INITRD_PHYS) \
LDFLAGS_bootp :=-p --no-undefined -X \
--defsym initrd_phys=$(INITRD_PHYS) \
$(obj)/initrd.o: $(INITRD) FORCE
$(obj)/initrd.o: $(INITRD) FORCE
+PHONY += $(INITRD) FORCE
#
# arch/arm26/Makefile
#
#
# arch/arm26/Makefile
#
+# This file is included by the global makefile so that you can add your own
+# architecture-specific flags and dependencies.
+#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
+PHONY += maketools FORCE
# Convert bzImage to zImage
bzImage: vmlinux
# Convert bzImage to zImage
bzImage: vmlinux
#
# arch/arm26/boot/Makefile
#
#
# arch/arm26/boot/Makefile
#
+# This file is included by the global makefile so that you can add your own
+# architecture-specific flags and dependencies.
+#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
@echo ' Kernel: $@ is ready'
endif
@echo ' Kernel: $@ is ready'
endif
initrd:
@test "$(INITRD_PHYS)" != "" || \
(echo This machine does not support INITRD; exit -1)
initrd:
@test "$(INITRD_PHYS)" != "" || \
(echo This machine does not support INITRD; exit -1)
-.PHONY: zImage bzImage compressed zlilo bzlilo \
- zdisk bzdisk fdimage fdimage144 fdimage288 install
+PHONY += zImage bzImage compressed zlilo bzlilo \
+ zdisk bzdisk fdimage fdimage144 fdimage288 install
+# This file is included by the global makefile so that you can add your own
+# architecture-specific flags and dependencies.
+#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
boot := arch/ia64/hp/sim/boot
boot := arch/ia64/hp/sim/boot
-.PHONY: boot compressed check
+PHONY += boot compressed check
+# This file is included by the global makefile so that you can add your own
+# architecture-specific flags and dependencies.
+#
LDFLAGS :=
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS :=
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage
+PHONY += $(BOOT_TARGETS)
boot := arch/$(ARCH)/boot
boot := arch/$(ARCH)/boot
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
+PHONY += $(BOOT_TARGETS)
#
# arch/ppc/boot/Makefile
#
#
# arch/ppc/boot/Makefile
#
+# This file is included by the global makefile so that you can add your own
+# architecture-specific flags and dependencies.
+#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
hostprogs-y := $(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)
# Makefile for making bootable images on various OpenFirmware machines.
#
# Makefile for making bootable images on various OpenFirmware machines.
#
+# This file is included by the global makefile so that you can add your own
+# architecture-specific flags and dependencies.
+#
# Paul Mackerras January 1997
# XCOFF bootable images for PowerMacs
# Geert Uytterhoeven September 1997
# Paul Mackerras January 1997
# XCOFF bootable images for PowerMacs
# Geert Uytterhoeven September 1997
# The targets used on the make command-line
# The targets used on the make command-line
-.PHONY: zImage zImage.initrd
+PHONY += zImage zImage.initrd
zImage: $(images)/zImage.chrp \
$(images)/zImage.chrp-rs6k
@echo ' kernel: $@ is ready ($<)'
zImage: $(images)/zImage.chrp \
$(images)/zImage.chrp-rs6k
@echo ' kernel: $@ is ready ($<)'
TFTPIMAGE := /tftpboot/zImage
TFTPIMAGE := /tftpboot/zImage
-.PHONY: znetboot znetboot.initrd
+PHONY += znetboot znetboot.initrd
znetboot: $(images)/zImage.chrp
cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
@echo ' kernel: $@ is ready ($<)'
znetboot: $(images)/zImage.chrp
cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
@echo ' kernel: $@ is ready ($<)'
archprepare: maketools include/asm-sh/.cpu include/asm-sh/.mach
archprepare: maketools include/asm-sh/.cpu include/asm-sh/.mach
+PHONY += maketools FORCE
maketools: include/linux/version.h FORCE
$(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
maketools: include/linux/version.h FORCE
$(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
+#
+# This file is included by the global makefile so that you can add your own
+# architecture-specific flags and dependencies.
+#
# Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
# Licensed under the GPL
#
# Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
# Licensed under the GPL
#
SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000)
SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000)
-.PHONY: bzImage bzlilo install archmrproper \
- fdimage fdimage144 fdimage288 archclean
+PHONY += bzImage bzlilo install archmrproper \
+ fdimage fdimage144 fdimage288 archclean
#Default target when executing "make"
all: bzImage
#Default target when executing "make"
all: bzImage
# function to only execute the passed command if necessary
# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file
# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars
# function to only execute the passed command if necessary
# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file
# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars
-#
-if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
+#
+if_changed = $(if $(strip $(filter-out $(PHONY),$?) \
+ $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
@set -e; \
$(echo-cmd) $(cmd_$(1)); \
echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd)
# execute the command and also postprocess generated .d dependencies
# file
@set -e; \
$(echo-cmd) $(cmd_$(1)); \
echo 'cmd_$@ := $(make-cmd)' > $(@D)/.$(@F).cmd)
# execute the command and also postprocess generated .d dependencies
# file
-if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
- $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
+if_changed_dep = $(if $(strip $(filter-out $(PHONY),$?) \
+ $(filter-out FORCE $(wildcard $^),$^) \
+ $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \
@set -e; \
$(echo-cmd) $(cmd_$(1)); \
scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \
@set -e; \
$(echo-cmd) $(cmd_$(1)); \
scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(@D)/.$(@F).tmp; \
# Usage: $(call if_changed_rule,foo)
# will check if $(cmd_foo) changed, or any of the prequisites changed,
# and if so will execute $(rule_foo)
# Usage: $(call if_changed_rule,foo)
# will check if $(cmd_foo) changed, or any of the prequisites changed,
# and if so will execute $(rule_foo)
-if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
+if_changed_rule = $(if $(strip $(filter-out $(PHONY),$?) \
+ $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\
__build:
# Read .config if it exist, otherwise ignore
__build:
# Read .config if it exist, otherwise ignore
# Descending
# ---------------------------------------------------------------------------
# Descending
# ---------------------------------------------------------------------------
$(subdir-ym):
$(Q)$(MAKE) $(build)=$@
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
$(subdir-ym):
$(Q)$(MAKE) $(build)=$@
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
ifneq ($(cmd_files),)
include $(cmd_files)
endif
ifneq ($(cmd_files),)
include $(cmd_files)
endif
+
+
+# Declare the contents of the .PHONY variable as phony. We keep that
+# information in a variable se we can use it in if_changed and friends.
+
+.PHONY: $(PHONY)
__clean:
# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
__clean:
# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
# Descending
# ---------------------------------------------------------------------------
# Descending
# ---------------------------------------------------------------------------
$(subdir-ymn):
$(Q)$(MAKE) $(clean)=$@
# If quiet is set, only print short version of command
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
$(subdir-ymn):
$(Q)$(MAKE) $(clean)=$@
# If quiet is set, only print short version of command
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
+
+
+# Declare the contents of the .PHONY variable as phony. We keep that
+# information in a variable se we can use it in if_changed and friends.
+
+.PHONY: $(PHONY)
# Installing modules
# ==========================================================================
# Installing modules
# ==========================================================================
__modinst:
include scripts/Kbuild.include
__modinst:
include scripts/Kbuild.include
__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
$(modules):
$(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
$(modules):
$(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
+
+
+# Declare the contents of the .PHONY variable as phony. We keep that
+# information in a variable se we can use it in if_changed and friends.
+
+.PHONY: $(PHONY)
# Step 4 is solely used to allow module versioning in external modules,
# where the CRC of each module is retrieved from the Module.symers file.
# Step 4 is solely used to allow module versioning in external modules,
# where the CRC of each module is retrieved from the Module.symers file.
_modpost: __modpost
include .config
_modpost: __modpost
include .config
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(filter-out FORCE,$^)
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(filter-out FORCE,$^)
__modpost: $(wildcard vmlinux) $(modules:.ko=.o) FORCE
$(call cmd,modpost)
__modpost: $(wildcard vmlinux) $(modules:.ko=.o) FORCE
$(call cmd,modpost)
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
ifneq ($(cmd_files),)
include $(cmd_files)
endif
ifneq ($(cmd_files),)
include $(cmd_files)
endif
+
+
+# Declare the contents of the .PHONY variable as phony. We keep that
+# information in a variable se we can use it in if_changed and friends.
+
+.PHONY: $(PHONY)
# Kernel configuration targets
# These targets are used from top-level makefile
# Kernel configuration targets
# These targets are used from top-level makefile
-.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
+PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
xconfig: $(obj)/qconf
$< arch/$(ARCH)/Kconfig
xconfig: $(obj)/qconf
$< arch/$(ARCH)/Kconfig
$(Q)rm -f arch/um/Kconfig_arch
$(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
$(Q)rm -f arch/um/Kconfig_arch
$(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
-.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
+PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
randconfig: $(obj)/conf
$< -r arch/$(ARCH)/Kconfig
randconfig: $(obj)/conf
$< -r arch/$(ARCH)/Kconfig
# we really need to do so. (Do not call gcc as part of make mrproper)
HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
# we really need to do so. (Do not call gcc as part of make mrproper)
HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
-
-HOST_EXTRACFLAGS += -DLOCALE
+HOST_EXTRACFLAGS += -DLOCALE
+
+PHONY += dochecklxdialog
$(obj)/dochecklxdialog:
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES)
$(obj)/dochecklxdialog:
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES)
PREV := set -e; cd ..;
# rpm-pkg
PREV := set -e; cd ..;
# rpm-pkg
$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
$(CONFIG_SHELL) $(MKSPEC) > $@
$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
$(CONFIG_SHELL) $(MKSPEC) > $@
clean-files := $(objtree)/kernel.spec
# binrpm-pkg
clean-files := $(objtree)/kernel.spec
# binrpm-pkg
$(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
$(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
binrpm-pkg: $(objtree)/binkernel.spec
$(MAKE) KBUILD_SRC=
set -e; \
binrpm-pkg: $(objtree)/binkernel.spec
$(MAKE) KBUILD_SRC=
set -e; \
# Deb target
# ---------------------------------------------------------------------------
#
# Deb target
# ---------------------------------------------------------------------------
#
deb-pkg:
$(MAKE) KBUILD_SRC=
$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
deb-pkg:
$(MAKE) KBUILD_SRC=
$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
# tarball targets
# ---------------------------------------------------------------------------
# tarball targets
# ---------------------------------------------------------------------------
tar%pkg:
$(MAKE) KBUILD_SRC=
$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
tar%pkg:
$(MAKE) KBUILD_SRC=
$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@