msxbuild/lib/make/mb_base.mk
2020-12-23 18:14:13 +01:00

45 lines
789 B
Makefile

# TODO: clean up + make working for non-unix systems.
# 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=\\
else
MB_RM = rm -f
MB_RMDIR = rm -rf
MB_MKDIR = mkdir -p
MB_COPY = cp
MB_ERRIGNORE = 2>/dev/null
MB_SEP=/
endif
# Remove space after separator
MB_PSEP = $(strip $(MB_SEP))
define mb_clean
@echo === Cleaning build folder.
test $(1) && $(MB_RMDIR) $(1)
endef
define mb_mkdir
@echo === Create module build folder.
$(MB_MKDIR) $(1)
endef
define mb_delete
test $(1) && $(MB_RM) $(1)
endef
define mb_copy
$(MB_COPY) $(1) $(2)
endef
define mb_file_info
sha1sum $(1)
ls -lah $(1)
endef
define mb_create_dist
tar -czf $(1) -C $(2) `ls $(2)`
$(call mb_file_info,$(1))
endef