msxbuild/lib/make/mb_base.mk

43 lines
728 B
Makefile

# 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:=,
define mb_clean
@echo === Cleaning build folder.
test $(1) && $(MB_RMDIR) $(1)
endef
define mb_mkdir
$(MB_MKDIR) $(1)
endef
define mb_delete
test $(1) && $(MB_RM) $(1)
endef
define mb_copy
$(MB_COPY) $(1) $(2)
endef
define mb_create_dist
tar -czf $(1) -C $(2) `ls $(2)`
endef