summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-04-21 16:33:10 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-04-21 16:33:10 -0400
commit893f208557dc2d0c047355004d2f1d47d675f24a (patch)
treec2b722293e399da26a720e5444b37c6f4f48643f /Makefile
parent7793ddf23c4bc3ca3dcbe7c4e786426815f35b2b (diff)
downloadbfs-893f208557dc2d0c047355004d2f1d47d675f24a.tar.xz
Makefile: Generate build/FLAGS.new with its own target
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 7 insertions, 4 deletions
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)