From d4be8e512d2c1e76cbc81158a171d208d9e6b7f8 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Mon, 19 Jun 2023 01:49:59 -0300 Subject: build: disable most built-in implicit make rules Clear `.SUFFIXES:` to reduce unnecessary filesystem lookups. Overall, this appears to reduce the amount of implicit rule searches by ~62% for the default build and by ~96% for the "man" target (as an example): $ git checkout master >/dev/null 2>&1 $ git show --pretty='%h %ai %s' -s a8f01a383 2023-06-20 05:26:23 +0000 Merge pull request #5859 from kmk3/build-remove-retpoline $ ./configure >/dev/null $ make clean >/dev/null && make --debug=i -j 4 | grep -F 'Trying implicit' | wc -l 6798 $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l 1085 # (with this commit applied) $ make clean >/dev/null && make --debug=i -j 4 | grep -F 'Trying implicit' | wc -l 2535 $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l 42 Environment: GNU make 4.4.1-2 on Artix Linux. Commands used to search and replace: $ git ls-files -z -- '*Makefile*' | xargs -0 -I '{}' sh -c \ "printf '%s\n' \"\$(sed '1s/^/.SUFFIXES:\n/' '{}')\" >'{}'" See also commit f48886f25 ("build: mark most phony targets as such", 2023-02-01) / PR #5637. --- Makefile | 1 + src/bash_completion/Makefile | 1 + src/etc-cleanup/Makefile | 1 + src/fbuilder/Makefile | 1 + src/fcopy/Makefile | 1 + src/fids/Makefile | 1 + src/firecfg/Makefile | 1 + src/firejail/Makefile | 1 + src/firemon/Makefile | 1 + src/fldd/Makefile | 1 + src/fnet/Makefile | 1 + src/fnetfilter/Makefile | 1 + src/fnettrace-dns/Makefile | 1 + src/fnettrace-icmp/Makefile | 1 + src/fnettrace-sni/Makefile | 1 + src/fnettrace/Makefile | 1 + src/fsec-optimize/Makefile | 1 + src/fsec-print/Makefile | 1 + src/fseccomp/Makefile | 1 + src/ftee/Makefile | 1 + src/fzenity/Makefile | 1 + src/jailcheck/Makefile | 1 + src/lib/Makefile | 1 + src/libpostexecseccomp/Makefile | 1 + src/libtrace/Makefile | 1 + src/libtracelog/Makefile | 1 + src/man/Makefile | 1 + src/profstats/Makefile | 1 + src/zsh_completion/Makefile | 1 + test/Makefile | 1 + 30 files changed, 30 insertions(+) diff --git a/Makefile b/Makefile index 49c97c382..1d1d81566 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = . -include config.mk diff --git a/src/bash_completion/Makefile b/src/bash_completion/Makefile index bd447857e..516805886 100644 --- a/src/bash_completion/Makefile +++ b/src/bash_completion/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/etc-cleanup/Makefile b/src/etc-cleanup/Makefile index 10c28cd76..c8a12476e 100644 --- a/src/etc-cleanup/Makefile +++ b/src/etc-cleanup/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fbuilder/Makefile b/src/fbuilder/Makefile index ad73e8960..7595f0775 100644 --- a/src/fbuilder/Makefile +++ b/src/fbuilder/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fcopy/Makefile b/src/fcopy/Makefile index 27054627c..e2956fdd1 100644 --- a/src/fcopy/Makefile +++ b/src/fcopy/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fids/Makefile b/src/fids/Makefile index 44ea396d7..901cbb470 100644 --- a/src/fids/Makefile +++ b/src/fids/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/firecfg/Makefile b/src/firecfg/Makefile index 05cc088f4..59b713f1b 100644 --- a/src/firecfg/Makefile +++ b/src/firecfg/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/firejail/Makefile b/src/firejail/Makefile index 47edc5ac6..53bccf843 100644 --- a/src/firejail/Makefile +++ b/src/firejail/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/firemon/Makefile b/src/firemon/Makefile index 433e4267d..e0059aee5 100644 --- a/src/firemon/Makefile +++ b/src/firemon/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fldd/Makefile b/src/fldd/Makefile index 0c127af55..86693a76c 100644 --- a/src/fldd/Makefile +++ b/src/fldd/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnet/Makefile b/src/fnet/Makefile index 91de109fa..8efc6d26b 100644 --- a/src/fnet/Makefile +++ b/src/fnet/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnetfilter/Makefile b/src/fnetfilter/Makefile index 506d287ab..2be8311ae 100644 --- a/src/fnetfilter/Makefile +++ b/src/fnetfilter/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnettrace-dns/Makefile b/src/fnettrace-dns/Makefile index 36542f567..bbd4772e2 100644 --- a/src/fnettrace-dns/Makefile +++ b/src/fnettrace-dns/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnettrace-icmp/Makefile b/src/fnettrace-icmp/Makefile index 12ae42e9a..0d26dc2fc 100644 --- a/src/fnettrace-icmp/Makefile +++ b/src/fnettrace-icmp/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnettrace-sni/Makefile b/src/fnettrace-sni/Makefile index 8d9a437d5..554741fc8 100644 --- a/src/fnettrace-sni/Makefile +++ b/src/fnettrace-sni/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnettrace/Makefile b/src/fnettrace/Makefile index 952036ad3..94381d299 100644 --- a/src/fnettrace/Makefile +++ b/src/fnettrace/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fsec-optimize/Makefile b/src/fsec-optimize/Makefile index ce65f4719..4941f13b1 100644 --- a/src/fsec-optimize/Makefile +++ b/src/fsec-optimize/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fsec-print/Makefile b/src/fsec-print/Makefile index cbe061d45..78e87a93f 100644 --- a/src/fsec-print/Makefile +++ b/src/fsec-print/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fseccomp/Makefile b/src/fseccomp/Makefile index 1b8d0bb48..461179f4d 100644 --- a/src/fseccomp/Makefile +++ b/src/fseccomp/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/ftee/Makefile b/src/ftee/Makefile index 2f26ab900..0c27b4cbc 100644 --- a/src/ftee/Makefile +++ b/src/ftee/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fzenity/Makefile b/src/fzenity/Makefile index aeb862d9b..a17a9252f 100644 --- a/src/fzenity/Makefile +++ b/src/fzenity/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/jailcheck/Makefile b/src/jailcheck/Makefile index e3b84fbf3..23cd9c1a9 100644 --- a/src/jailcheck/Makefile +++ b/src/jailcheck/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/lib/Makefile b/src/lib/Makefile index f5b92e389..a7b093048 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/libpostexecseccomp/Makefile b/src/libpostexecseccomp/Makefile index 62e167b73..dfd8eb318 100644 --- a/src/libpostexecseccomp/Makefile +++ b/src/libpostexecseccomp/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/libtrace/Makefile b/src/libtrace/Makefile index d45b3e2f6..8b14a4335 100644 --- a/src/libtrace/Makefile +++ b/src/libtrace/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/libtracelog/Makefile b/src/libtracelog/Makefile index bfc5adddc..ac48264df 100644 --- a/src/libtracelog/Makefile +++ b/src/libtracelog/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/man/Makefile b/src/man/Makefile index bff4c30d0..197f76192 100644 --- a/src/man/Makefile +++ b/src/man/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/profstats/Makefile b/src/profstats/Makefile index 47b39e76c..b4cb1a6f7 100644 --- a/src/profstats/Makefile +++ b/src/profstats/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/zsh_completion/Makefile b/src/zsh_completion/Makefile index c68ed2d72..cc811ae99 100644 --- a/src/zsh_completion/Makefile +++ b/src/zsh_completion/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = ../.. -include $(ROOT)/config.mk diff --git a/test/Makefile b/test/Makefile index 2f023b8b1..08462c09b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,3 +1,4 @@ +.SUFFIXES: ROOT = .. -include $(ROOT)/config.mk -- cgit v1.2.3-54-g00ecf