diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2022-04-21 16:33:10 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2022-04-21 16:33:10 -0400 |
commit | 893f208557dc2d0c047355004d2f1d47d675f24a (patch) | |
tree | c2b722293e399da26a720e5444b37c6f4f48643f | |
parent | 7793ddf23c4bc3ca3dcbe7c4e786426815f35b2b (diff) | |
download | bfs-893f208557dc2d0c047355004d2f1d47d675f24a.tar.xz |
Makefile: Generate build/FLAGS.new with its own target
-rw-r--r-- | Makefile | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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) |