forked from narc0tiq/FactorioMaps
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
29 lines (23 loc) · 1.08 KB
/
Makefile
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
BUILD_DIR := build
# Locate JQ for parsing info.json
JQ = $(shell which jq 2> /dev/null)
ifeq ($(strip $(JQ)),)
$(error "jq program is required to parse info.json")
else
MODNAME = $(shell cat info.json | $(JQ) -r .name)
MODVERSION = $(shell cat info.json | $(JQ) -r .version)
FACTORIOVERSION = $(shell cat info.json | $(JQ) -r .factorio_version)
FACTORIOFOLDER = ../../../AppData/Roaming/ModMyFactory/mods/$(FACTORIOVERSION)
endif
all: release
release: clean
@mkdir -p "./$(BUILD_DIR)"
git archive --prefix "$(MODNAME)_$(MODVERSION)/" -o "./$(BUILD_DIR)/$(MODNAME)_$(MODVERSION).zip" HEAD
cp ./$(BUILD_DIR)/$(MODNAME)_$(MODVERSION).zip "$(FACTORIOFOLDER)/"
dev: clean
@mkdir -p $(BUILD_DIR)
rsync -qvaz --delete --exclude={.git,build} ./ "./$(BUILD_DIR)/$(MODNAME)_$(MODVERSION)"
rsync -qvaz --delete "./$(BUILD_DIR)/$(MODNAME)_$(MODVERSION)/" "$(FACTORIOFOLDER)/$(MODNAME)_$(MODVERSION)"
set -e; for file in $$(find "./$(BUILD_DIR)/$(MODNAME)_$(MODVERSION)" -iname '*.lua' -type f); do echo "Checking syntax: $$file" ; luac -p $$file; done;
clean:
rm -rf $(FACTORIOFOLDER)/$(MODNAME)_*