From c91a37e6cc33c90a9f057df1c5b380135bf35e14 Mon Sep 17 00:00:00 2001 From: jonpas Date: Sun, 22 May 2016 17:40:50 +0200 Subject: [PATCH] Read version from script_mod.hpp, Define PREFIX and ZIP --- Makefile | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 2da95e0e39..b87c736a5e 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,47 @@ -VERSION = 3.5.1 -BIN = @ace +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 = ace +BIN = @ace +ZIP = ace3 CBA = tools/cba FLAGS = -i $(CBA) -w unquoted-string -$(BIN)/addons/ace_%.pbo: addons/% +$(BIN)/addons/$(PREFIX)_%.pbo: addons/% @mkdir -p $(BIN)/addons @echo " PBO $@" @armake build ${FLAGS} -f $< $@ -$(BIN)/optionals/ace_%.pbo: optionals/% +$(BIN)/optionals/$(PREFIX)_%.pbo: optionals/% @mkdir -p $(BIN)/optionals @echo " PBO $@" @armake build ${FLAGS} -f $< $@ -# This is a shortcut for building single addons, so you can just call "make medical.pbo" +# Shortcut for building single addons (eg. "make .pbo") %.pbo: - make $(patsubst %, $(BIN)/addons/ace_%, $@) + make $(patsubst %, $(BIN)/addons/$(PREFIX)_%, $@) -all: $(patsubst addons/%, $(BIN)/addons/ace_%.pbo, $(wildcard addons/*)) \ - $(patsubst optionals/%, $(BIN)/optionals/ace_%.pbo, $(wildcard optionals/*)) +all: $(patsubst addons/%, $(BIN)/addons/$(PREFIX)_%.pbo, $(wildcard addons/*)) \ + $(patsubst optionals/%, $(BIN)/optionals/$(PREFIX)_%.pbo, $(wildcard optionals/*)) $(BIN)/keys/%.biprivatekey: @mkdir -p $(BIN)/keys @echo " KEY $@" @armake keygen -f $(patsubst $(BIN)/keys/%.biprivatekey, $(BIN)/keys/%, $@) -$(BIN)/addons/ace_%.pbo.ace_$(VERSION).bisign: $(BIN)/addons/ace_%.pbo $(BIN)/keys/ace_$(VERSION).biprivatekey +$(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/ace_$(VERSION).biprivatekey $< + @armake sign -f $(BIN)/keys/ace_$(VERSION_FULL).biprivatekey $< -$(BIN)/optionals/ace_%.pbo.ace_$(VERSION).bisign: $(BIN)/optionals/ace_%.pbo $(BIN)/keys/ace_$(VERSION).biprivatekey +$(BIN)/optionals/$(PREFIX)_%.pbo.$(PREFIX)_$(VERSION_FULL).bisign: $(BIN)/optionals/$(PREFIX)_%.pbo $(BIN)/keys/$(PREFIX)_$(VERSION_FULL).biprivatekey @echo " SIG $@" - @armake sign -f $(BIN)/keys/ace_$(VERSION).biprivatekey $< + @armake sign -f $(BIN)/keys/$(PREFIX)_$(VERSION_FULL).biprivatekey $< -signatures: $(patsubst addons/%, $(BIN)/addons/ace_%.pbo.ace_$(VERSION).bisign, $(wildcard addons/*)) \ - $(patsubst optionals/%, $(BIN)/optionals/ace_%.pbo.ace_$(VERSION).bisign, $(wildcard optionals/*)) +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/*)) extensions: $(wildcard extensions/*/*) cd extensions/build && cmake .. && make @@ -44,10 +51,10 @@ extensions-win64: $(wildcard extensions/*/*) cd extensions/build && CXX=$(eval $(which g++-w64-mingw-i686)) cmake .. && make clean: - rm -rf $(BIN) ace3_*.zip + rm -rf $(BIN) $(ZIP)_*.zip release: clean signatures @rm $(BIN)/keys/*.biprivatekey @echo " ZIP ace3_$(VERSION).zip" @cp *.dll LICENSE README.md AUTHORS.txt logo_ace3_ca.paa mod.cpp meta.cpp $(BIN) - @zip -r ace3_$(VERSION).zip @ace &> /dev/null + @zip -r $(ZIP)_$(VERSION).zip $(BIN) &> /dev/null