In android it is not that easily possible to set environment variables, so we hardcro...
[fltk_mvc_template.git] / _template / packages / gl4es1.1.0 / Makefile
1 ############################################################################
2 # Workfile: Makefile
3 # Author: Daniel Giritzer, S1810567004 (daniel@giritzer.eu)
4 # Date: 03.12.2018
5 # Description: Universal Makefile for Unix based Operating Systems
6 ############################################################################
7 WORKDIR = $(shell pwd)
8
9 # Add android ndk toolchain
10 ANDROID_NDK_HOME=/usr/lib/android-ndk
11 export PATH := $(ANDROID_NDK_HOME)/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/:$(PATH)
12
13 all: unpack android_arm
14
15 .PHONY: unpack
16 unpack:
17         unzip -o gl4es-1.1.0.zip
18
19 .PHONY: android_arm
20 android_arm:
21         export NDK_PROJECT_PATH=$(WORKDIR); \
22         cp -r $(WORKDIR)/gl4es-1.1.0 $(WORKDIR)/jni; \
23 #       sed -i -e '/LOCAL_CFLAGS += -DNOX11/ a  LOCAL_CFLAGS += -DNOEGL ' $(WORKDIR)/jni/Android.mk; \
24         sed -i -e '/LOCAL_CFLAGS += -DNOX11/ a  LOCAL_CFLAGS += -DUSE_FBIO ' $(WORKDIR)/jni/Android.mk; \
25         sed -i -e 's~-DNOX11~-I$(WORKDIR)/../../lib_include/android_arm~g' $(WORKDIR)/jni/Android.mk; \
26 #       sed -i -e 's/BUILD_STATIC_LIBRARY/BUILD_SHARED_LIBRARY/g' $(WORKDIR)/jni/Android.mk; \
27         sed -i -e 's/#LOCAL_CFLAGS += -DDEFAULT_ES=2/LOCAL_CFLAGS += -DDEFAULT_ES=2/g' $(WORKDIR)/jni/Android.mk; \
28 #       sed -i -e 's/#LOCAL_CFLAGS += -DNO_INIT_CONSTRUCTOR/LOCAL_CFLAGS += -DNO_INIT_CONSTRUCTOR/g' $(WORKDIR)/jni/Android.mk; \
29         sed -i -e 's/getenv("LIBGL_FB")/ "3"/g' $(WORKDIR)/jni/src/gl/init.c; \
30         sed -i -e '/src\/glx\/streaming.c.*/ a  src\/glx\/rpi.c src\/glx\/utils.c' $(WORKDIR)/jni/Android.mk; \
31         echo "APP_ABI := armeabi-v7a"> $(WORKDIR)/jni/Application.mk; \
32         /usr/lib/android-ndk/ndk-build
33         mkdir -p $(WORKDIR)/../../lib_include/android_arm
34         mkdir -p $(WORKDIR)/../../lib/android_arm
35         cp -rf $(WORKDIR)/gl4es-1.1.0/include/* $(WORKDIR)/../../lib_include/android_arm
36         cp $(WORKDIR)/obj/local/armeabi-v7a/libGL.a $(WORKDIR)/../../lib/android_arm
37
38 .PHONY: clean
39 clean:
40         rm -rf $(WORKDIR)/gl4es-1.1.0
41         rm -rf $(WORKDIR)/jni
42         rm -rf $(WORKDIR)/obj
43