@@ -95,7 +95,7 @@ ifdef O
9595endif
9696
9797# That's our default target when none is given on the command line
98- . PHONY: _all
98+ PHONY := _all
9999_all :
100100
101101ifneq ($(KBUILD_OUTPUT ) ,)
@@ -106,7 +106,7 @@ KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
106106$(if $(KBUILD_OUTPUT),, \
107107 $(error output directory "$(saved-output)" does not exist))
108108
109- . PHONY: $(MAKECMDGOALS )
109+ PHONY += $(MAKECMDGOALS )
110110
111111$(filter-out _all,$(MAKECMDGOALS ) ) _all :
112112 $(if $(KBUILD_VERBOSE:1= ) ,@)$(MAKE ) -C $(KBUILD_OUTPUT ) \
@@ -123,7 +123,7 @@ ifeq ($(skip-makefile),)
123123
124124# If building an external module we do not care about the all: rule
125125# but instead _all depend on modules
126- . PHONY: all
126+ PHONY += all
127127ifeq ($(KBUILD_EXTMOD ) ,)
128128_all : all
129129else
@@ -337,14 +337,14 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exc
337337# Rules shared between *config targets and build targets
338338
339339# Basic helpers built in scripts/
340- . PHONY: scripts_basic
340+ PHONY += scripts_basic
341341scripts_basic :
342342 $(Q )$(MAKE ) $(build ) =scripts/basic
343343
344344# To avoid any implicit rule to kick in, define an empty command.
345345scripts/basic/% : scripts_basic ;
346346
347- . PHONY: outputmakefile
347+ PHONY += outputmakefile
348348# outputmakefile generate a Makefile to be placed in output directory, if
349349# using a seperate output directory. This allows convinient use
350350# of make in output directory
@@ -420,7 +420,7 @@ ifeq ($(KBUILD_EXTMOD),)
420420# Additional helpers built in scripts/
421421# Carefully list dependencies so we do not try to build scripts twice
422422# in parrallel
423- . PHONY: scripts
423+ PHONY += scripts
424424scripts : scripts_basic include/config/MARKER
425425 $(Q )$(MAKE ) $(build ) =$(@ )
426426
@@ -720,7 +720,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
720720# make menuconfig etc.
721721# Error messages still appears in the original language
722722
723- . PHONY: $(vmlinux-dirs )
723+ PHONY += $(vmlinux-dirs )
724724$(vmlinux-dirs ) : prepare scripts
725725 $(Q )$(MAKE ) $(build ) =$@
726726
@@ -773,10 +773,10 @@ kernelrelease = $(KERNELVERSION)$(localver-full)
773773# version.h and scripts_basic is processed / created.
774774
775775# Listed in dependency order
776- . PHONY: prepare archprepare prepare0 prepare1 prepare2 prepare3
776+ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
777777
778778# prepare-all is deprecated, use prepare as valid replacement
779- . PHONY: prepare-all
779+ PHONY += prepare-all
780780
781781# prepare3 is used to check if we are building in a separate output directory,
782782# and if so do:
@@ -857,7 +857,7 @@ include/linux/version.h: $(srctree)/Makefile .config .kernelrelease FORCE
857857
858858# ---------------------------------------------------------------------------
859859
860- . PHONY: depend dep
860+ PHONY += depend dep
861861depend dep :
862862 @echo ' *** Warning: make $@ is unnecessary now.'
863863
@@ -872,21 +872,21 @@ all: modules
872872
873873# Build modules
874874
875- . PHONY: modules
875+ PHONY += modules
876876modules : $(vmlinux-dirs ) $(if $(KBUILD_BUILTIN ) ,vmlinux)
877877 @echo ' Building modules, stage 2.' ;
878878 $(Q )$(MAKE ) -rR -f $(srctree ) /scripts/Makefile.modpost
879879
880880
881881# Target to prepare building external modules
882- . PHONY: modules_prepare
882+ PHONY += modules_prepare
883883modules_prepare : prepare scripts
884884
885885# Target to install modules
886- . PHONY: modules_install
886+ PHONY += modules_install
887887modules_install : _modinst_ _modinst_post
888888
889- . PHONY: _modinst_
889+ PHONY += _modinst_
890890_modinst_ :
891891 @if [ -z " ` $( DEPMOD) -V 2> /dev/null | grep module-init-tools` " ]; then \
892892 echo " Warning: you may need to install module-init-tools" ; \
@@ -913,7 +913,7 @@ depmod_opts :=
913913else
914914depmod_opts := -b $(INSTALL_MOD_PATH ) -r
915915endif
916- . PHONY: _modinst_post
916+ PHONY += _modinst_post
917917_modinst_post : _modinst_
918918 if [ -r System.map -a -x $( DEPMOD) ]; then $( DEPMOD) -ae -F System.map $( depmod_opts) $( KERNELRELEASE) ; fi
919919
@@ -956,7 +956,7 @@ clean: rm-dirs := $(CLEAN_DIRS)
956956clean : rm-files := $(CLEAN_FILES )
957957clean-dirs := $(addprefix _clean_,$(srctree ) $(vmlinux-alldirs ) )
958958
959- . PHONY: $(clean-dirs ) clean archclean
959+ PHONY += $(clean-dirs ) clean archclean
960960$(clean-dirs ) :
961961 $(Q )$(MAKE ) $(clean ) =$(patsubst _clean_% ,% ,$@ )
962962
@@ -974,7 +974,7 @@ mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
974974mrproper : rm-files := $(wildcard $(MRPROPER_FILES ) )
975975mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts)
976976
977- . PHONY: $(mrproper-dirs ) mrproper archmrproper
977+ PHONY += $(mrproper-dirs ) mrproper archmrproper
978978$(mrproper-dirs ) :
979979 $(Q )$(MAKE ) $(clean ) =$(patsubst _mrproper_% ,% ,$@ )
980980
@@ -984,7 +984,7 @@ mrproper: clean archmrproper $(mrproper-dirs)
984984
985985# distclean
986986#
987- . PHONY: distclean
987+ PHONY += distclean
988988
989989distclean : mrproper
990990 @find $(srctree ) $(RCS_FIND_IGNORE ) \
@@ -1000,7 +1000,7 @@ distclean: mrproper
10001000# rpm target kept for backward compatibility
10011001package-dir := $(srctree ) /scripts/package
10021002
1003- . PHONY: % -pkg rpm
1003+ PHONY += %-pkg rpm
10041004
10051005% pkg : FORCE
10061006 $(Q )$(MAKE ) -f $(package-dir ) /Makefile $@
@@ -1092,12 +1092,12 @@ else # KBUILD_EXTMOD
10921092
10931093# We are always building modules
10941094KBUILD_MODULES := 1
1095- . PHONY: crmodverdir
1095+ PHONY += crmodverdir
10961096crmodverdir :
10971097 $(Q ) rm -rf $(MODVERDIR )
10981098 $(Q ) mkdir -p $(MODVERDIR )
10991099
1100- . PHONY: $(objtree ) /Module.symvers
1100+ PHONY += $(objtree ) /Module.symvers
11011101$(objtree ) /Module.symvers :
11021102 @test -e $(objtree ) /Module.symvers || ( \
11031103 echo ; \
@@ -1106,19 +1106,19 @@ $(objtree)/Module.symvers:
11061106 echo )
11071107
11081108module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD ) )
1109- . PHONY: $(module-dirs ) modules
1109+ PHONY += $(module-dirs ) modules
11101110$(module-dirs ) : crmodverdir $(objtree ) /Module.symvers
11111111 $(Q )$(MAKE ) $(build ) =$(patsubst _module_% ,% ,$@ )
11121112
11131113modules : $(module-dirs )
11141114 @echo ' Building modules, stage 2.' ;
11151115 $(Q )$(MAKE ) -rR -f $(srctree ) /scripts/Makefile.modpost
11161116
1117- . PHONY: modules_install
1117+ PHONY += modules_install
11181118modules_install : _emodinst_ _emodinst_post
11191119
1120- install-dir := $(if $(INSTALL_MOD_DIR ) ,$(INSTALL_MOD_DIR ) ,extra)
1121- . PHONY: _emodinst_
1120+ install-dir := $(if $(INSTALL_MOD_DIR ) ,$(INSTALL_MOD_DIR ) ,extra)
1121+ PHONY += _emodinst_
11221122_emodinst_ :
11231123 $(Q ) rm -rf $(MODLIB ) /$(install-dir )
11241124 $(Q ) mkdir -p $(MODLIB ) /$(install-dir )
@@ -1133,13 +1133,13 @@ quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
11331133 $(KERNELRELEASE ) ; \
11341134 fi
11351135
1136- . PHONY: _emodinst_post
1136+ PHONY += _emodinst_post
11371137_emodinst_post : _emodinst_
11381138 $(call cmd,depmod)
11391139
11401140clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD ) )
11411141
1142- . PHONY: $(clean-dirs ) clean
1142+ PHONY += $(clean-dirs ) clean
11431143$(clean-dirs ) :
11441144 $(Q )$(MAKE ) $(clean ) =$(patsubst _clean_% ,% ,$@ )
11451145
@@ -1161,7 +1161,7 @@ help:
11611161 @echo ' '
11621162
11631163# Dummies...
1164- . PHONY: prepare scripts
1164+ PHONY += prepare scripts
11651165prepare : ;
11661166scripts : ;
11671167endif # KBUILD_EXTMOD
@@ -1274,7 +1274,7 @@ namespacecheck:
12741274endif # ifeq ($(config-targets),1)
12751275endif # ifeq ($(mixed-targets),1)
12761276
1277- . PHONY: checkstack
1277+ PHONY += checkstack
12781278checkstack :
12791279 $(OBJDUMP ) -d vmlinux $$(find . -name '*.ko' ) | \
12801280 $(PERL ) $(src ) /scripts/checkstack.pl $(ARCH )
@@ -1357,4 +1357,10 @@ clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj
13571357
13581358endif # skip-makefile
13591359
1360+ PHONY += FORCE
13601361FORCE :
1362+
1363+
1364+ # Declare the contents of the .PHONY variable as phony. We keep that
1365+ # information in a variable se we can use it in if_changed and friends.
1366+ .PHONY : $(PHONY )
0 commit comments