-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
42 lines (31 loc) · 1023 Bytes
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
PACKAGE_NAME := Big_Brother
VERSION_STRING := 0.6.0
OUTPUT_NAME := $(PACKAGE_NAME)_$(VERSION_STRING)
OUTPUT_DIR := build/$(OUTPUT_NAME)
PKG_COPY := $(wildcard *.md) graphics locale changelog.txt thumbnail.png
SED_FILES := $(shell find . -iname '*.json' -type f -not -path "./build/*") $(shell find . -iname '*.lua' -type f -not -path "./build/*")
OUT_FILES := $(SED_FILES:%=$(OUTPUT_DIR)/%)
SED_EXPRS := -e 's/{{MOD_NAME}}/$(PACKAGE_NAME)/g'
SED_EXPRS += -e 's/{{VERSION}}/$(VERSION_STRING)/g'
all: clean package install_mod
package-copy: $(PKG_DIRS) $(PKG_FILES)
mkdir -p $(OUTPUT_DIR)
ifneq ($(PKG_COPY),)
cp -r $(PKG_COPY) build/$(OUTPUT_NAME)
endif
$(OUTPUT_DIR)/%.lua: %.lua
@mkdir -p $(@D)
@sed $(SED_EXPRS) $< > $@
luac -p $@
$(OUTPUT_DIR)/%: %
mkdir -p $(@D)
sed $(SED_EXPRS) $< > $@
package: package-copy $(OUT_FILES)
cd build && zip -r $(OUTPUT_NAME).zip $(OUTPUT_NAME)
clean:
rm -rf build/
install_mod:
if [ -L factorio_mods ] ; \
then \
cp -R build/$(OUTPUT_NAME) factorio_mods ; \
fi;