Switch from allegro backend to SDL backend for android build.
[fltk_mvc_template.git] / _template / src / Makefile
index ae9b9b5..bd85c50 100644 (file)
@@ -80,6 +80,12 @@ ANDROID_ARCH=arm
 ANDROID_ARCH_VER=armeabi-v7a
 ANDROID_COMPILER_PREFIX=arm-linux-androideabi
 
+# liballegro.so or libSDL2.so
+ANDROID_BACKEND=libSDL2.so
+
+# liballeg or libsdl
+ANDROID_BACKEND_JAVA=libsdl
+
 # dependent on values above
 ANDROID_PLATORM=android-$(ANDROID_PLATORM_VERSION)
 ANDROID_CP=$(ANDROID_SDK_ROOT)/platforms/$(ANDROID_PLATORM)/android.jar
@@ -119,7 +125,7 @@ LIBDIR_ANDROID += -L$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(ANDRO
 CFLAGS_ANDROID  = $(CFLAGS) --sysroot=$(ANDROID_NDK_ROOT)/platforms/$(ANDROID_PLATORM)/arch-$(ANDROID_ARCH) -D_ANDROID
 RESINC_ANDROID = assets
 LDFLAGS_ANDROID  =  $(LDFLAGS) -shared --sysroot=$(ANDROID_NDK_ROOT)/platforms/$(ANDROID_PLATORM)/arch-$(ANDROID_ARCH)
-LIB_ANDROID  = $(LIB) -lc++ -lNX11 -lnano-X -lfreetype -lm -Wl,-Bdynamic -lallegro -lz
+LIB_ANDROID  = $(LIB) -lc++ -lNX11 -lnano-X -lfreetype -lm -Wl,-Bdynamic -lSDL2 -lz
 RESLIST_ANDROID=$(shell find $(RESINC_ANDROID) -type f -follow)
 
 ###################################
@@ -431,9 +437,8 @@ before_android_apk:
        test -d $(GENDIR_ANDROID) || mkdir -p $(GENDIR_ANDROID)
        test -d $(CLASSDIR_ANDROID) || mkdir -p $(CLASSDIR_ANDROID)
        test -d $(ANDROID_SRC)/res/mipmap-hdpi || mkdir -p $(ANDROID_SRC)/res/mipmap-hdpi
-       test -d $(ANDROID_SRC)/java/liballeg || mkdir -p $(ANDROID_SRC)/java/liballeg
-       cp -r $(WORKDIR)/../lib/android_arm/liballeg/* $(ANDROID_SRC)/java/liballeg
-       cp $(WORKDIR)/../lib/android_arm/liballegro.so $(ANDROID_SRC)/lib/$(ANDROID_ARCH_VER)/
+       cp -r $(WORKDIR)/../lib/android_arm/$(ANDROID_BACKEND_JAVA) $(ANDROID_SRC)/java
+       cp -f $(WORKDIR)/../lib/android_arm/$(ANDROID_BACKEND) $(ANDROID_SRC)/lib/$(ANDROID_ARCH_VER)/
        cp $(WORKDIR)/appinfo/Icon.png $(ANDROID_SRC)/res/mipmap-hdpi/ic_launcher.png
        $(AAPT) package -f -m -J $(GENDIR_ANDROID) -M $(ANDROID_SRC)/AndroidManifest.xml -S $(ANDROID_SRC)/res -I $(ANDROID_CP)
 
@@ -449,7 +454,7 @@ out_apk:
        $(AAPT) package -f -M $(ANDROID_SRC)/AndroidManifest.xml -S $(ANDROID_SRC)/res -I $(ANDROID_CP) -F $(GENDIR_ANDROID)/$(PROJNAME).apk.unaligned
        cd $(GENDIR_ANDROID) && $(AAPT) add $(GENDIR_ANDROID)/$(PROJNAME).apk.unaligned classes.dex
        cd $(ANDROID_SRC) && $(AAPT) add -v $(GENDIR_ANDROID)/$(PROJNAME).apk.unaligned lib/$(ANDROID_ARCH_VER)/lib$(PROJNAME).so
-       cd $(ANDROID_SRC) && $(AAPT) add -v $(GENDIR_ANDROID)/$(PROJNAME).apk.unaligned lib/$(ANDROID_ARCH_VER)/liballegro.so
+       cd $(ANDROID_SRC) && $(AAPT) add -v $(GENDIR_ANDROID)/$(PROJNAME).apk.unaligned lib/$(ANDROID_ARCH_VER)/$(ANDROID_BACKEND)
 
 # pack found ressources into apk
 $(RESLIST_ANDROID): 
@@ -461,6 +466,7 @@ clean_android_apk:
        rm -rf $(GENDIR_ANDROID)
        rm -rf $(CLASSDIR_ANDROID)
        rm -rf $(ANDROID_SRC)/java/liballeg
+       rm -rf $(ANDROID_SRC)/java/libsdl
        rm -rf $(ANDROID_SRC)/res/mipmap-hdpi
 
 # target to install apk