Skip to content

Commit 7217fd3

Browse files
committedJul 31, 2015
Fix 0.4.11 githash for android
Also make only one >-redirection, sparing repetition. Also, use cut instead of awk, which is shorter and should be a bit faster.
1 parent 05fe9ab commit 7217fd3

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed
 

Diff for: ‎build/android/Makefile

+18-20
Original file line numberDiff line numberDiff line change
@@ -819,28 +819,26 @@ clean_all :
819819
$(RM) -r gen libs obj deps bin Debug and_env
820820

821821
$(ROOT)/jni/src/android_version.h :
822-
@echo "#ifndef ANDROID_MT_VERSION_H" \
823-
>${ROOT}/jni/src/android_version.h; \
824-
echo "#define ANDROID_MT_VERSION_H" \
825-
>> ${ROOT}/jni/src/android_version.h; \
826-
echo "#define VERSION_MAJOR $$(cat ${ROOT}/../../CMakeLists.txt | \
827-
grep ^set\(VERSION_MAJOR\ | sed 's/)/ /' | awk '{print $$2;}')" \
828-
>> ${ROOT}/jni/src/android_version.h; \
829-
echo "#define VERSION_MINOR $$(cat ${ROOT}/../../CMakeLists.txt | \
830-
grep ^set\(VERSION_MINOR\ | sed 's/)/ /' | awk '{print $$2;}')" \
831-
>> ${ROOT}/jni/src/android_version.h; \
832-
echo "#define VERSION_PATCH $$(cat ${ROOT}/../../CMakeLists.txt | \
833-
grep ^set\(VERSION_PATCH\ | sed 's/)/ /' | awk '{print $$2;}')" \
834-
>> ${ROOT}/jni/src/android_version.h; \
822+
@ { \
823+
echo "#ifndef ANDROID_MT_VERSION_H"; \
824+
echo "#define ANDROID_MT_VERSION_H"; \
825+
export CMAKE_FILE=${ROOT}/../../CMakeLists.txt; \
826+
export VERSION_MAJOR=$$(cat $${CMAKE_FILE} | \
827+
grep ^set\(VERSION_MAJOR\ | sed 's/)/ /' | cut -f2 -d' '); \
828+
export VERSION_MINOR=$$(cat $${CMAKE_FILE} | \
829+
grep ^set\(VERSION_MINOR\ | sed 's/)/ /' | cut -f2 -d' '); \
830+
export VERSION_PATCH=$$(cat $${CMAKE_FILE} | \
831+
grep ^set\(VERSION_PATCH\ | sed 's/)/ /' | cut -f2 -d' '); \
832+
echo "#define VERSION_MAJOR $${VERSION_MAJOR}"; \
833+
echo "#define VERSION_MINOR $${VERSION_MINOR}"; \
834+
echo "#define VERSION_PATCH $${VERSION_PATCH}"; \
835835
export GITHASH=$$(git rev-parse --short=8 HEAD); \
836-
export GITTAG=$$(git describe --abbrev=0 --tags); \
837-
echo "#define VERSION_GITHASH \"$$GITTAG-$$GITHASH-Android\"" \
838-
>> ${ROOT}/jni/src/android_version.h; \
836+
export VERSION_STR="$${VERSION_MAJOR}.$${VERSION_MINOR}.$${VERSION_PATCH}";\
837+
echo "#define VERSION_GITHASH \"$$VERSION_STR-$$GITHASH-Android\""; \
839838
echo "#define VERSION_STRING STR(VERSION_MAJOR)\".\"STR(VERSION_MINOR)\
840-
\".\"STR(VERSION_PATCH)" \
841-
>> ${ROOT}/jni/src/android_version.h; \
842-
echo "#endif" \
843-
>> ${ROOT}/jni/src/android_version.h;
839+
\".\"STR(VERSION_PATCH)"; \
840+
echo "#endif"; \
841+
} > ${ROOT}/jni/src/android_version.h
844842

845843
manifest :
846844
@VERS_MAJOR=$$(cat ${ROOT}/../../CMakeLists.txt | \

0 commit comments

Comments
 (0)
Please sign in to comment.