diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 2110be86..2729cf20 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -26,7 +26,8 @@ jobs: run: | export TZ='America/Los_Angeles' sudo apt-get install srecord - make distlog + make transpile-c-code + make distlog --trace rm -rf .git* - name: List Output @@ -58,7 +59,8 @@ jobs: run: | export TZ='America/Los_Angeles' brew install srecord - make distlog + make transpile-c-code + make distlog --trace rm -rf .git* - name: List Output diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e48d5225..e418df06 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,8 @@ jobs: export TZ='America/Los_Angeles' sudo apt-get install libncurses-dev sudo apt-get install srecord - make distlog + make transpile-c-code + make distlog --trace rm -rf .git* - name: Create Package Archive diff --git a/Makefile b/Makefile index 87fb9244..91b8f819 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: tools source clean clobber diff dist .ONESHELL: -.SHELLFLAGS = -cex +.SHELLFLAGS = -ce all: tools source @@ -22,6 +22,11 @@ clobber: clean diff: $(MAKE) --directory Source diff +# Convert c code to assembly code +transpile-c-code: + @cd Source/HBIOS/ch376-native + $(MAKE) -j + dist: $(MAKE) ROM_PLATFORM=dist $(MAKE) --directory Tools clean diff --git a/Source/HBIOS/ch376-native/Makefile b/Source/HBIOS/ch376-native/Makefile index 6f25245a..8c6e40a0 100644 --- a/Source/HBIOS/ch376-native/Makefile +++ b/Source/HBIOS/ch376-native/Makefile @@ -11,10 +11,15 @@ LIBS := -I./$(SRC)base-drv/ ZCCFLAGS := +z80 -vn -startup=0 -clib=sdcc_iy -compiler=sdcc -Cs--std=c23 -Cs--Werror $(ZCCRELFLAGS) $(LIBS) ZCC_PATH := $(shell command -v zcc) +DOCKER_PATH := $(shell command -v docker) ZCC := $(shell command -v zcc >/dev/null 2>&1 && echo zcc || echo 'docker run -w /host/${PWD} -v /:/host/ -u $(shell id -u ${USER}):$(shell id -g ${USER}) -t z88dk/z88dk zcc') ifeq ($(ZCC_PATH),) - $(info ZCC is set to use Docker to run zcc) + ifeq ($(DOCKER_PATH),) + .DEFAULT_GOAL := skip + else + $(info ZCC is set to use Docker to run zcc) + endif else $(info ZCC is set to $(ZCC_PATH)) endif @@ -23,6 +28,10 @@ ASSDIR := ./ all: $(ASSDIR)base-drv.s $(ASSDIR)scsi-drv.s $(ASSDIR)ufi-drv.s $(ASSDIR)keyboard.s +skip: + @echo "Unable to compile ch376 native to assembly. Install docker or z88dk." + exit 0 + clean: @rm -rf base-drv/*.s rm -rf base-drv/*.asm @@ -43,7 +52,8 @@ $(ASSDIR)%.c.s: $(ASSDIR)%.c.asm ${SRC}convert-for-uz80as.sh $< $@ define compile - @mkdir -p $(dir $@) + @set -e + mkdir -p $(dir $@) $(ZCC) $(ZCCFLAGS) --c-code-in-asm --assemble-only $< -o $@ echo "Compiled $(notdir $@) from $(notdir $<)" endef