From 10367d0cdbe5d18381dceeeef5efb7b13337aa77 Mon Sep 17 00:00:00 2001 From: feelfree69 Date: Sat, 2 May 2026 21:44:44 +0200 Subject: [PATCH 1/4] Use a revision- and MACHINE-dependent output-filename --- Makefile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7a8adc0..9f32660 100644 --- a/Makefile +++ b/Makefile @@ -16,11 +16,21 @@ BUILDDIR = output VERSION_HEADER := version.h ifeq ($(MACHINE),) + MACHINE:= $(shell grep "^\s*#define MACHINE_" machine.h | sed "s/^\s*#define MACHINE_//") else CC_FLAGS += -DMACHINE_$(MACHINE) endif -all: create_build_dir $(VERSION_HEADER) $(SUBDIRS) $(BUILDDIR)/rtlplayground.bin +GIT_VERSION := $(shell git rev-parse --short HEAD) +ifeq ($(shell git status --porcelain),) then +else + GIT_VERSION := $(GIT_VERSION)-dirty +endif + +VERSION_EXTENSION = v$(VERSION)-$(GIT_VERSION) +FILENAME_EXTENSION = $(VERSION_EXTENSION)-$(MACHINE) + +all: create_build_dir $(VERSION_HEADER) $(SUBDIRS) $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin create_build_dir: mkdir -p $(BUILDDIR) @@ -41,7 +51,7 @@ html_data.c html_data.h: $(HTML) tools/$(BUILDDIR)/fileadder $(VERSION_HEADER): @echo "#ifndef VERSION_H" > $(VERSION_HEADER) @echo "#define VERSION_H" >> $(VERSION_HEADER) - @echo "#define VERSION_SW \"v$(VERSION)-g$(shell git rev-parse --short HEAD)\"" >> $(VERSION_HEADER) + @echo "#define VERSION_SW \"$(VERSION_EXTENSION)\"" >> $(VERSION_HEADER) @echo "#define BUILD_DATE \"$(shell date +"%Y-%m-%d %H:%M:%S")\"" >> $(VERSION_HEADER) @echo "#endif" >> $(VERSION_HEADER) @@ -67,14 +77,14 @@ $(BUILDDIR)/rtlplayground.ihx: $(OBJS) $(BUILDDIR)/crtstart.rel $(BUILDDIR)/crc1 $(BUILDDIR)/rtlplayground.img: $(BUILDDIR)/rtlplayground.ihx objcopy --input-target=ihex -O binary $< $@ -$(BUILDDIR)/rtlplayground.bin: $(BUILDDIR)/rtlplayground.img +$(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.img if [ -e $@ ]; then rm $@; fi tools/$(BUILDDIR)/imagebuilder -i $^ $@ tools/$(BUILDDIR)/fileadder -a $(DEFAULT_CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@ tools/$(BUILDDIR)/fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@ tools/$(BUILDDIR)/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -d html -p html_data -b BANK1 $@ tools/$(BUILDDIR)/crc_calculator -u $@ - + ln -sf rtlplayground-$(FILENAME_EXTENSION).bin $(BUILDDIR)/rtlplayground.bin .PHONY: clean all $(SUBDIRS) $(VERSION_HEADER) From 241bcb273f8785b4f2b8a034cc5c892eb759bea0 Mon Sep 17 00:00:00 2001 From: feelfree69 Date: Sat, 2 May 2026 21:45:39 +0200 Subject: [PATCH 2/4] rename output of installer-Makefile to rtlplayground_oem_upgrade.bin --- installer/Makefile | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/installer/Makefile b/installer/Makefile index d4cdc1a..c451f49 100644 --- a/installer/Makefile +++ b/installer/Makefile @@ -6,37 +6,36 @@ CC_FLAGS = -mmcs51 ASM = sdas8051 AFLAGS= -plosgff -BUILDDIR = output/ +BUILDDIR = output SRCS = installer.c -OBJS = ${SRCS:%.c=$(BUILDDIR)%.rel} +OBJS = ${SRCS:%.c=$(BUILDDIR)/%.rel} -all: create_build_dir $(BUILDDIR)updatebuilder $(BUILDDIR)rtlplayground.bin +all: create_build_dir $(BUILDDIR)/updatebuilder $(BUILDDIR)/rtlplayground_oem_upgrade.bin create_build_dir: mkdir -p $(BUILDDIR) -$(BUILDDIR)updatebuilder: updatebuilder.c +$(BUILDDIR)/updatebuilder: updatebuilder.c gcc $^ -o $@ -$(BUILDDIR)installer.rel: installer.c +$(BUILDDIR)/installer.rel: installer.c $(CC) $(CC_FLAGS) --code-loc ${CODE_LOCATION} -o $@ -c $< -$(BUILDDIR)crtstart.rel: crtstart.asm +$(BUILDDIR)/crtstart.rel: crtstart.asm $(ASM) $(AFLAGS) -o $@ $< -$(BUILDDIR)%.rel: $(BUILDDIR)%.asm +$(BUILDDIR)/%.rel: $(BUILDDIR)/%.asm ${ASM} ${AFLAGS} -o $@ $^ -$(BUILDDIR)%.rel: %.c +$(BUILDDIR)/%.rel: %.c $(CC) $(CC_FLAGS) -o $@ -c $< -$(BUILDDIR)rtlinstaller.ihx: $(BUILDDIR)crtstart.rel $(OBJS) +$(BUILDDIR)/rtlinstaller.ihx: $(BUILDDIR)/crtstart.rel $(OBJS) $(CC) $(CC_FLAGS) -Wl-bHOME=${INSTALLER_ADDRESS} -Wl-r -o $@ $^ -$(BUILDDIR)rtlplayground.bin: $(BUILDDIR)rtlinstaller.ihx ../$(BUILDDIR)/rtlplayground.bin - cp ../$(BUILDDIR)/rtlplayground.bin $(BUILDDIR) - ./$(BUILDDIR)/updatebuilder -i $< $(BUILDDIR)rtlplayground.bin +$(BUILDDIR)/rtlplayground_oem_upgrade.bin: $(BUILDDIR)/rtlinstaller.ihx ../$(BUILDDIR)/rtlplayground.bin + ./$(BUILDDIR)/updatebuilder -i $< -o $(BUILDDIR)/rtlplayground_oem_upgrade.bin ../$(BUILDDIR)/rtlplayground.bin clean: rm -r $(BUILDDIR) From 502033590e8adced580f88a3fa51143c8add1a4a Mon Sep 17 00:00:00 2001 From: feelfree69 Date: Mon, 4 May 2026 06:55:11 +0200 Subject: [PATCH 3/4] untracked files don't mark a build as -dirty --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9f32660..3a15943 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ else endif GIT_VERSION := $(shell git rev-parse --short HEAD) -ifeq ($(shell git status --porcelain),) then +ifeq ($(shell git status --porcelain --untracked-files=no),) else GIT_VERSION := $(GIT_VERSION)-dirty endif From c6dc5cc21c44421ae0761ca5c0b8bd11edc5765e Mon Sep 17 00:00:00 2001 From: feelfree69 Date: Mon, 4 May 2026 07:11:44 +0200 Subject: [PATCH 4/4] Don't delete *.bin files on 'make clean' - 'make distclean' does this --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 3a15943..e729b89 100644 --- a/Makefile +++ b/Makefile @@ -61,6 +61,10 @@ $(SUBDIRS): $(MAKE) -C $@ clean: + -rm -f html_data.c html_data.h $(VERSION_HEADER) + -if [ -d $(BUILDDIR) ]; then find $(BUILDDIR) -type f ! -name "*.bin" -delete; fi + +distclean: -rm -f html_data.c html_data.h $(VERSION_HEADER) -rm -rf $(BUILDDIR)