2018-02-06 13:48:38 +00:00
|
|
|
VERSION = $(shell cat "VERSION")
|
2016-07-11 14:30:51 +00:00
|
|
|
PREFIX = ace
|
|
|
|
BIN = @ace
|
|
|
|
ZIP = ace3
|
2018-05-22 16:45:27 +00:00
|
|
|
FLAGS = -i include -w unquoted-string -w redefinition-wo-undef
|
2018-02-06 13:48:38 +00:00
|
|
|
VERSION_FILES = README.md docs/README_DE.md docs/README_PL.md mod.cpp
|
2017-02-07 03:09:50 +00:00
|
|
|
|
2018-02-06 13:48:38 +00:00
|
|
|
MAJOR = $(word 1, $(subst ., ,$(VERSION)))
|
|
|
|
MINOR = $(word 2, $(subst ., ,$(VERSION)))
|
|
|
|
PATCH = $(word 3, $(subst ., ,$(VERSION)))
|
|
|
|
BUILD = $(word 4, $(subst ., ,$(VERSION)))
|
|
|
|
VERSION_S = $(MAJOR).$(MINOR).$(PATCH)
|
|
|
|
GIT_HASH = $(shell git log -1 --pretty=format:"%H" | head -c 8)
|
2016-05-15 16:21:23 +00:00
|
|
|
|
2017-12-14 16:27:57 +00:00
|
|
|
ifeq ($(OS), Windows_NT)
|
2018-11-18 19:46:04 +00:00
|
|
|
ARMAKE = ./tools/armake.exe # Downloaded via make.ps (rename armake_wXY.exe otherwise)
|
2017-12-14 16:27:57 +00:00
|
|
|
else
|
|
|
|
ARMAKE = armake
|
|
|
|
endif
|
|
|
|
|
2016-07-11 14:30:51 +00:00
|
|
|
$(BIN)/addons/$(PREFIX)_%.pbo: addons/%
|
2016-05-15 16:21:23 +00:00
|
|
|
@mkdir -p $(BIN)/addons
|
2016-05-02 14:39:47 +00:00
|
|
|
@echo " PBO $@"
|
2018-05-22 15:21:48 +00:00
|
|
|
@${ARMAKE} build ${FLAGS} -f -e "version=$(GIT_HASH)" $< $@
|
2016-05-02 14:39:47 +00:00
|
|
|
|
2016-07-11 14:30:51 +00:00
|
|
|
$(BIN)/optionals/$(PREFIX)_%.pbo: optionals/%
|
2016-05-15 16:21:23 +00:00
|
|
|
@mkdir -p $(BIN)/optionals
|
|
|
|
@echo " PBO $@"
|
2018-05-22 15:21:48 +00:00
|
|
|
@${ARMAKE} build ${FLAGS} -f -e "version=$(GIT_HASH)" $< $@
|
2016-05-02 14:39:47 +00:00
|
|
|
|
2016-07-11 14:30:51 +00:00
|
|
|
# Shortcut for building single addons (eg. "make <component>.pbo")
|
2016-05-15 16:21:23 +00:00
|
|
|
%.pbo:
|
2016-07-11 14:30:51 +00:00
|
|
|
"$(MAKE)" $(MAKEFLAGS) $(patsubst %, $(BIN)/addons/$(PREFIX)_%, $@)
|
2016-05-15 16:21:23 +00:00
|
|
|
|
2016-07-11 14:30:51 +00:00
|
|
|
all: $(patsubst addons/%, $(BIN)/addons/$(PREFIX)_%.pbo, $(wildcard addons/*)) \
|
|
|
|
$(patsubst optionals/%, $(BIN)/optionals/$(PREFIX)_%.pbo, $(wildcard optionals/*))
|
2016-05-02 14:39:47 +00:00
|
|
|
|
2016-05-28 18:33:49 +00:00
|
|
|
filepatching:
|
2017-02-07 03:09:50 +00:00
|
|
|
"$(MAKE)" $(MAKEFLAGS) FLAGS="-w unquoted-string -p"
|
2016-05-28 18:33:49 +00:00
|
|
|
|
2016-05-21 14:21:51 +00:00
|
|
|
$(BIN)/keys/%.biprivatekey:
|
|
|
|
@mkdir -p $(BIN)/keys
|
|
|
|
@echo " KEY $@"
|
2017-12-14 16:27:57 +00:00
|
|
|
@${ARMAKE} keygen -f $(patsubst $(BIN)/keys/%.biprivatekey, $(BIN)/keys/%, $@)
|
2016-05-21 14:21:51 +00:00
|
|
|
|
2018-02-06 13:48:38 +00:00
|
|
|
$(BIN)/addons/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION)-$(GIT_HASH).bisign: $(BIN)/addons/$(PREFIX)_%.pbo $(BIN)/keys/$(PREFIX)_$(VERSION).biprivatekey
|
2016-05-21 14:21:51 +00:00
|
|
|
@echo " SIG $@"
|
2018-05-22 15:21:48 +00:00
|
|
|
@${ARMAKE} sign -f -s $@ $(BIN)/keys/$(PREFIX)_$(VERSION).biprivatekey $<
|
2016-05-21 14:21:51 +00:00
|
|
|
|
2018-02-06 13:48:38 +00:00
|
|
|
$(BIN)/optionals/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION)-$(GIT_HASH).bisign: $(BIN)/optionals/$(PREFIX)_%.pbo $(BIN)/keys/$(PREFIX)_$(VERSION).biprivatekey
|
2016-05-21 14:21:51 +00:00
|
|
|
@echo " SIG $@"
|
2018-05-22 15:21:48 +00:00
|
|
|
@${ARMAKE} sign -f -s $@ $(BIN)/keys/$(PREFIX)_$(VERSION).biprivatekey $<
|
2016-05-21 14:21:51 +00:00
|
|
|
|
2018-02-06 13:48:38 +00:00
|
|
|
signatures: $(patsubst addons/%, $(BIN)/addons/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION)-$(GIT_HASH).bisign, $(wildcard addons/*)) \
|
|
|
|
$(patsubst optionals/%, $(BIN)/optionals/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION)-$(GIT_HASH).bisign, $(wildcard optionals/*))
|
2016-05-21 14:21:51 +00:00
|
|
|
|
2016-05-02 14:39:47 +00:00
|
|
|
extensions: $(wildcard extensions/*/*)
|
|
|
|
cd extensions/build && cmake .. && make
|
|
|
|
find ./extensions/build/ \( -name "*.so" -o -name "*.dll" \) -exec cp {} ./ \;
|
|
|
|
|
|
|
|
extensions-win64: $(wildcard extensions/*/*)
|
|
|
|
cd extensions/build && CXX=$(eval $(which g++-w64-mingw-i686)) cmake .. && make
|
|
|
|
|
2018-02-06 13:48:38 +00:00
|
|
|
version:
|
|
|
|
@echo " VER $(VERSION)"
|
|
|
|
$(shell sed -i -r -s 's/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/$(VERSION)/g' $(VERSION_FILES))
|
|
|
|
$(shell sed -i -r -s 's/[0-9]+\.[0-9]+\.[0-9]+/$(VERSION_S)/g' $(VERSION_FILES))
|
2018-11-18 19:46:04 +00:00
|
|
|
@echo -e "#define MAJOR $(MAJOR)\n#define MINOR $(MINOR)\n#define PATCHLVL $(PATCH)\n#define BUILD $(BUILD)" > "addons/main/script_version.hpp"
|
2018-02-06 13:48:38 +00:00
|
|
|
$(shell sed -i -r -s 's/ACE_VERSION_MAJOR [0-9]+/ACE_VERSION_MAJOR $(MAJOR)/g' extensions/CMakeLists.txt)
|
|
|
|
$(shell sed -i -r -s 's/ACE_VERSION_MINOR [0-9]+/ACE_VERSION_MINOR $(MINOR)/g' extensions/CMakeLists.txt)
|
|
|
|
$(shell sed -i -r -s 's/ACE_VERSION_REVISION [0-9]+/ACE_VERSION_REVISION $(PATCH)/g' extensions/CMakeLists.txt)
|
|
|
|
|
|
|
|
commit:
|
|
|
|
@echo " GIT commit release preparation"
|
|
|
|
@git add -A
|
|
|
|
@git diff-index --quiet HEAD || git commit -am "Prepare release $(VERSION_S)" -q
|
|
|
|
|
|
|
|
push: commit
|
|
|
|
@echo " GIT push release preparation"
|
|
|
|
@git push -q
|
|
|
|
|
|
|
|
release: clean version commit
|
2016-05-29 20:28:37 +00:00
|
|
|
@"$(MAKE)" $(MAKEFLAGS) signatures
|
2018-02-06 13:48:38 +00:00
|
|
|
@echo " ZIP $(ZIP)_$(VERSION_S).zip"
|
2019-09-28 21:03:55 +00:00
|
|
|
@cp *.dll *.so mod.cpp README.md docs/README_DE.md docs/README_PL.md AUTHORS.txt LICENSE logo_ace3_ca.paa meta.cpp $(BIN)
|
2018-02-06 13:48:38 +00:00
|
|
|
@zip -qr $(ZIP)_$(VERSION_S).zip $(BIN)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(BIN) $(ZIP)_*.zip
|
2016-05-28 18:33:49 +00:00
|
|
|
|
2018-02-06 13:48:38 +00:00
|
|
|
.PHONY: all filepatching signatures extensions extensions-win64 version commit push release clean
|