From 2465f9248e1e2737479fad5065d8310a860ce415 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Fri, 12 Feb 2021 05:25:23 -0300 Subject: makefiles: make all, clean and distclean PHONY Avoid a stat() call for each affected target and also potentially speed up parallel builds. From the GNU make manual[1]: > Phony targets are also useful in conjunction with recursive > invocations of make (see Recursive Use of make). In this situation > the makefile will often contain a variable which lists a number of > sub-directories to be built. [...] > The implicit rule search (see Implicit Rules) is skipped for .PHONY > targets. This is why declaring a target as .PHONY is good for > performance, even if you are not worried about the actual file > existing. Commands used to search, replace and cleanup: $ find -type f -name '*Makefile.in' -exec sed -i.bak \ -e 's/^all:/.PHONY: all\nall:/' \ -e 's/^clean:/.PHONY: clean\nclean:/' \ -e 's/^distclean:/.PHONY: distclean\ndistclean:/' '{}' + $ find -type f -name '*Makefile.in.bak' -exec rm '{}' + [1]: https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html --- src/jailtest/Makefile.in | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/jailtest') diff --git a/src/jailtest/Makefile.in b/src/jailtest/Makefile.in index 9c9c0c508..6306d24ec 100644 --- a/src/jailtest/Makefile.in +++ b/src/jailtest/Makefile.in @@ -1,3 +1,4 @@ +.PHONY: all all: jailtest include ../common.mk @@ -8,7 +9,9 @@ include ../common.mk jailtest: $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/pid.o $(LIBS) $(EXTRA_LDFLAGS) +.PHONY: clean clean:; rm -fr *.o jailtest *.gcov *.gcda *.gcno *.plist +.PHONY: distclean distclean: clean rm -fr Makefile -- cgit v1.2.3-54-g00ecf