-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
51 lines (41 loc) · 1.89 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
MAJOR = $(shell grep "^\#define[[:space:]]*MAJOR" addons/main/script_mod.hpp | egrep -m 1 -o '[[:digit:]]+')
MINOR = $(shell grep "^\#define[[:space:]]*MINOR" addons/main/script_mod.hpp | egrep -m 1 -o '[[:digit:]]+')
PATCH = $(shell grep "^\#define[[:space:]]*PATCHLVL" addons/main/script_mod.hpp | egrep -m 1 -o '[[:digit:]]+')
BUILD = $(shell grep "^\#define[[:space:]]*BUILD" addons/main/script_mod.hpp | egrep -m 1 -o '[[:digit:]]+')
VERSION = $(MAJOR).$(MINOR).$(PATCH)
VERSION_FULL = $(VERSION).$(BUILD)
PREFIX = kge
BIN = @kge
ZIP = kge
CBA = tools/cba
FLAGS = -i $(CBA) -w unquoted-string
COPY = cp LICENSE README.md kuikka.paa mod.cpp CHANGELOG.md $(BIN)
$(BIN)/addons/$(PREFIX)_%.pbo: addons/%
@mkdir -p $(BIN)/addons
@echo " PBO $@"
@armake build ${FLAGS} -f $< $@
# Shortcut for building single addons (eg. "make <component>.pbo")
%.pbo:
@"$(MAKE)" $(MAKEFLAGS) $(patsubst %, $(BIN)/addons/$(PREFIX)_%, $@)
all: $(patsubst addons/%, $(BIN)/addons/$(PREFIX)_%.pbo, $(wildcard addons/*))
filepatching: clean
@"$(MAKE)" $(MAKEFLAGS) FLAGS="-i $(CBA) -w unquoted-string -p"
@$(COPY)
$(BIN)/keys/%.biprivatekey:
@mkdir -p $(BIN)/keys
@echo " KEY $@"
@armake keygen -f $(patsubst $(BIN)/keys/%.biprivatekey, $(BIN)/keys/%, $@)
$(BIN)/addons/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION_FULL).bisign: $(BIN)/addons/$(PREFIX)_%.pbo $(BIN)/keys/$(PREFIX)_$(VERSION_FULL).biprivatekey
@echo " SIG $@"
@armake sign -f $(BIN)/keys/kge_$(VERSION_FULL).biprivatekey $<
signatures: $(patsubst addons/%, $(BIN)/addons/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION_FULL).bisign, $(wildcard addons/*)) \
$(patsubst optionals/%, $(BIN)/optionals/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION_FULL).bisign, $(wildcard optionals/*))
clean:
@rm -rf $(BIN) $(ZIP)_*.zip
release:
@"$(MAKE)" clean
@"$(MAKE)" $(MAKEFLAGS) signatures
@echo " ZIP kge_$(VERSION).zip"
@$(COPY)
@zip -r $(ZIP)_$(VERSION).zip $(BIN) &> /dev/null
.PHONY: release