[klibc] [klibc:master] add more PHONY targets to $(PHONY)
klibc-bot for Greg Thelen
gthelen at google.com
Fri Jan 18 08:42:11 PST 2019
Commit-ID: edee9092e32482a06cc441cf47ae78b5e7c4a621
Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=edee9092e32482a06cc441cf47ae78b5e7c4a621
Author: Greg Thelen <gthelen at google.com>
AuthorDate: Tue, 26 Jun 2018 22:38:32 -0700
Committer: Ben Hutchings <ben at decadent.org.uk>
CommitDate: Wed, 2 Jan 2019 03:08:04 +0000
[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 at google.com>
Link: https://www.zytor.com/pipermail/klibc/2018-June/003995.html
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
scripts/Kbuild.install | 10 +++++++---
scripts/Kbuild.klibc | 8 ++++++--
scripts/Makefile.clean | 8 ++++++--
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/scripts/Kbuild.install b/scripts/Kbuild.install
index 8af5697..bafd423 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 f500d53..f147a37 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 a588749..abc4e3f 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)
More information about the klibc
mailing list