2 # Common Makefile pieces for building Java / Android apps.
6 # BOOTSTRAPDIR needs to be set to this directory before starting this
9 # Probably would be best to just stop fooling around with the possibilities to
10 # set various stuff with the -env command line parameters (and environment
11 # variables?) and in a plethora of rc files, and hardcode construction of
12 # *all* required pathnames based on the app installation location for Android
13 # (and iOS), etc. We don't really win anything by having so many layers of
14 # configurability on platforms like Android and iOS where apps based on LO
15 # code are very much self-contained pre-packaged thingies.
17 SODEST=jniLibs/$(ANDROID_APP_ABI)
18 OBJLOCAL=obj/local/$(ANDROID_APP_ABI)
24 local.properties: $(BUILDDIR)/config_host.mk
25 echo sdk.dir=$(ANDROID_SDK_HOME) >local.properties
28 # Build / link the single .so for this app
31 ALL_STATIC_LIBS := $(shell $(SRCDIR)/bin/lo-all-static-libs)
53 $(addprefix -l,$(strip \
56 -Wl,--no-whole-archive
59 $(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS)
62 $(CXX) -Wl,--build-id=sha1 -Wl,--gc-sections -Wl,--version-script=../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -Wl,-soname,liblo-native-code.so -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -lc++_static -lc++abi -landroid_support $(if $(filter armeabi-v7a,$(ANDROID_APP_ABI)),-lunwind) $(addprefix -l,$(NSSLIBS)) -lGLESv2 -landroid -ljnigraphics -llog -lz
64 $(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
66 $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so
67 #to keep some symbols, eg.: $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so -w -K 'Java*'
69 $(SODEST)/nss-libraries :
71 $(foreach lib,$(NSSLIBS),$(STRIP) -o $(SODEST)/lib$(lib).so $(INSTDIR)/$(LIBO_LIB_FOLDER)/lib$(lib).so;)
73 $(SODEST)/libc++_shared.so : $(ANDROID_NDK_HOME)/sources/cxx-stl/llvm-libc++/libs/$(ANDROID_APP_ABI)/libc++_shared.so
76 link-so: $(SODEST)/liblo-native-code.so $(SODEST)/nss-libraries $(SODEST)/libc++_shared.so
78 # If you reinstall an app several times *on the emulator*, even if you
79 # uninstall it between, disk space seems to leak that won't get recycled until
80 # you stop and start... No idea if this holds for a device, too. (And you
81 # can't "stop" a device anyway.)
84 $(ANDROID_SDK_HOME)/platform-tools/adb shell stop && $(ANDROID_SDK_HOME)/platform-tools/adb shell start && sleep 10
86 # build-host specific stuff (build paths and the like) to keep build.gradle static
87 liboSettings.gradle: $(BUILDDIR)/config_build.mk $(BUILDDIR)/config_host.mk
90 echo "// created by Makefile.shared - your changes will be overridden" \
92 && echo " liboSrcRoot = '$(SRC_ROOT)'" \
93 && echo " liboWorkdir = '$(WORKDIR)'" \
94 && echo " liboInstdir = '$(INSTDIR)'" \
95 && echo " liboEtcFolder = '$(LIBO_ETC_FOLDER)'" \
96 && echo " liboUreMiscFolder = '$(LIBO_URE_MISC_FOLDER)'" \
97 && echo " liboSharedResFolder = '$(LIBO_SHARE_RESOURCE_FOLDER)'" \
98 && echo " liboUREJavaFolder = '$(LIBO_URE_SHARE_JAVA_FOLDER)'" \
99 && echo " liboShareJavaFolder = '$(LIBO_SHARE_JAVA_FOLDER)'" \
100 && echo " liboExampleDocument = '$(if $(exampleDocument),$(exampleDocument),$(SRC_ROOT)/android/default-document/example.odt)'" \
101 && echo " liboVersionMajor = '$(LIBO_VERSION_MAJOR)'" \
102 && echo " liboVersionMinor = '$(LIBO_VERSION_MINOR)'" \
103 && echo " liboGitFullCommit = '$(shell cd $(SRCDIR) && git log -1 --format=%H)'" \
105 && echo "android.defaultConfig {" \
106 && echo " applicationId '$(ANDROID_PACKAGE_NAME)'" \
107 && echo " versionCode project.hasProperty('cmdVersionCode') ? cmdVersionCode.toInteger() : $(if $(versionCode),$(versionCode),1)" \
108 && echo " versionName '$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)/$(shell cd $(SRCDIR) && git log -1 --format=%h)/$(OOO_VENDOR)'" \