Build: rebuild everything when VERSION changes

The version is passed in as a compiler flag, and make doesn't notice a
changed flag. After the bump to 1.1.0, only files whose source had changed
were recompiled, so main.c and log.c still logged 1.0.0 and the app could
show it. Objects now depend on VERSION. Builds from a clean checkout, as CI
does, were never affected.
This commit is contained in:
MoHadiShibli committed 2026-10-06 01:05:33 +03:00
1 parent 627e2cec63
commit 6d9949f88b
2 files changed
+6 -3

No files matched your search

+3 -1
View File
@@ -46,7 +46,9 @@ all: $(ELF)
$(OBJDIR) build:
mkdir -p $@
$(OBJDIR)/%.o: src/%.c | $(OBJDIR)
# VERSION is compiled into the objects, and make doesn't notice a changed flag,
# so a new version has to rebuild them.
$(OBJDIR)/%.o: src/%.c VERSION | $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
build/client.c: client/index.html tools/embed_client.py | build
+3 -2
View File
@@ -18,9 +18,10 @@ FONTS := ../vendor/roboto/Roboto-Light.ttf ../vendor/roboto/Roboto-Regular.ttf
all: package
$(OUT):
mkdir -p $@
$(OUT)/%.o: %.c | $(OUT)
# The version is compiled in; a new one must rebuild everything that shows it.
$(OUT)/%.o: %.c ../VERSION | $(OUT)
$(CC) $(CFLAGS) -std=gnu11 -c $< -o $@
$(OUT)/main.o: main.cpp | $(OUT)
$(OUT)/main.o: main.cpp ../VERSION | $(OUT)
$(CXX) $(CFLAGS) -std=c++17 -fno-exceptions -fno-rtti -c $< -o $@
$(OUT)/qrcodegen.o: ../vendor/qrcodegen/qrcodegen.c | $(OUT)
$(CC) $(CFLAGS) -std=gnu11 -c $< -o $@