From 9f2d6b72b7995d3559552661534068c6dcbc33f2 Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Fri, 14 Aug 2026 00:11:50 +0300 Subject: [PATCH 1/5] build: Fix version.h race condition in parallel builds --- Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9ab0da8..c59c0b7 100644 --- a/Makefile +++ b/Makefile @@ -92,11 +92,10 @@ html_data.c html_data.h: $(HTML) tools/output/fileadder tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -d html -p html_data $(VERSION_HEADER): - @echo "#ifndef VERSION_H" > $(VERSION_HEADER) - @echo "#define VERSION_H" >> $(VERSION_HEADER) - @echo "#define VERSION_SW \"$(VERSION_EXTENSION)\"" >> $(VERSION_HEADER) - @echo "#define BUILD_DATE \"$(BUILD_DATE)\"" >> $(VERSION_HEADER) - @echo "#endif" >> $(VERSION_HEADER) + @printf '%s\n' "#ifndef VERSION_H" "#define VERSION_H" \ + "#define VERSION_SW \"$(VERSION_EXTENSION)\"" \ + "#define BUILD_DATE \"$(BUILD_DATE)\"" \ + "#endif" > $(VERSION_HEADER) httpd: html_data.h From 31024388ba247b26e056533ef6742f5e0cc0ba11 Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Fri, 14 Aug 2026 00:18:23 +0300 Subject: [PATCH 2/5] build: Fix tools dependency for parallel builds Replace file-path prerequisite tools/output/fileadder with order-only dependency on the tools PHONY target. Also add tools as order-only dependency to the final .bin target which invokes all of the tools. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c59c0b7..996a19d 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,7 @@ OBJS = ${SRCS:%.c=$(BUILDDIR)/%.rel} DEPS := ${SRCS:%.c=$(BUILDDIR)/%.d} HTML := $(shell find $(html) -name '*.js' -or -name '*.html' -or -name '*.svg') -html_data.c html_data.h: $(HTML) tools/output/fileadder +html_data.c html_data.h: $(HTML) | tools tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -d html -p html_data $(VERSION_HEADER): @@ -123,7 +123,7 @@ $(BUILDDIR)/rtlplayground.ihx: $(OBJS) $(BUILDDIR)/crtstart.rel $(BUILDDIR)/crc1 $(BUILDDIR)/rtlplayground.img: $(BUILDDIR)/rtlplayground.ihx objcopy --input-target=ihex -O binary $< $@ -$(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.img +$(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.img | tools if [ -e $@ ]; then rm $@; fi tools/output/imagebuilder -i $^ $@ tools/output/fileadder -a $(DEFAULT_CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@ From 0126b159bfa33dc080bba9bd74f59a7a05c0f35e Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Fri, 14 Aug 2026 00:24:25 +0300 Subject: [PATCH 3/5] build: Make create_build_dir PHONY and add order-only deps Mark create_build_dir as PHONY so directory creation is never skipped. Also add html_data.h as order-only prerequisite to the .c pattern rule, fixing another the race where httpd/httpd.c and httpd/page_impl.c are compiled before the generated header exists. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 996a19d..71f3d6e 100644 --- a/Makefile +++ b/Makefile @@ -110,10 +110,10 @@ distclean: -rm -f html_data.c html_data.h $(VERSION_HEADER) -rm -rf $(BUILDDIR) -$(BUILDDIR)/%.rel: %.c +$(BUILDDIR)/%.rel: %.c | create_build_dir html_data.h $(CC) -MMD $(CC_FLAGS) -o $@ -c $< -$(BUILDDIR)/%.rel: %.asm +$(BUILDDIR)/%.rel: %.asm | create_build_dir ${ASM} ${AFLAGS} -o $@ $< # mv -f $(addprefix $(basename $^), .lst .rel .sym) . @@ -132,7 +132,7 @@ $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.i tools/output/crc_calculator -u $@ ln -sf $(MACHINE)/rtlplayground-$(FILENAME_EXTENSION).bin output/rtlplayground.bin -.PHONY: clean all $(SUBDIRS) $(VERSION_HEADER) +.PHONY: clean all $(SUBDIRS) $(VERSION_HEADER) create_build_dir .PHONY: machine_check: From 65f8afb908cdbe5deb56378f13d904335841fb03 Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Fri, 14 Aug 2026 00:28:58 +0300 Subject: [PATCH 4/5] build: Remove undefined html variable HTML target references $(html) which was never defined, which causes find to run through the entire source tree. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 71f3d6e..e64dacf 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ SRCS += \ OBJS = ${SRCS:%.c=$(BUILDDIR)/%.rel} DEPS := ${SRCS:%.c=$(BUILDDIR)/%.d} -HTML := $(shell find $(html) -name '*.js' -or -name '*.html' -or -name '*.svg') +HTML := $(shell find html -name '*.js' -or -name '*.html' -or -name '*.svg') html_data.c html_data.h: $(HTML) | tools tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -d html -p html_data From 11be13fe5338a94b84af33d05b7fb4c0a7e398fc Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Fri, 14 Aug 2026 10:41:58 +0300 Subject: [PATCH 5/5] build: Fix double generation of html_data Make supports grouped target which runs once for all listed targets. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e64dacf..05cd7d3 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,7 @@ OBJS = ${SRCS:%.c=$(BUILDDIR)/%.rel} DEPS := ${SRCS:%.c=$(BUILDDIR)/%.d} HTML := $(shell find html -name '*.js' -or -name '*.html' -or -name '*.svg') -html_data.c html_data.h: $(HTML) | tools +html_data.c html_data.h &: $(HTML) | tools tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -d html -p html_data $(VERSION_HEADER):