msxbuild/lib/make/mb_build.mk
Willem Cazander 230331d9a5
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 0s
Cleanup of path variables.
2024-06-25 15:57:13 +02:00

59 lines
1.4 KiB
Makefile

MB_BUILD_FLAG_CPU ?= -mz80
MB_BUILD_FLAG_LD ?= --nostdinc
MB_BUILD_SDASM_FLAGS ?= -g -l -c -o
MB_BUILD_SDCC_FLAGS ?=
MB_BUILD_SDAR_FLAGS ?= -rc
MB_BUILD_SDCC_CMD ?= $(PATH_SDCC)/sdcc
MB_BUILD_SDASM_CMD ?= $(PATH_SDCC)/sdasz80
MB_BUILD_SDAR_CMD ?= $(PATH_SDCC)/sdar
MB_BUILD_SDOBJCOPY_CMD ?= $(PATH_SDCC)/sdobjcopy
# TODO: Add C + mixed support;
#$(MB_SDASM) -I$(MB_LIBASM_SRC)/include
#-l$(LIBASM_LINK)
define mb_unix2dos
unix2dos -n $(1) $(2)
endef
define mb_compile_asm
@echo === Compile module asm.
$(MB_BUILD_SDASM_CMD) $(MB_BUILD_SDASM_FLAGS) $(1) $(2)
endef
define mb_link_asm_lib
@echo === Link module asm lib.
$(MB_BUILD_SDAR_CMD) $(MB_BUILD_SDAR_FLAGS) $(1) $(2)
endef
define mb_link_asm
@echo === Link asm module at $(3)
$(MB_BUILD_SDCC_CMD) $(MB_BUILD_FLAG_CPU) $(MB_BUILD_SDCC_FLAGS) --no-std-crt0 --code-loc $(3) -o $(1) $(2)
endef
define mb_link_asm_0000
$(call mb_link_asm,$(1),$(2),0x0000)
endef
define mb_link_asm_0100
$(call mb_link_asm,$(1),$(2),0x0100)
endef
define mb_link_asm_1000
$(call mb_link_asm,$(1),$(2),0x1000)
endef
define mb_link_asm_4000
$(call mb_link_asm,$(1),$(2),0x4000)
endef
define mb_link_asm_8000
$(call mb_link_asm,$(1),$(2),0x8000)
endef
define mb_link_asm_C000
$(call mb_link_asm,$(1),$(2),0xC000)
endef
define mb_link_asm_dos
$(call mb_link_asm_0100,$(1),$(2))
endef
define mb_hex2bin
$(MB_BUILD_SDOBJCOPY_CMD) -I ihex --output-target=binary $(1) $(2)
endef