diff --git a/.gitignore b/.gitignore index 83dc8a0..2a0dc31 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ syntax: glob # Project ignores bin bin/** -build/make/local.inc.mk +Makelocal.mk # IDE ignores .project diff --git a/Makefile b/Makefile index f659e7d..60a698e 100644 --- a/Makefile +++ b/Makefile @@ -1,56 +1,28 @@ # -# Single top level makefile +# Top level makefile for tara # -rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) -MODULES := $(call rwildcard, src, */0module.mk) -MODULES_LIB := $(call rwildcard, src, */0module.lib.mk) - --include build/make/local.inc.mk -include build/make/env.inc.mk -include $(MODULES_LIB) -include $(MODULES) - +rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) +INC_MODS := $(call rwildcard, src, */0module.mk) +INC_LIBS := $(call rwildcard, src, */0module.lib.mk) +PATH_BIN := bin +PATH_SRC := src +BUILD_HELP := "Use one of the following build targets;\\n\\t* clean" +MB_OPENMSX_EXT := -ext video9000 .PHONY: all all: - @echo TODO: All is build. + @echo $(BUILD_HELP) -.PHONY: test -test: - @echo TODO: Testing +.PHONY: help +help: + @echo $(BUILD_HELP) .PHONY: clean clean: - @echo === Cleaning - @test $(PATH_BIN) && $(RM) -r $(PATH_BIN); + $(call mb_clean,$(PATH_BIN)) - -define mod_mkdir - @echo === Create module build folder. - $(MKDIR) $(1) -endef - -define mod_compile_asm - @echo === Compile module asm. - $(SDASM) $(SDASM_FLAGS) -I$(LIBASM_SRC)/include $(1) $(2) -endef - -define mod_link_asm_lib - @echo === Link module asm lib. - $(SDAR) $(SDAR_FLAGS) $(1) $(2) -endef - -define mod_link_asm_dos - @echo === Link module asm dos. - $(SDCC) $(SDCC_FLAG_CPU) --no-std-crt0 --code-loc 0x0100 -o $(1) $(2) -endef -#-l$(LIBASM_LINK) - -define mod_hex2com - @echo === Convert to binary - cd $(dir $(1)) && $(H2B) -e com $(notdir $(1)); - @sha1sum $(2); - @echo === Done $(notdir $(2)) -endef - \ No newline at end of file +-include Makelocal.mk +include $(MB_PATH_MSXBUILD)/lib/make/msxbuild.mk +include $(INC_LIBS) +include $(INC_MODS) diff --git a/Makelocal.mk.tpl b/Makelocal.mk.tpl new file mode 100644 index 0000000..0da8c72 --- /dev/null +++ b/Makelocal.mk.tpl @@ -0,0 +1,9 @@ +# Local included makefile fragment. +# Save this file without tpl suffix and custumize it. +# +# Change to local installations if needed; + +#MB_PATH_SDCC ?= /usr/bin +#MB_PATH_HEX2BIN ?= /usr/bin +#MB_PATH_OPENMSX ?= /opt/openMSX/bin/ +#MB_PATH_MSXBUILD ?= /opt/msxbuild diff --git a/build/make/env.inc.mk b/build/make/env.inc.mk deleted file mode 100644 index bfb6738..0000000 --- a/build/make/env.inc.mk +++ /dev/null @@ -1,36 +0,0 @@ - -# Fill in all paths -PATH_SRC ?= src -PATH_BIN ?= bin -PATH_HEX2BIN ?= /usr/bin -PATH_SDCC ?= /usr/bin -PATH_CURRENT ?= $(dir $(lastword $(MAKEFILE_LIST))) - -# Build tools -H2B ?= $(PATH_HEX2BIN)/hex2bin -SDCC ?= $(PATH_SDCC)/sdcc -SDASM ?= $(PATH_SDCC)/sdasz80 -SDAR ?= $(PATH_SDCC)/sdar - -SDCC_FLAG_CPU ?= -mz80 -SDCC_FLAG_LD ?= --nostdinc -SDASM_FLAGS ?= -g -l -c -o -SDAR_FLAGS ?= -rc - -# OS cmds -ifeq ($(OS),Windows_NT) - RM = del /F /Q - RMDIR = -RMDIR /S /Q - MKDIR = -mkdir - ERRIGNORE = 2>NUL || true - SEP=\\ -else - RM = rm -rf - RMDIR = rm -rf - MKDIR = mkdir -p - ERRIGNORE = 2>/dev/null - SEP=/ -endif - -# Remove space after separator -PSEP = $(strip $(SEP)) diff --git a/build/make/local.inc.mk-template b/build/make/local.inc.mk-template deleted file mode 100644 index 95ff77d..0000000 --- a/build/make/local.inc.mk-template +++ /dev/null @@ -1,9 +0,0 @@ -# Local env included makefile -# This file should be ignored in version control -# note: the ?= is so you can override those again in cmdline. -# -# Change to local installations. - -#PATH_SDCC ?= /usr/bin - -#PATH_HEX2BIN ?= /usr/bin diff --git a/src/dist-run/0module.mk b/src/dist-run/0module.mk index 8650fd6..8e9ff6d 100644 --- a/src/dist-run/0module.mk +++ b/src/dist-run/0module.mk @@ -2,27 +2,16 @@ DIST_RUN_NAME := dist-run DIST_RUN_BIN := $(PATH_BIN)/$(DIST_RUN_NAME) DIST_RUN_SRC := $(PATH_SRC)/$(DIST_RUN_NAME) -DIST_RUN_INC := autoexec.bat COMMAND.COM MSXDOS.SYS -DIST_RUN_INC_BIN := $(patsubst %,$(DIST_RUN_BIN)/%,$(DIST_RUN_INC)) -DIST_RUN_INC_SRC := $(patsubst %,$(DIST_RUN_SRC)/%,$(DIST_RUN_INC)) DIST_RUN_DEP_TAR := $(PATH_BIN)/dist.tar.gz DIST_RUN_DEP := $(DIST_RUN_BIN)/tara.com - +BUILD_HELP += \\n\\t* $(DIST_RUN_NAME) $(DIST_RUN_BIN): - $(call mod_mkdir,$(DIST_RUN_BIN)) - -$(DIST_RUN_BIN)/autoexec.bat: $(DIST_RUN_SRC)/autoexec.bat | $(DIST_RUN_BIN) - unix2dos -n $< $@; - -$(DIST_RUN_BIN)/COMMAND.COM: $(DIST_RUN_SRC)/COMMAND.COM | $(DIST_RUN_BIN) - cp $< $@; - -$(DIST_RUN_BIN)/MSXDOS.SYS: $(DIST_RUN_SRC)/MSXDOS.SYS | $(DIST_RUN_BIN) - cp $< $@; + $(call mb_mkdir,$(DIST_RUN_BIN)) $(DIST_RUN_DEP): $(DIST_RUN_DEP_TAR) | $(DIST_RUN_BIN) - cp $(PATH_BIN)/dist/* $(DIST_RUN_BIN); + $(call mb_copy,$(PATH_BIN)/dist/*,$(DIST_RUN_BIN)) -$(DIST_RUN_NAME): $(DIST_RUN_INC_BIN) $(DIST_RUN_DEP) - openmsx -machine Philips_NMS_8250 -ext video9000 -ext ram4mb -ext ide -diska $(DIST_RUN_BIN); +$(DIST_RUN_NAME): $(DIST_RUN_DEP) + $(call mb_copy_autoexec_run,$(DIST_RUN_BIN),tara) + $(call mb_run_openmsx_dos2,$(DIST_RUN_BIN)) diff --git a/src/dist-run/COMMAND.COM b/src/dist-run/COMMAND.COM deleted file mode 100755 index ca1330a..0000000 Binary files a/src/dist-run/COMMAND.COM and /dev/null differ diff --git a/src/dist-run/MSXDOS.SYS b/src/dist-run/MSXDOS.SYS deleted file mode 100755 index 642e47e..0000000 Binary files a/src/dist-run/MSXDOS.SYS and /dev/null differ diff --git a/src/dist-run/autoexec.bat b/src/dist-run/autoexec.bat deleted file mode 100644 index 9455d26..0000000 --- a/src/dist-run/autoexec.bat +++ /dev/null @@ -1,6 +0,0 @@ - -@echo "TARA: Start" - -tara - -@echo "TARA: Stop" diff --git a/src/dist/0module.mk b/src/dist/0module.mk index db5b3af..0c4d93b 100644 --- a/src/dist/0module.mk +++ b/src/dist/0module.mk @@ -8,26 +8,23 @@ DIST_INC_BIN := $(patsubst %,$(DIST_BIN)/%,$(DIST_INC)) DIST_INC_SRC := $(patsubst %,$(DIST_SRC)/%,$(DIST_INC)) DIST_TARA_BIN := $(DIST_BIN)/tara.com DIST_TARA_SRC := $(PATH_BIN)/tara/tara.com +BUILD_HELP += \\n\\t* $(DIST_OUT) $(DIST_BIN): - $(call mod_mkdir,$(DIST_BIN)) - + $(call mb_mkdir,$(DIST_BIN)) + $(DIST_BIN)/ALL.SR8: $(DIST_SRC)/ALL.SR8 | $(DIST_BIN) - cp $< $@; + $(call mb_copy,$<,$@) $(DIST_BIN)/ASCII.SR8: $(DIST_SRC)/ASCII.SR8 | $(DIST_BIN) - cp $< $@; + $(call mb_copy,$<,$@) $(DIST_BIN)/VELD.SR8: $(DIST_SRC)/VELD.SR8 | $(DIST_BIN) - cp $< $@; + $(call mb_copy,$<,$@) $(DIST_BIN)/VELDBACK.4BP: $(DIST_SRC)/VELDBACK.4BP | $(DIST_BIN) - cp $< $@; + $(call mb_copy,$<,$@) $(DIST_BIN)/readme.txt: $(DIST_SRC)/readme.txt | $(DIST_BIN) - cp $< $@; - -#$(DIST_INC_BIN): $(DIST_INC_SRC) | $(DIST_BIN) -# cp $< $@; - + $(call mb_copy,$<,$@) $(DIST_TARA_BIN): $(DIST_TARA_SRC) | $(DIST_BIN) - cp $< $@; - + $(call mb_copy,$<,$@) + $(DIST_OUT): $(DIST_INC_BIN) $(DIST_TARA_BIN) - cd $(DIST_BIN) && tar -czvf ../../$(DIST_OUT) *; + $(call mb_create_dist,$(DIST_OUT),$(DIST_BIN)) diff --git a/src/tara/0module.mk b/src/tara/0module.mk index 0b55995..95be1a9 100644 --- a/src/tara/0module.mk +++ b/src/tara/0module.mk @@ -6,15 +6,16 @@ TARA_HEX := $(TARA_BIN)/$(TARA_NAME).hex TARA_COM := $(TARA_BIN)/$(TARA_NAME).com TARA_RELS := $(TARA_BIN)/$(TARA_NAME).rel TARA_CODE := $(TARA_SRC)/$(TARA_NAME).asm +BUILD_HELP += \\n\\t* $(TARA_COM) $(TARA_BIN): - $(call mod_mkdir,$(TARA_BIN)) + $(call mb_mkdir,$(TARA_BIN)) $(TARA_BIN)/%.rel: $(TARA_SRC)/%.asm | $(TARA_BIN) - $(call mod_compile_asm,$@,$<) + $(call mb_compile_asm,$@,$<) $(TARA_HEX): $(TARA_RELS) - $(call mod_link_asm_dos,$(TARA_HEX),$(TARA_RELS)) + $(call mb_link_asm_dos,$(TARA_HEX),$(TARA_RELS)) $(TARA_COM): $(TARA_HEX) - $(call mod_hex2com,$(TARA_HEX),$(TARA_COM)) + $(call mb_hex2com,$(TARA_HEX),$(TARA_COM))