msxbuild/lib/make/ᐅᖓᕙᕆᐊᖅᓯᓂᖅ/mb_sdcc.mk
Willem Cazander b78d3e5c1f
All checks were successful
Run test asserts / Test-Asserts (push) Successful in -12s
Limited china whitespace to one folder.
2024-07-13 13:18:49 +02:00

100 lines
3.7 KiB
Makefile
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

MB_SDCC_PATH ?=
$(call mb_make_call,mb_doc_variable,MB_SDCC_PATH,"Optional path where SDCC binaries are located.")
MB_SDCC_FLAG_CPU ?= -mz80
$(call mb_make_call,mb_doc_variable_deep,MB_SDCC_FLAG_CPU,"The SDCC cpu target option.")
MB_SDCC_FLAG_LD ?= --nostdinc
$(call mb_make_call,mb_doc_variable_deep,MB_SDCC_FLAG_LD,"The SDCC linker option.")
MB_SDCC_ASZ80_FLAGS ?= -g -l -c -o
$(call mb_make_call,mb_doc_variable_deep,MB_SDCC_ASZ80_FLAGS,"The SDCC z80 asm compiler flags.")
MB_SDCC_CC_FLAGS ?=
$(call mb_make_call,mb_doc_variable_deep,MB_SDCC_CC_FLAGS,"The SDCC C compiler flags.")
MB_SDCC_AR_FLAGS ?= -rc
$(call mb_make_call,mb_doc_variable_deep,MB_SDCC_AR_FLAGS,"The SDCC module archive flags.")
# TODO: Add C + mixed support;
#$(MB_SDASM) -I$(MB_LIBASM_SRC)/include
#-l$(LIBASM_LINK)
define _mb_sdcc_path
$(MB_   )$(if $(MB_SDCC_PATH),$(MB_SDCC_PATH)/$(1),$(1))
endef
define mb_sdcc_compile_asm
$(MB_   )$(call mb_make_call,mb_os_echo_command,$(MB_I18N_SDCC_COMPILE) $(2) - ASM)
$(MB_   )$(call mb_make_call,_mb_sdcc_path,sdasz80) $(MB_SDCC_ASZ80_FLAGS) $(2) $(1)
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_compile_asm,"Compiles asm source code.","<in> <out>")
define mb_sdcc_arlib_asm
$(MB_   )$(call mb_make_call,mb_os_echo_command,$(MB_I18N_SDCC_ARLIB) $(2))
$(MB_   )$(call mb_make_call,_mb_sdcc_path,sdar) $(MB_SDCC_AR_FLAGS) $(1) $(2)
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_arlib_asm,"Link asm lib module.","<in> <out>")
define mb_sdcc_link_asm
$(MB_   )$(call mb_make_call,mb_os_echo_command,$(MB_I18N_SDCC_LINK) $(2) - ASM @ $(3))
$(MB_   )$(call mb_make_call,_mb_sdcc_path,sdcc) $(MB_SDCC_FLAG_CPU) $(MB_SDCC_CC_FLAGS) --no-std-crt0 --code-loc $(3) -o $(2) $(1)
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_link_asm,"Links asm to custom code location.","<in> <out> <code-loc>")
define mb_sdcc_link_asm_0000
$(MB_   )$(call mb_make_call,mb_sdcc_link_asm,$(1),$(2),0x0000)
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_link_asm_0000,"Links asm to 0x0000.","<in> <out>")
define mb_sdcc_link_asm_0100
$(MB_   )$(call mb_make_call,mb_sdcc_link_asm,$(1),$(2),0x0100)
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_link_asm_0100,"Links asm to 0x0100.","<in> <out>")
define mb_sdcc_link_asm_1000
$(MB_   )$(call mb_make_call,mb_sdcc_link_asm,$(1),$(2),0x1000)
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_link_asm_1000,"Links asm to 0x1000.","<in> <out>")
define mb_sdcc_link_asm_4000
$(MB_   )$(call mb_make_call,mb_sdcc_link_asm,$(1),$(2),0x4000)
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_link_asm_4000,"Links asm to 0x4000.","<in> <out>")
define mb_sdcc_link_asm_8000
$(MB_   )$(call mb_make_call,mb_sdcc_link_asm,$(1),$(2),0x8000)
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_link_asm_8000,"Links asm to 0x8000.","<in> <out>")
define mb_sdcc_link_asm_C000
$(MB_   )$(call mb_make_call,mb_sdcc_link_asm,$(1),$(2),0xC000)
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_link_asm_C000,"Links asm to 0xC000.","<in> <out>")
define mb_sdcc_link_asm_bdos
$(MB_   )$(call mb_make_call,mb_sdcc_link_asm_0100,$(1),$(2))
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_link_asm_bdos,"Links asm to BDOS.","<in> <out>")
define mb_sdcc_objcopy
$(MB_   )$(call mb_make_call,mb_os_echo_command,$(MB_I18N_SDCC_OBJCOPY) $(2))
$(MB_   )$(call mb_make_call,_mb_sdcc_path,sdobjcopy) -I ihex --output-target$(MB_MAKE_EQUALS)binary $(1) $(2)
endef
$(call mb_make_call,mb_doc_function,mb_sdcc_objcopy,"Converts an hex file to binary.","<in> <out>")