Switch from allegro backend to SDL backend for android build.
[fltk_mvc_template.git] / _template / src / Makefile
index 60e62b6..bd85c50 100644 (file)
@@ -12,7 +12,7 @@ WORKDIR = $(shell pwd)
 SOURCES := $(shell ls *.cxx)
 PROJNAME = _template
 LIBDIR =
-INC = -I$(WORKDIR)/../include
+INC = -I$(WORKDIR)/../include/
 LDFLAGS = -std=c++11 -static-libstdc++ -static-libgcc -Wl,-Bstatic
 CFLAGS = -Wall -fexceptions -std=c++11 -static-libstdc++ -static-libgcc
 LIB = -lfltk_images -lfltk_png -lfltk_z -lfltk_jpeg -lfltk -lfreetype
@@ -26,7 +26,7 @@ AR_LINUX32 = ar
 LD_LINUX32 = g++
 WINDRES_LINUX32 =
 
-INC_LINUX32 = $(INC)
+INC_LINUX32 = $(INC) -I$(WORKDIR)/../lib_include/linux32
 LIBDIR_LINUX32 = -L$(WORKDIR)/../lib/linux32
 CFLAGS_LINUX32 = -m32 $(CFLAGS)
 RESINC_LINUX32 =
@@ -42,7 +42,7 @@ AR_LINUXARM = arm-linux-gnueabihf-ar
 LD_LINUXARM = arm-linux-gnueabihf-g++
 WINDRES_LINUXARM =
 
-INC_LINUXARM = $(INC)
+INC_LINUXARM = $(INC) -I$(WORKDIR)/../lib_include/linux_arm
 LIBDIR_LINUXARM = -L$(WORKDIR)/../lib/linux_arm
 CFLAGS_LINUXARM = $(CFLAGS)
 RESINC_LINUXARM =
@@ -58,7 +58,7 @@ AR_WIN = i686-w64-mingw32-ar
 LD_WIN = i686-w64-mingw32-g++
 WINDRES_WIN = i686-w64-mingw32-windres
 
-INC_WIN = $(INC)
+INC_WIN = $(INC) -I$(WORKDIR)/../lib_include/mingw32
 LIBDIR_WIN = -L$(WORKDIR)/../lib/mingw32
 CFLAGS_WIN = -m32  $(CFLAGS) -mwindows -DWIN32 -D_WIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 RESINC_WIN = $(WORKDIR)/appinfo
@@ -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
@@ -110,16 +116,16 @@ AR_ANDROID = $(TOOLCHAIN_ANDROID_PATH)/$(ANDROID_COMPILER_PREFIX)-ar
 LD_ANDROID = $(TOOLCHAIN_ANDROID_PATH)/$(ANDROID_COMPILER_PREFIX)-g++
 WINDRES_ANDROID =
 
-INC_ANDROID=$(INC) -I$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libcxx/include
+INC_ANDROID=$(INC) -I$(WORKDIR)/../lib_include/android_arm
+INC_ANDROID+=-I$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libcxx/include
 INC_ANDROID+=-I$(ANDROID_NDK_ROOT)/sources/android/support/include
 INC_ANDROID+=-I$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/libcxxabi/include
-INC_ANDROID+=-I$(WORKDIR)/../include/nanox
 LIBDIR_ANDROID = -L$(WORKDIR)/../lib/android_$(ANDROID_ARCH)
 LIBDIR_ANDROID += -L$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(ANDROID_ARCH_VER)
 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
+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