msxbuild/lib/make/mb_build.mk

60 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

2021-07-04 00:12:48 +00:00
2024-06-24 11:36:26 +00:00
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
2021-07-04 00:12:48 +00:00
# TODO: Add C + mixed support;
#$(MB_SDASM) -I$(MB_LIBASM_SRC)/include
#-l$(LIBASM_LINK)
2021-07-06 01:52:02 +00:00
define mb_unix2dos
$(MB_BUILD_UNIX2DOS_CMD) -n $(1) $(2)
endef
2021-07-04 00:12:48 +00:00
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)
2021-07-06 21:30:45 +00:00
$(MB_BUILD_SDCC_CMD) $(MB_BUILD_FLAG_CPU) $(MB_BUILD_SDCC_FLAGS) --no-std-crt0 --code-loc $(3) -o $(1) $(2)
2021-07-04 00:12:48 +00:00
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
2024-06-24 11:36:26 +00:00
define mb_hex2bin
$(MB_BUILD_SDOBJCOPY_CMD) -I ihex --output-target=binary $(1) $(2)
2021-07-04 00:12:48 +00:00
endef