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. --- src/libpostexecseccomp/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libpostexecseccomp/Makefile') 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 -- cgit v1.2.3-54-g00ecf From 9789c263a2bfc28aa2685f24d452ace4be150aa6 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Wed, 21 Jun 2023 02:00:21 -0300 Subject: build: disable all built-in implicit make rules Use `make -r` to reduce unnecessary filesystem lookups. Overall, this appears to reduce the amount of implicit rule searches by ~93.3% (~97.5% compared to a8f01a383) for the default build and by ~83.3% (~99.3% compared to a8f01a383) for the "man" target (as an example): $ 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 # (in the previous commit) $ 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 # (with this commit applied) $ make clean >/dev/null && make --debug=i -j 4 | grep -F 'Trying implicit' | wc -l 170 $ make clean >/dev/null && make --debug=i -j 4 man | grep -F 'Trying implicit' | wc -l 7 Environment: GNU make 4.4.1-2 on Artix Linux. Note: According to make(1p) in POSIX.1-2017, "If .SUFFIXES does not have any prerequisites, the list of known suffixes shall be cleared.", while "The result of setting MAKEFLAGS in the Makefile is unspecified." Commands used to search and replace: $ git ls-files -z -- '*Makefile*' | xargs -0 -I '{}' sh -c \ "printf '%s\n' \"\$(sed -E \ 's/^(.SUFFIXES:)/\1\nMAKEFLAGS += -r\n/' '{}')\" >'{}'" --- Makefile | 2 ++ src/bash_completion/Makefile | 2 ++ src/etc-cleanup/Makefile | 2 ++ src/fbuilder/Makefile | 2 ++ src/fcopy/Makefile | 2 ++ src/fids/Makefile | 2 ++ src/firecfg/Makefile | 2 ++ src/firejail/Makefile | 2 ++ src/firemon/Makefile | 2 ++ src/fldd/Makefile | 2 ++ src/fnet/Makefile | 2 ++ src/fnetfilter/Makefile | 2 ++ src/fnettrace-dns/Makefile | 2 ++ src/fnettrace-icmp/Makefile | 2 ++ src/fnettrace-sni/Makefile | 2 ++ src/fnettrace/Makefile | 2 ++ src/fsec-optimize/Makefile | 2 ++ src/fsec-print/Makefile | 2 ++ src/fseccomp/Makefile | 2 ++ src/ftee/Makefile | 2 ++ src/fzenity/Makefile | 2 ++ src/jailcheck/Makefile | 2 ++ src/lib/Makefile | 2 ++ src/libpostexecseccomp/Makefile | 2 ++ src/libtrace/Makefile | 2 ++ src/libtracelog/Makefile | 2 ++ src/man/Makefile | 2 ++ src/profstats/Makefile | 2 ++ src/zsh_completion/Makefile | 2 ++ test/Makefile | 2 ++ 30 files changed, 60 insertions(+) (limited to 'src/libpostexecseccomp/Makefile') diff --git a/Makefile b/Makefile index 1d1d81566..4607926b4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = . -include config.mk diff --git a/src/bash_completion/Makefile b/src/bash_completion/Makefile index 516805886..6d5c45532 100644 --- a/src/bash_completion/Makefile +++ b/src/bash_completion/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/etc-cleanup/Makefile b/src/etc-cleanup/Makefile index c8a12476e..7c542c4a9 100644 --- a/src/etc-cleanup/Makefile +++ b/src/etc-cleanup/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fbuilder/Makefile b/src/fbuilder/Makefile index 7595f0775..803ea18a3 100644 --- a/src/fbuilder/Makefile +++ b/src/fbuilder/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fcopy/Makefile b/src/fcopy/Makefile index e2956fdd1..29ea719a3 100644 --- a/src/fcopy/Makefile +++ b/src/fcopy/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fids/Makefile b/src/fids/Makefile index 901cbb470..1aaac5c75 100644 --- a/src/fids/Makefile +++ b/src/fids/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/firecfg/Makefile b/src/firecfg/Makefile index 59b713f1b..c9489e3a4 100644 --- a/src/firecfg/Makefile +++ b/src/firecfg/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/firejail/Makefile b/src/firejail/Makefile index 53bccf843..064373588 100644 --- a/src/firejail/Makefile +++ b/src/firejail/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/firemon/Makefile b/src/firemon/Makefile index e0059aee5..514eb98eb 100644 --- a/src/firemon/Makefile +++ b/src/firemon/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fldd/Makefile b/src/fldd/Makefile index 86693a76c..35ce019a7 100644 --- a/src/fldd/Makefile +++ b/src/fldd/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnet/Makefile b/src/fnet/Makefile index 8efc6d26b..a40d69b11 100644 --- a/src/fnet/Makefile +++ b/src/fnet/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnetfilter/Makefile b/src/fnetfilter/Makefile index 2be8311ae..fbae2e027 100644 --- a/src/fnetfilter/Makefile +++ b/src/fnetfilter/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnettrace-dns/Makefile b/src/fnettrace-dns/Makefile index bbd4772e2..3c825467c 100644 --- a/src/fnettrace-dns/Makefile +++ b/src/fnettrace-dns/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnettrace-icmp/Makefile b/src/fnettrace-icmp/Makefile index 0d26dc2fc..9e94fa144 100644 --- a/src/fnettrace-icmp/Makefile +++ b/src/fnettrace-icmp/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnettrace-sni/Makefile b/src/fnettrace-sni/Makefile index 554741fc8..21dfde3d3 100644 --- a/src/fnettrace-sni/Makefile +++ b/src/fnettrace-sni/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fnettrace/Makefile b/src/fnettrace/Makefile index 94381d299..a952a84a4 100644 --- a/src/fnettrace/Makefile +++ b/src/fnettrace/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fsec-optimize/Makefile b/src/fsec-optimize/Makefile index 4941f13b1..40511bdaa 100644 --- a/src/fsec-optimize/Makefile +++ b/src/fsec-optimize/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fsec-print/Makefile b/src/fsec-print/Makefile index 78e87a93f..6f09e9161 100644 --- a/src/fsec-print/Makefile +++ b/src/fsec-print/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fseccomp/Makefile b/src/fseccomp/Makefile index 461179f4d..bd5c92113 100644 --- a/src/fseccomp/Makefile +++ b/src/fseccomp/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/ftee/Makefile b/src/ftee/Makefile index 0c27b4cbc..8b4e7fdf4 100644 --- a/src/ftee/Makefile +++ b/src/ftee/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/fzenity/Makefile b/src/fzenity/Makefile index a17a9252f..6b93886f5 100644 --- a/src/fzenity/Makefile +++ b/src/fzenity/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/jailcheck/Makefile b/src/jailcheck/Makefile index 23cd9c1a9..029fd422b 100644 --- a/src/jailcheck/Makefile +++ b/src/jailcheck/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/lib/Makefile b/src/lib/Makefile index a7b093048..e359bba08 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/libpostexecseccomp/Makefile b/src/libpostexecseccomp/Makefile index dfd8eb318..874de098e 100644 --- a/src/libpostexecseccomp/Makefile +++ b/src/libpostexecseccomp/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/libtrace/Makefile b/src/libtrace/Makefile index 8b14a4335..d261828ea 100644 --- a/src/libtrace/Makefile +++ b/src/libtrace/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/libtracelog/Makefile b/src/libtracelog/Makefile index ac48264df..5e14a5dbe 100644 --- a/src/libtracelog/Makefile +++ b/src/libtracelog/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/man/Makefile b/src/man/Makefile index 197f76192..ce55ffd34 100644 --- a/src/man/Makefile +++ b/src/man/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/profstats/Makefile b/src/profstats/Makefile index b4cb1a6f7..936b575e1 100644 --- a/src/profstats/Makefile +++ b/src/profstats/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/src/zsh_completion/Makefile b/src/zsh_completion/Makefile index cc811ae99..fab53ca0a 100644 --- a/src/zsh_completion/Makefile +++ b/src/zsh_completion/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = ../.. -include $(ROOT)/config.mk diff --git a/test/Makefile b/test/Makefile index 08462c09b..02a628928 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,4 +1,6 @@ .SUFFIXES: +MAKEFLAGS += -r + ROOT = .. -include $(ROOT)/config.mk -- cgit v1.2.3-54-g00ecf