From 893f208557dc2d0c047355004d2f1d47d675f24a Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 21 Apr 2022 16:33:10 -0400 Subject: Makefile: Generate build/FLAGS.new with its own target --- Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a24fa72..753d4b3 100644 --- a/Makefile +++ b/Makefile @@ -242,10 +242,13 @@ build/tests/%.o: tests/%.c build/FLAGS | build/tests $(CC) $(ALL_CFLAGS) -c $< -o $@ # Save the full set of flags to rebuild everything when they change -build/FLAGS: FORCE | build - @echo $(CC) : $(ALL_CFLAGS) : $(ALL_LDFLAGS) : $(ALL_LDLIBS) >$@.tmp - @test -e $@ && cmp -s $@ $@.tmp && rm $@.tmp || mv $@.tmp $@ -.PHONY: FORCE +build/FLAGS.new: | build + @echo $(CC) : $(ALL_CFLAGS) : $(ALL_LDFLAGS) : $(ALL_LDLIBS) >$@ +.PHONY: build/FLAGS.new + +# Only update build/FLAGS if build/FLAGS.new is different +build/FLAGS: build/FLAGS.new + @test -e $@ && cmp -s $@ $< && rm $< || mv $< $@ # Make sure that "make release" builds everything, but "make release build/main.o" doesn't $(FLAG_GOALS): $(FLAG_PREREQS) -- cgit v1.2.3