Modify build system to place artefacts in separate out/ folder

This commit is contained in:
Keir Fraser
2022-03-13 15:27:12 +00:00
parent 7f5642abe0
commit 773d173717
29 changed files with 168 additions and 297 deletions
+3 -3
View File
@@ -25,7 +25,7 @@ jobs:
export VER=${{ steps.vars.outputs.sha_short }}
make -j4 dist VER=$VER
mkdir -p _cidist
rm flashfloppy-$VER.zip
mv out/flashfloppy-$VER .
rm flashfloppy-$VER/RELEASE_NOTES
git rev-parse HEAD >flashfloppy-$VER/COMMIT
zip -r flashfloppy-$VER.zip flashfloppy-$VER
@@ -34,8 +34,8 @@ jobs:
- name: Build debug dist
run: |
export VER=${{ steps.vars.outputs.sha_short }}-debug
env debug=y make -j4 dist VER=$VER
rm flashfloppy-$VER.zip
make -j4 dist VER=$VER level=debug
mv out/flashfloppy-$VER .
rm flashfloppy-$VER/RELEASE_NOTES
git rev-parse HEAD >flashfloppy-$VER/COMMIT
echo debug >>flashfloppy-$VER/COMMIT
+1
View File
@@ -29,6 +29,7 @@ jobs:
run: |
export VER=${{ steps.vars.outputs.ref }}
make -j4 dist VER=$VER
mv out/flashfloppy-$VER.zip .
- name: Create Release
id: create_release
+2 -12
View File
@@ -1,15 +1,5 @@
*.[oa]
.*.d
*~
*.ld
*.elf
*.bin
*.hex
*.orig
*.rej
*.rld
*.upd
*.dfu
/flashfloppy-*
/index.html
/HxC_Compat*
/out
/ext
+81 -88
View File
@@ -4,111 +4,104 @@ export FW_VER := 3.30
PROJ := FlashFloppy
VER := v$(FW_VER)
SUBDIRS += src bootloader bl_update io_test
PYTHON := python3
.PHONY: all upd clean flash start serial gotek
ifneq ($(RULES_MK),y)
.DEFAULT_GOAL := gotek
export ROOT := $(CURDIR)
all:
$(MAKE) -f $(ROOT)/Rules.mk all
.PHONY: FORCE
clean:
rm -f *.hex *.upd *.dfu *.html
$(MAKE) -f $(ROOT)/Rules.mk $@
.DEFAULT_GOAL := all
gotek: all
mv FF.dfu FF_Gotek-$(VER).dfu
mv FF.upd FF_Gotek-$(VER).upd
mv FF.hex FF_Gotek-$(VER).hex
mv BL.upd FF_Gotek-Bootloader-$(VER).upd
mv IOT.upd FF_Gotek-IO-Test-$(VER).upd
prod-%: FORCE
$(eval export mcu := $*)
$(MAKE) target target=bootloader level=prod
$(MAKE) target target=floppy level=prod
$(MAKE) target target=quickdisk level=prod
$(MAKE) target target=bl_update level=prod
$(MAKE) target target=io_test level=prod
debug-%: FORCE
$(eval export mcu := $*)
$(MAKE) target target=bootloader level=debug
$(MAKE) target target=floppy level=debug
$(MAKE) target target=quickdisk level=debug
$(MAKE) target target=bl_update level=debug
$(MAKE) target target=io_test level=debug
logfile-%: FORCE
$(eval export mcu := $*)
$(MAKE) target target=bootloader level=logfile
$(MAKE) target target=floppy level=logfile
$(MAKE) target target=quickdisk level=logfile
all-%: FORCE prod-% debug-% logfile-% ;
all: FORCE all-stm32f105 all-at32f435 ;
clean: FORCE
rm -rf out
mrproper: FORCE clean
rm -rf ext
out: FORCE
mkdir -p out/$(mcu)/$(level)/$(target)
rsync -a --include="*/" --exclude="*" src/ out/$(mcu)/$(level)/$(target)
target: FORCE out
$(MAKE) -C out/$(mcu)/$(level)/$(target) -f $(ROOT)/Rules.mk target.bin target.hex target.upd target.dfu $(mcu)=y $(level)=y $(target)=y
HXC_FF_URL := https://www.github.com/keirf/flashfloppy-hxc-file-selector
HXC_FF_URL := $(HXC_FF_URL)/releases/download
HXC_FF_VER := v9-FF
dist:
rm -rf flashfloppy-*
mkdir -p flashfloppy-$(VER)/alt/bootloader
mkdir -p flashfloppy-$(VER)/alt/logfile
mkdir -p flashfloppy-$(VER)/alt/io-test
mkdir -p flashfloppy-$(VER)/alt/quickdisk/logfile
$(MAKE) clean
$(MAKE) mcu=stm32f105 gotek
cp -a FF_Gotek-$(VER).dfu flashfloppy-$(VER)/
cp -a FF_Gotek-$(VER).upd flashfloppy-$(VER)/
cp -a FF_Gotek-$(VER).hex flashfloppy-$(VER)/
cp -a FF_Gotek-Bootloader-$(VER).upd flashfloppy-$(VER)/alt/bootloader/
cp -a FF_Gotek-IO-Test-$(VER).upd flashfloppy-$(VER)/alt/io-test/
$(MAKE) clean
$(MAKE) mcu=stm32f105 debug=n logfile=y -f $(ROOT)/Rules.mk upd
mv FF.upd flashfloppy-$(VER)/alt/logfile/FF_Gotek-Logfile-$(VER).upd
$(MAKE) clean
$(MAKE) mcu=stm32f105 quickdisk=y -f $(ROOT)/Rules.mk upd
mv FF.upd flashfloppy-$(VER)/alt/quickdisk/FF_Gotek-QuickDisk-$(VER).upd
$(MAKE) clean
$(MAKE) mcu=stm32f105 quickdisk=y debug=n logfile=y -f $(ROOT)/Rules.mk upd
mv FF.upd flashfloppy-$(VER)/alt/quickdisk/logfile/FF_Gotek-QuickDisk-Logfile-$(VER).upd
python3 scripts/mk_qd.py --window=6.5 flashfloppy-$(VER)/alt/quickdisk/Blank.qd
$(MAKE) clean
cp -a COPYING flashfloppy-$(VER)/
cp -a README.md flashfloppy-$(VER)/
cp -a RELEASE_NOTES flashfloppy-$(VER)/
cp -a examples flashfloppy-$(VER)/
[ -e HxC_Compat_Mode-$(HXC_FF_VER).zip ] || \
wget -q --show-progress $(HXC_FF_URL)/$(HXC_FF_VER)/HxC_Compat_Mode-$(HXC_FF_VER).zip
rm -rf index.html
unzip -q HxC_Compat_Mode-$(HXC_FF_VER).zip
mv HxC_Compat_Mode flashfloppy-$(VER)
mkdir -p flashfloppy-$(VER)/scripts
cp -a scripts/edsk* flashfloppy-$(VER)/scripts/
cp -a scripts/mk_hfe.py flashfloppy-$(VER)/scripts/
zip -r flashfloppy-$(VER).zip flashfloppy-$(VER)
mrproper: clean
rm -rf flashfloppy-*
rm -rf HxC_Compat_Mode-$(HXC_FF_VER).zip
else
upd:
$(MAKE) -C src -f $(ROOT)/Rules.mk $(PROJ).elf $(PROJ).bin $(PROJ).hex
$(PYTHON) ./scripts/mk_update.py src/$(PROJ).bin FF.upd
all:
$(MAKE) -C src -f $(ROOT)/Rules.mk $(PROJ).elf $(PROJ).bin $(PROJ).hex
$(MAKE) bootloader=y logfile=n -C bootloader \
-f $(ROOT)/Rules.mk \
Bootloader.elf Bootloader.bin Bootloader.hex
$(MAKE) logfile=n -C bl_update -f $(ROOT)/Rules.mk \
BL_Update.elf BL_Update.bin BL_Update.hex
$(MAKE) logfile=n -C io_test -f $(ROOT)/Rules.mk \
IO_Test.elf IO_Test.bin IO_Test.hex
srec_cat bootloader/Bootloader.hex -Intel src/$(PROJ).hex -Intel \
-o FF.hex -Intel
$(PYTHON) ./scripts/mk_update.py src/$(PROJ).bin FF.upd
$(PYTHON) ./scripts/mk_update.py bl_update/BL_Update.bin BL.upd
$(PYTHON) ./scripts/mk_update.py io_test/IO_Test.bin IOT.upd
$(PYTHON) ./scripts/dfu-convert.py -i FF.hex FF.dfu
endif
dist: level := prod
dist: FORCE all
rm -rf out/flashfloppy-*
$(eval t := out/flashfloppy-$(VER))
mkdir -p $(t)/alt/bootloader
mkdir -p $(t)/alt/logfile
mkdir -p $(t)/alt/io-test
mkdir -p $(t)/alt/quickdisk/logfile
$(eval s := out/$(mcu)/$(level)/floppy)
cp -a $(s)/target.dfu $(t)/FF_Gotek-$(VER).dfu
cp -a $(s)/target.upd $(t)/FF_Gotek-$(VER).upd
cp -a $(s)/target.hex $(t)/FF_Gotek-$(VER).hex
$(eval s := out/$(mcu)/$(level)/bootloader)
cp -a $(s)/target.upd $(t)/alt/bootloader/FF_Gotek-Bootloader-$(VER).upd
$(eval s := out/$(mcu)/$(level)/io_test)
cp -a $(s)/target.upd $(t)/alt/io-test/FF_Gotek-IO-Test-$(VER).upd
$(eval s := out/$(mcu)/logfile/floppy)
cp -a $(s)/target.upd $(t)/alt/logfile/FF_Gotek-Logfile-$(VER).upd
$(eval s := out/$(mcu)/$(level)/quickdisk)
cp -a $(s)/target.upd $(t)/alt/quickdisk/FF_Gotek-QuickDisk-$(VER).upd
$(eval s := out/$(mcu)/logfile/quickdisk)
cp -a $(s)/target.upd $(t)/alt/quickdisk/logfile/FF_Gotek-QuickDisk-Logfile-$(VER).upd
$(PYTHON) scripts/mk_qd.py --window=6.5 $(t)/alt/quickdisk/Blank.qd
cp -a COPYING $(t)/
cp -a README.md $(t)/
cp -a RELEASE_NOTES $(t)/
cp -a examples $(t)/
[ -e ext/HxC_Compat_Mode-$(HXC_FF_VER).zip ] || \
(mkdir -p ext ; cd ext ; wget -q --show-progress $(HXC_FF_URL)/$(HXC_FF_VER)/HxC_Compat_Mode-$(HXC_FF_VER).zip ; rm -rf index.html)
(cd $(t) && unzip -q ../../ext/HxC_Compat_Mode-$(HXC_FF_VER).zip)
mkdir -p $(t)/scripts
cp -a scripts/edsk* $(t)/scripts/
cp -a scripts/mk_hfe.py $(t)/scripts/
(cd out && zip -r flashfloppy-$(VER).zip flashfloppy-$(VER))
BAUD=115200
DEV=/dev/ttyUSB0
STM32FLASH=stm32flash
ocd: gotek
python3 scripts/openocd/flash.py `pwd`/FF_Gotek-$(VER).hex
ocd: FORCE all
$(PYTHON) scripts/openocd/flash.py $(target)/target.hex
flash: gotek
sudo $(STM32FLASH) -b $(BAUD) -w FF_Gotek-$(VER).hex $(DEV)
flash: FORCE all
sudo $(STM32FLASH) -b $(BAUD) -w $(target)/target.hex $(DEV)
start:
start: FORCE
sudo $(STM32FLASH) -b $(BAUD) -g 0 $(DEV)
serial:
serial: FORCE
sudo miniterm.py $(DEV) 3000000
+21 -28
View File
@@ -19,34 +19,31 @@ FLAGS += -Wno-unused-value -ffunction-sections
## STM32F105
ifeq ($(mcu),stm32f105)
FLAGS += -mcpu=cortex-m3 -DSTM32F105=1 -DMCU=1
stm32f105=y
ifeq ($(bootloader),y)
# Debug bootloader doesn't fit in 32kB
override debug=n
override logfile=n
endif
## AT32F435
else ifeq ($(mcu),at32f435)
FLAGS += -mcpu=cortex-m4 -DAT32F435=4 -DMCU=4
at32f435=y
endif
ifneq ($(debug),y)
FLAGS += -DNDEBUG
endif
# Following options are mutually exclusive
ifeq ($(bootloader),y)
FLAGS += -DBOOTLOADER=1
else ifeq ($(logfile),y)
endif
ifeq ($(logfile),y)
FLAGS += -DLOGFILE=1
endif
ifeq ($(quickdisk),y)
FLAGS += -DQUICKDISK=1
floppy=n
else
floppy=y
endif
FLAGS += -MMD -MF .$(@F).d
@@ -58,12 +55,11 @@ CFLAGS += $(CFLAGS-y) $(FLAGS) -include decls.h
AFLAGS += $(AFLAGS-y) $(FLAGS) -D__ASSEMBLY__
LDFLAGS += $(LDFLAGS-y) $(FLAGS) -Wl,--gc-sections
RULES_MK := y
include Makefile
RPATH := $(shell $(PYTHON) $(ROOT)/scripts/rpath.py $(ROOT) $(CURDIR))
include $(RPATH)/Makefile
SUBDIRS += $(SUBDIRS-y)
OBJS += $(OBJS-y) $(patsubst %,%/build.o,$(SUBDIRS))
OBJS += $(OBJS-y) $(OBJS-^n) $(patsubst %,%/build.o,$(SUBDIRS))
# Force execution of pattern rules (for which PHONY cannot be directly used).
.PHONY: FORCE
@@ -79,19 +75,11 @@ build.o: $(OBJS)
%/build.o: FORCE
$(MAKE) -f $(ROOT)/Rules.mk -C $* build.o
%.o: %.c Makefile
@echo CC $@
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.S Makefile
@echo AS $@
$(CC) $(AFLAGS) -c $< -o $@
%.ld: %.ld.S Makefile
%.ld: $(RPATH)/%.ld.S $(RPATH)/Makefile
@echo CPP $@
$(CC) -P -E $(AFLAGS) $< -o $@
%.elf: $(OBJS) %.ld Makefile
%.elf: $(OBJS) %.ld $(RPATH)/Makefile
@echo LD $@
$(CC) $(LDFLAGS) -T$(*F).ld $(OBJS) -o $@
chmod a-x $@
@@ -100,23 +88,28 @@ build.o: $(OBJS)
@echo OBJCOPY $@
$(OBJCOPY) -O ihex $< $@
chmod a-x $@
ifneq ($(bootloader),y)
srec_cat ../bootloader/target.hex -Intel $@ -Intel -o $@ -Intel
endif
%.bin: %.elf
@echo OBJCOPY $@
$(OBJCOPY) -O binary $< $@
chmod a-x $@
%.o: $(RPATH)/%.c Makefile
%.upd: %.bin
@echo OBJCOPY $@
$(PYTHON) $(ROOT)/scripts/mk_update.py $< $@
%.dfu: %.hex
$(PYTHON) $(ROOT)/scripts/dfu-convert.py -i $< $@
%.o: $(RPATH)/%.c $(RPATH)/Makefile
@echo CC $@
$(CC) $(CFLAGS) -c $< -o $@
%.o: $(RPATH)/%.S Makefile
%.o: $(RPATH)/%.S $(RPATH)/Makefile
@echo AS $@
$(CC) $(AFLAGS) -c $< -o $@
clean:: $(addprefix _clean_,$(SUBDIRS) $(SUBDIRS-n) $(SUBDIRS-))
rm -f *.orig *.rej *~ *.o *.elf *.hex *.bin *.ld $(DEPS)
_clean_%: FORCE
$(MAKE) -f $(ROOT)/Rules.mk -C $* clean
-include $(DEPS)
-1
View File
@@ -1 +0,0 @@
#include "../src/FlashFloppy.ld.S"
-22
View File
@@ -1,22 +0,0 @@
RPATH = ../src
OBJS += bl_update.o
OBJS += fpec_$(mcu).o
OBJS += build_info.o
OBJS += crc.o
OBJS += vectors.o
OBJS += string.o
OBJS += cortex.o mcu_$(mcu).o
OBJS += time.o
OBJS += timer.o
OBJS += util.o
OBJS += flash_cfg.o
OBJS-$(debug) += console.o
SUBDIRS += display
SUBDIRS += gotek
.PHONY: $(RPATH)/build_info.c
build_info.o: CFLAGS += -DFW_VER="\"$(FW_VER)\""
-6
View File
@@ -1,6 +0,0 @@
RPATH = ../../src/display
OBJS += display.o
OBJS += lcd_$(mcu).o
OBJS += oled_font_6x13.o
OBJS += led_7seg.o
-3
View File
@@ -1,3 +0,0 @@
RPATH = ../../src/gotek
OBJS += board.o
-17
View File
@@ -1,17 +0,0 @@
#if MCU == STM32F105
#define FLASH_BASE 0x08000000
#define FLASH_LEN 32K
#elif MCU == AT32F435
#define FLASH_BASE 0x08000000
#define FLASH_LEN 48K
#endif
#define RAM_BASE 0x20000000
#define RAM_LEN 16K
#include "../scripts/stm32.ld.S"
-29
View File
@@ -1,29 +0,0 @@
RPATH = ../src
OBJS += fw_update.o
OBJS += fpec_$(mcu).o
OBJS += build_info.o
OBJS += cancellation.o
OBJS += crc.o
OBJS += vectors.o
OBJS += fs.o
OBJS += sd_spi.o
OBJS += spi.o
OBJS += string.o
OBJS += cortex.o mcu_$(mcu).o
OBJS += time.o
OBJS += timer.o
OBJS += util.o
OBJS += volume.o
OBJS += flash_cfg.o
OBJS-$(debug) += console.o
SUBDIRS += display
SUBDIRS += fatfs
SUBDIRS += gotek
SUBDIRS += usb
.PHONY: $(RPATH)/build_info.c
build_info.o: CFLAGS += -DFW_VER="\"$(FW_VER)\""
-6
View File
@@ -1,6 +0,0 @@
RPATH = ../../src/display
OBJS += display.o
OBJS += lcd_$(mcu).o
OBJS += oled_font_6x13.o
OBJS += led_7seg.o
-4
View File
@@ -1,4 +0,0 @@
RPATH = ../../src/fatfs
OBJS += ff.o
OBJS += ffunicode.o
-3
View File
@@ -1,3 +0,0 @@
RPATH = ../../src/gotek
OBJS += board.o
-8
View File
@@ -1,8 +0,0 @@
RPATH = ../../src/usb
OBJS += usb_bsp.o
OBJS += usbh_msc_fatfs.o
SUBDIRS += stm32_usbh_msc
usb%.o: CFLAGS += -I$(ROOT)/src/usb/stm32_usbh_msc/inc/ -include usbh_conf.h
-14
View File
@@ -1,14 +0,0 @@
RPATH = ../../../src/usb/stm32_usbh_msc
OBJS += usb_core.o
OBJS += usb_hcd.o
OBJS += usb_hcd_int.o
OBJS += usbh_core.o
OBJS += usbh_hcs.o
OBJS += usbh_ioreq.o
OBJS += usbh_msc_bot.o
OBJS += usbh_msc_core.o
OBJS += usbh_msc_scsi.o
OBJS += usbh_stdreq.o
CFLAGS += -I$(ROOT)/src/usb/stm32_usbh_msc/inc/ -include usbh_conf.h
-1
View File
@@ -1 +0,0 @@
#include "../src/FlashFloppy.ld.S"
-21
View File
@@ -1,21 +0,0 @@
RPATH = ../src
OBJS += io_test.o
OBJS += fpec_$(mcu).o
OBJS += build_info.o
OBJS += crc.o
OBJS += vectors.o
OBJS += string.o
OBJS += cortex.o mcu_$(mcu).o
OBJS += time.o
OBJS += timer.o
OBJS += util.o
OBJS += flash_cfg.o
OBJS-$(debug) += console.o
SUBDIRS += display
SUBDIRS += gotek
.PHONY: $(RPATH)/build_info.c
build_info.o: CFLAGS += -DFW_VER="\"$(FW_VER)\""
-6
View File
@@ -1,6 +0,0 @@
RPATH = ../../src/display
OBJS += display.o
OBJS += lcd_$(mcu).o
OBJS += oled_font_6x13.o
OBJS += led_7seg.o
-4
View File
@@ -1,4 +0,0 @@
RPATH = ../../src/gotek
OBJS += board.o
OBJS += speaker.o

Some files were not shown because too many files have changed in this diff Show More