msxbuild/lib/make/mb_build.mk
Willem Cazander 41e310b5cd
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 3s
Removed hex2bin dep
2024-06-24 13:36:26 +02:00

60 lines
1.5 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
MB_BUILD_UNIX2DOS_CMD ?= $(PATH_UNIX2DOS)/unix2dos
# TODO: Add C + mixed support;
#$(MB_SDASM) -I$(MB_LIBASM_SRC)/include
#-l$(LIBASM_LINK)
define mb_unix2dos
$(MB_BUILD_UNIX2DOS_CMD) -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