aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Thelen <gthelen@google.com>2018-06-26 22:38:32 -0700
committerBen Hutchings <ben@decadent.org.uk>2019-01-02 03:08:04 +0000
commitedee9092e32482a06cc441cf47ae78b5e7c4a621 (patch)
tree7e1b96347304bd1405eba234f55bfa68109389a3
parent56bfd58fdce4fc32a2be2981655252840c9c02cb (diff)
downloadklibc-edee9092e32482a06cc441cf47ae78b5e7c4a621.tar.gz
[klibc] add more PHONY targets to $(PHONY)
make-3.81 excludes PHONY dependencies from $?, make 3.82+ includes them. This leads to always rebuilding klibc targets that depend on .PHONY dependencies. From the make 3.82 release notes https://lists.gnu.org/archive/html/info-gnu/2010-07/msg00023.html: * WARNING: Backward-incompatibility! The '$?' variable now contains all prerequisites that caused the target to be considered out of date, even if they do not exist (previously only existing targets were provided in $?). Linux fixed this with commit 4f1933620f57 ("kbuild: change kbuild to not rely on incorrect GNU make behavior"). Similar to Linux, klibc if_changed already excludes $(PHONY) from $? when determining if a target is up-to-date. Klibc also has a $(PHONY) list of phony targets. But klibc does not add many .PHONY targets to $(PHONY). Changes in this patch: - add previously defined .PHONY targets to PHONY, so existing if_changed filtering applies to them as well - declare $(PHONY) targets as .PHONY Signed-off-by: Greg Thelen <gthelen@google.com> Link: https://www.zytor.com/pipermail/klibc/2018-June/003995.html Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--scripts/Kbuild.install10
-rw-r--r--scripts/Kbuild.klibc8
-rw-r--r--scripts/Makefile.clean8
3 files changed, 19 insertions, 7 deletions
diff --git a/scripts/Kbuild.install b/scripts/Kbuild.install
index 8af569777cc32..bafd42328ddbb 100644
--- a/scripts/Kbuild.install
+++ b/scripts/Kbuild.install
@@ -14,7 +14,7 @@
SHLIBDIR = /lib
# First rule
-.PHONY: __install install-rule
+PHONY := __install install-rule
__install:
# Install commands
@@ -64,7 +64,7 @@ else
endif
# Descending
-.PHONY: $(subdir-)
+PHONY += $(subdir-)
$(subdir-):
$(Q)$(MAKE) KLIBC_INSTALL=1 \
-f $(srctree)/scripts/Kbuild.install obj=$@
@@ -84,7 +84,7 @@ else
# 1) Create directories, install headers and man pages
# 2) Tell that we now install binaries
# 3) Install binaries by descending
-.PHONY: header footer descend
+PHONY += header footer descend
header:
$(Q)echo " INSTALL headers + man pages to $(INSTALLROOT)$(INSTALLDIR)"
$(Q)mkdir -p $(INSTALLROOT)$(bindir)
@@ -111,3 +111,7 @@ descend: footer
__install: descend
@:
endif
+
+# Declare the contents of the PHONY variable as phony. We keep the variable for
+# if_changed.
+.PHONY: $(PHONY)
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index f500d5358ef66..f147a37309e39 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -54,7 +54,7 @@ src := $(obj)
# Preset target and make sure it is a ':=' variable
targets :=
-.phony: __build
+PHONY := __build
__build:
# Read .config if it exist, otherwise ignore
@@ -374,7 +374,7 @@ endif
# Descending
# ---------------------------------------------------------------------------
-.PHONY: $(subdir-y) $(kprog-dirs) $(klib-dirs)
+PHONY += $(subdir-y) $(kprog-dirs) $(klib-dirs)
$(sort $(subdir-y) $(kprog-dirs) $(klib-dirs)): $(lib-target)
$(Q)$(MAKE) $(klibc)=$@
@@ -419,3 +419,7 @@ endif
# Usage:
# $(Q)$(MAKE) $(klibc)=dir
klibc := -rR -f $(srctree)/scripts/Kbuild.klibc obj
+
+# Declare the contents of the PHONY variable as phony. We keep the variable for
+# if_changed.
+.PHONY: $(PHONY)
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
index a5887492bac5e..abc4e3fc06fe0 100644
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -4,7 +4,7 @@
src := $(obj)
-.PHONY: __clean
+.PHONY := __clean
__clean:
# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
@@ -83,10 +83,14 @@ endif
# Descending
# ---------------------------------------------------------------------------
-.PHONY: $(subdirs)
+PHONY += $(subdirs)
$(subdirs):
$(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 the variable for
+# if_changed.
+.PHONY: $(PHONY)