-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (46 loc) · 2.57 KB
/
Copy pathMakefile
File metadata and controls
58 lines (46 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
########################################################################################################################
# Variables
########################################################################################################################
CLEAN_TARGETS := ./quick-start-delight*.zip
PROJECT_NAME := quick-start-delight
SHELL := /bin/bash
VERSION_REGEX := "([0-9]{1,}\.)+[0-9]{1,}"
########################################################################################################################
# Computed Variables
########################################################################################################################
VERSION_ID := ${shell grep '"version"' ./info.json | grep -E -o ${VERSION_REGEX}}
########################################################################################################################
# Composite Variables
########################################################################################################################
MOD_FULLNAME := ${PROJECT_NAME}_${VERSION_ID}
MOD_ZIP_EXCLUDES := @${PROJECT_NAME}/exclude.lst
########################################################################################################################
# `make help` Needs to be first so it is ran when just `make` is called
########################################################################################################################
.PHONY: help
help: # Show this help screen
@grep -E '^[a-zA-Z_-]+:.*# .*$$' ${MAKEFILE_LIST} |\
sort -k1,1 |\
awk 'BEGIN {FS = ":.*?# "}; {printf "\033[1m%-30s\033[0m %s\n", $$1, $$2}'
########################################################################################################################
# User-callable commands
########################################################################################################################
.PHONY: debug
debug: # Show debug info about the environment.
@echo 'MOD_FULLNAME .... ${MOD_FULLNAME}'
@echo 'SHELL ........... ${SHELL}'
@echo 'VERSION_ID ...... ${VERSION_ID}'
@echo 'VERSION_REGEX ... ${VERSION_REGEX}'
.PHONY: build
build: clean # Build the mod package
cd .. && \
zip -v ./${PROJECT_NAME}/${MOD_FULLNAME}.zip -r ./${PROJECT_NAME} -x ${MOD_ZIP_EXCLUDES} && \
cd ./${PROJECT_NAME}
.PHONY: clean
clean: # Clean the project directory.
rm -rf ${CLEAN_TARGETS}
.PHONY: run-mod-macos
run-mod-macos: clean build # Build and run the mod (macOS)
rm -f ~/Library/Application\ Support/factorio/mods/quick*.zip && \
mv ./quick-start-delight*.zip ~/Library/Application\ Support/factorio/mods/ && \
open /Applications/factorio.app