2020-12-23 17:14:13 +00:00
|
|
|
#
|
2021-07-04 00:12:48 +00:00
|
|
|
# msxbuild.mk - Makefile helper to use with msx projects.
|
2020-12-23 17:14:13 +00:00
|
|
|
#
|
|
|
|
|
2024-06-27 14:58:21 +00:00
|
|
|
# Setup default tools paths
|
2021-07-06 18:42:46 +00:00
|
|
|
PATH_SDCC ?= /usr/bin
|
|
|
|
PATH_OPENMSX ?= /usr/bin
|
|
|
|
PATH_MSXBUILD ?= $(dir $(lastword $(MAKEFILE_LIST)))../..
|
|
|
|
PATH_MSXBUILD_REAL := $(if $(realpath $(PATH_MSXBUILD)),$(realpath $(PATH_MSXBUILD)),$(PATH_MSXBUILD))
|
2024-06-29 22:49:23 +00:00
|
|
|
|
|
|
|
# Fill other defaults
|
2024-06-29 13:47:52 +00:00
|
|
|
MB_FLIGHT_SCREEN ?= off
|
|
|
|
MB_FLIGHT_VIDEO ?= off
|
|
|
|
MB_FLIGHT_PREFIX ?= msxbuild
|
|
|
|
MB_FLIGHT_SEPERATOR ?= -
|
|
|
|
MB_FLIGHT_RECORD_FLAG ?= -doublesize
|
2024-06-30 02:34:07 +00:00
|
|
|
MB_FLIGHT_VIDEO_NAME ?= flight-video
|
2020-12-23 17:14:13 +00:00
|
|
|
|
2024-06-27 14:58:21 +00:00
|
|
|
# OS cmds
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
MB_RM = del /F /Q
|
|
|
|
MB_RMDIR = RMDIR /S /Q
|
|
|
|
MB_MKDIR = mkdir
|
|
|
|
MB_COPY = copy
|
|
|
|
MB_ERRIGNORE = 2>NUL || true
|
|
|
|
MB_SEP=\\
|
|
|
|
MB_CACHE ?= %LOCALAPPDATA%
|
|
|
|
else
|
|
|
|
MB_RM = rm -f
|
|
|
|
MB_RMDIR = rm -rf
|
|
|
|
MB_MKDIR = mkdir -p
|
|
|
|
MB_COPY = cp
|
|
|
|
MB_ERRIGNORE = 2>/dev/null
|
|
|
|
MB_SEP=/
|
|
|
|
MB_CACHE ?= ~/.cache
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Remove space after separator
|
|
|
|
MB_PSEP = $(strip $(MB_SEP))
|
|
|
|
|
|
|
|
# Needed for comma in call arguments (like for l80.com)
|
|
|
|
MB_COMMA:=,
|
|
|
|
|
|
|
|
# Simple inline ascii lowercase
|
|
|
|
define _mb_lowercase
|
|
|
|
$(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$(1)))))))))))))))))))))))))))
|
|
|
|
endef
|
|
|
|
|
|
|
|
define mb_clean
|
|
|
|
@echo === Cleaning build folder.
|
|
|
|
$(if $(wildcard $(1)),$(MB_RMDIR) $(1))
|
|
|
|
endef
|
|
|
|
define mb_mkdir
|
|
|
|
$(MB_MKDIR) $(1)
|
|
|
|
endef
|
|
|
|
define mb_delete
|
|
|
|
$(if $(wildcard $(1)),$(MB_RM) $(1))
|
|
|
|
endef
|
|
|
|
define mb_copy
|
|
|
|
$(MB_COPY) $(1) $(2)
|
|
|
|
endef
|
2024-06-28 12:20:42 +00:00
|
|
|
define mb_unix2dos
|
|
|
|
unix2dos -q -n $(1) $(2)
|
|
|
|
endef
|
|
|
|
define mb_dos2unix
|
|
|
|
dos2unix -q -n $(1) $(2)
|
|
|
|
endef
|
2024-06-27 14:58:21 +00:00
|
|
|
define mb_create_dist
|
2024-06-30 02:37:21 +00:00
|
|
|
@echo === Creating distribution archive
|
|
|
|
tar -czf $(2) -C $(1) `ls $(1)`
|
2024-06-27 14:58:21 +00:00
|
|
|
endef
|
2024-06-30 02:34:07 +00:00
|
|
|
define mb_create_flight_video
|
|
|
|
@echo === Indexing flight videos
|
|
|
|
ls -1tr $(1)/*-omsx/videos/*.avi | awk -F "$(1)/" -v s="file '" -v e="'" '{print s$$2e}' > $(1)/$(MB_FLIGHT_VIDEO_NAME).lst
|
2024-06-30 02:47:57 +00:00
|
|
|
ffmpeg -v quiet -y -f concat -i $(1)/$(MB_FLIGHT_VIDEO_NAME).lst -c copy $(1)/$(MB_FLIGHT_VIDEO_NAME).avi
|
2024-06-30 02:34:07 +00:00
|
|
|
@echo === Flight video completed
|
|
|
|
endef
|
2024-06-27 14:58:21 +00:00
|
|
|
|
|
|
|
# Include extra features
|
2024-06-28 12:20:42 +00:00
|
|
|
include $(PATH_MSXBUILD)/lib/make/mb_sdcc.mk
|
2024-06-27 14:58:21 +00:00
|
|
|
include $(PATH_MSXBUILD)/lib/make/mb_msxrom.mk
|
2021-07-04 00:12:48 +00:00
|
|
|
include $(PATH_MSXBUILD)/lib/make/mb_msxhub.mk
|
2020-12-23 17:14:13 +00:00
|
|
|
include $(PATH_MSXBUILD)/lib/make/mb_openmsx.mk
|
2024-06-28 12:20:42 +00:00
|
|
|
include $(PATH_MSXBUILD)/lib/make/mb_autoexec.mk
|