[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
    * 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

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>
3 files changed