aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/android/Makefile60
1 files changed, 36 insertions, 24 deletions
diff --git a/build/android/Makefile b/build/android/Makefile
index 055386361..4ccca56b5 100644
--- a/build/android/Makefile
+++ b/build/android/Makefile
@@ -15,6 +15,14 @@ ROOT = $(shell pwd)
GAMES_TO_COPY = minetest_game
+
+VERSION_MAJOR := $(shell cat $(ROOT)/../../CMakeLists.txt | \
+ grep ^set\(VERSION_MAJOR\ | sed 's/)/ /' | cut -f2 -d' ')
+VERSION_MINOR := $(shell cat $(ROOT)/../../CMakeLists.txt | \
+ grep ^set\(VERSION_MINOR\ | sed 's/)/ /' | cut -f2 -d' ')
+VERSION_PATCH := $(shell cat $(ROOT)/../../CMakeLists.txt | \
+ grep ^set\(VERSION_PATCH\ | sed 's/)/ /' | cut -f2 -d' ')
+
################################################################################
# Android Version code
# Increase for each build!
@@ -161,7 +169,8 @@ endif
$(OPENAL_TIMESTAMP) $(OGG_TIMESTAMP) \
$(IRRLICHT_TIMESTAMP) $(CURL_TIMESTAMP) \
$(OPENSSL_TIMESTAMP) curl_binary \
- $(ROOT)/jni/src/android_version.h
+ $(ROOT)/jni/src/android_version.h \
+ $(ROOT)/jni/src/android_version_githash.h
debug : $(PATHCFGFILE)
export NDEBUG=; \
@@ -773,7 +782,7 @@ clean_assets :
apk: $(PATHCFGFILE) assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LEVELDB_TARGET) \
$(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ROOT)/jni/src/android_version.h \
- sqlite3_download
+ $(ROOT)/jni/src/android_version_githash.h sqlite3_download
@export NDEBUG=$$NDEBUG; $(MAKE) manifest; \
export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \
export ANDROID_HOME=${SDKFOLDER}; \
@@ -819,44 +828,47 @@ clean_all :
sleep 1; \
$(RM) -r gen libs obj deps bin Debug and_env
+$(ROOT)/jni/src/android_version_githash.h : prep_srcdir
+ @export VERSION_FILE=${ROOT}/jni/src/android_version_githash.h; \
+ export VERSION_FILE_NEW=$${VERSION_FILE}.new; \
+ { \
+ echo "#ifndef ANDROID_MT_VERSION_GITHASH_H"; \
+ echo "#define ANDROID_MT_VERSION_GITHASH_H"; \
+ export GITHASH=$$(git rev-parse --short=8 HEAD); \
+ export VERSION_STR="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"; \
+ echo "#define VERSION_GITHASH \"$$VERSION_STR-$$GITHASH-Android\""; \
+ echo "#endif"; \
+ } > "$${VERSION_FILE_NEW}"; \
+ if ! cmp -s $${VERSION_FILE} $${VERSION_FILE_NEW}; then \
+ echo "android_version_githash.h changed, updating..."; \
+ mv "$${VERSION_FILE_NEW}" "$${VERSION_FILE}"; \
+ else \
+ rm "$${VERSION_FILE_NEW}"; \
+ fi
+
+
$(ROOT)/jni/src/android_version.h : prep_srcdir
@export VERSION_FILE=${ROOT}/jni/src/android_version.h; \
export VERSION_FILE_NEW=$${VERSION_FILE}.new; \
{ \
echo "#ifndef ANDROID_MT_VERSION_H"; \
echo "#define ANDROID_MT_VERSION_H"; \
- export CMAKE_FILE=${ROOT}/../../CMakeLists.txt; \
- export VERSION_MAJOR=$$(cat $${CMAKE_FILE} | \
- grep ^set\(VERSION_MAJOR\ | sed 's/)/ /' | cut -f2 -d' '); \
- export VERSION_MINOR=$$(cat $${CMAKE_FILE} | \
- grep ^set\(VERSION_MINOR\ | sed 's/)/ /' | cut -f2 -d' '); \
- export VERSION_PATCH=$$(cat $${CMAKE_FILE} | \
- grep ^set\(VERSION_PATCH\ | sed 's/)/ /' | cut -f2 -d' '); \
- echo "#define VERSION_MAJOR $${VERSION_MAJOR}"; \
- echo "#define VERSION_MINOR $${VERSION_MINOR}"; \
- echo "#define VERSION_PATCH $${VERSION_PATCH}"; \
- export GITHASH=$$(git rev-parse --short=8 HEAD); \
- export VERSION_STR="$${VERSION_MAJOR}.$${VERSION_MINOR}.$${VERSION_PATCH}";\
- echo "#define VERSION_GITHASH \"$$VERSION_STR-$$GITHASH-Android\""; \
+ echo "#define VERSION_MAJOR ${VERSION_MAJOR}"; \
+ echo "#define VERSION_MINOR ${VERSION_MINOR}"; \
+ echo "#define VERSION_PATCH ${VERSION_PATCH}"; \
echo "#define VERSION_STRING STR(VERSION_MAJOR)\".\"STR(VERSION_MINOR)\
\".\"STR(VERSION_PATCH)"; \
echo "#endif"; \
} > $${VERSION_FILE_NEW}; \
if ! cmp -s $${VERSION_FILE} $${VERSION_FILE_NEW}; then \
echo "android_version.h changed, updating..."; \
- mv $${VERSION_FILE_NEW} $${VERSION_FILE}; \
+ mv "$${VERSION_FILE_NEW}" "$${VERSION_FILE}"; \
else \
- rm $${VERSION_FILE_NEW}; \
+ rm "$${VERSION_FILE_NEW}"; \
fi
manifest :
- @VERS_MAJOR=$$(cat ${ROOT}/../../CMakeLists.txt | \
- grep ^set\(VERSION_MAJOR\ | sed 's/)/ /' | awk '{print $$2;}'); \
- VERS_MINOR=$$(cat ${ROOT}/../../CMakeLists.txt | \
- grep ^set\(VERSION_MINOR\ | sed 's/)/ /' | awk '{print $$2;}'); \
- VERS_PATCH=$$(cat ${ROOT}/../../CMakeLists.txt | \
- grep ^set\(VERSION_PATCH\ | sed 's/)/ /' | awk '{print $$2;}'); \
- BASE_VERSION="$$VERS_MAJOR.$$VERS_MINOR.$$VERS_PATCH"; \
+ @BASE_VERSION="${VERS_MAJOR}.${VERS_MINOR}.${VERS_PATCH}"; \
if [ "${NDEBUG}x" != "x" ] ; then \
DBG=''; \
DBG_FLAG="android:debuggable=\"false\""; \