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 JNILIBSDIR=$(BUILDDIR)/android/jniLibs
18 SODEST=$(JNILIBSDIR)/$(ANDROID_APP_ABI)
19 OBJLOCAL=$(BUILDDIR)/android/obj/local/$(ANDROID_APP_ABI)
25 local.properties: $(BUILDDIR)/config_host.mk
26 echo sdk.dir=$(ANDROID_SDK_HOME) >local.properties
29 # Build / link the single .so for this app
32 ALL_STATIC_LIBS := $(shell $(SRCDIR)/bin/lo-all-static-libs)
54 $(addprefix -l,$(strip \
55 $(if $(ENABLE_JAVA),juh) \
57 -Wl,--no-whole-archive
60 $(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS)
63 $(CXX) -fuse-ld=gold -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 $(if $(filter-out arm64-v8a x86_64,$(ANDROID_APP_ABI)),-landroid_support) $(if $(filter armeabi-v7a,$(ANDROID_APP_ABI)),-lunwind) $(addprefix -l,$(NSSLIBS)) -lGLESv2 -landroid -ljnigraphics -llog -lz
65 $(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
67 $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so
68 #to keep some symbols, eg.: $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so -w -K 'Java*'
70 $(SODEST)/nss-libraries :
72 $(foreach lib,$(NSSLIBS),$(STRIP) -o $(SODEST)/lib$(lib).so $(INSTDIR)/$(LIBO_LIB_FOLDER)/lib$(lib).so;)
74 $(SODEST)/libc++_shared.so : $(ANDROID_NDK_HOME)/sources/cxx-stl/llvm-libc++/libs/$(ANDROID_APP_ABI)/libc++_shared.so
78 link-so: $(SODEST)/liblo-native-code.so $(SODEST)/nss-libraries $(SODEST)/libc++_shared.so
80 # If you reinstall an app several times *on the emulator*, even if you
81 # uninstall it between, disk space seems to leak that won't get recycled until
82 # you stop and start... No idea if this holds for a device, too. (And you
83 # can't "stop" a device anyway.)
86 $(ANDROID_SDK_HOME)/platform-tools/adb shell stop && $(ANDROID_SDK_HOME)/platform-tools/adb shell start && sleep 10
88 # build-host specific stuff (build paths and the like) to keep build.gradle static
89 liboSettings.gradle: $(BUILDDIR)/config_build.mk $(BUILDDIR)/config_host.mk
92 echo "// created by Makefile.shared - your changes will be overridden" \
94 && echo " liboSrcRoot = '$(SRC_ROOT)'" \
95 && echo " liboJniLibsdir = '$(JNILIBSDIR)'" \
96 && echo " liboWorkdir = '$(WORKDIR)'" \
97 && echo " liboInstdir = '$(INSTDIR)'" \
98 && echo " liboEtcFolder = '$(LIBO_ETC_FOLDER)'" \
99 && echo " liboUreMiscFolder = '$(LIBO_URE_MISC_FOLDER)'" \
100 && echo " liboSharedResFolder = '$(LIBO_SHARE_RESOURCE_FOLDER)'" \
101 && echo " liboUREJavaFolder = '$(LIBO_URE_SHARE_JAVA_FOLDER)'" \
102 && echo " liboShareJavaFolder = '$(LIBO_SHARE_JAVA_FOLDER)'" \
103 && echo " liboExampleDocument = '$(if $(exampleDocument),$(exampleDocument),$(SRC_ROOT)/android/default-document/example.odt)'" \
104 && echo " liboVersionMajor = '$(LIBO_VERSION_MAJOR)'" \
105 && echo " liboVersionMinor = '$(LIBO_VERSION_MINOR)'" \
106 && echo " liboGitFullCommit = '$(shell cd $(SRCDIR) && git log -1 --format=%H)'" \
108 && echo "android.defaultConfig {" \
109 && echo " applicationId '$(ANDROID_PACKAGE_NAME)'" \
110 && echo " versionCode project.hasProperty('cmdVersionCode') ? cmdVersionCode.toInteger() : $(if $(versionCode),$(versionCode),1)" \
111 && 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)'" \