Fix allegro 32Bit/64Bit build
[fltk_mvc_template.git] / _template / packages / allegro5 / 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 all: unpack android_arm android_arm64
10
11 .PHONY: unpack
12 unpack:
13         tar xvzf allegro-5.2.4.0.tar.gz
14         find $(WORKDIR)/allegro-5.2.4.0 -name build.gradle -exec sed -i -e '/compileSdkVersion.*/a buildToolsVersion "25.0.0"' {} \;
15         find $(WORKDIR)/allegro-5.2.4.0 -name build.gradle -exec sed -i -e 's/compileSdkVersion.*/compileSdkVersion 23/g' {} \;
16         find $(WORKDIR)/allegro-5.2.4.0 -name build.gradle -exec sed -i -e 's/targetSdkVersion.*/targetSdkVersion 23/g' {} \;
17         sed -i -e 's/classpath "com.android.tools.build:gradle:.*/classpath "com.android.tools.build:gradle:2.3.3"/g' $(WORKDIR)/allegro-5.2.4.0/android/gradle_project/build.gradle
18         sed -i -e '/google()/a maven { url "file:\/\/\/usr\/share\/maven-repo" }' $(WORKDIR)/allegro-5.2.4.0/android/gradle_project/build.gradle
19
20 .PHONY: android_arm
21 android_arm:
22         cd $(WORKDIR)/allegro-5.2.4.0; \
23         set -e; \
24         . $(WORKDIR)/setenv.sh && \
25         mkdir -p ./buildandroid; \
26         cd ./buildandroid; \
27         cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-android.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_TARGET=android-15 -DARM_TARGETS=armeabi-v7a -DSHARED=false -DWANT_EXAMPLES=false -DWANT_DEMO=false  -DWANT_TESTS=false; \
28         make -j6
29         mkdir -p $(WORKDIR)/../../include
30         mkdir -p $(WORKDIR)/../../lib/android_arm
31         cp -rf $(WORKDIR)/allegro-5.2.4.0/include/* $(WORKDIR)/../../include
32         cp -rf $(WORKDIR)/allegro-5.2.4.0/buildandroid/include/* $(WORKDIR)/../../include
33         rename "s/-static//g" $(WORKDIR)/allegro-5.2.4.0/buildandroid/lib/*.a
34         cp -rf $(WORKDIR)/allegro-5.2.4.0/buildandroid/lib/*.a $(WORKDIR)/../../lib/android_arm
35
36 .PHONY: android_arm64
37 android_arm64:
38         cd $(WORKDIR)/allegro-5.2.4.0; \
39         set -e; \
40         . $(WORKDIR)/setenv64.sh && \
41         mkdir -p ./buildandroid64; \
42         cd ./buildandroid64; \
43         cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-android.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_TARGET=android-21 -DARM_TARGETS=arm64-v8a -DSHARED=false  -DWANT_EXAMPLES=false -DWANT_DEMO=false  -DWANT_TESTS=false; \
44         make -j6
45         mkdir -p $(WORKDIR)/../../include
46         mkdir -p $(WORKDIR)/../../lib/android_arm64
47         cp -rf $(WORKDIR)/allegro-5.2.4.0/include/* $(WORKDIR)/../../include
48         cp -rf $(WORKDIR)/allegro-5.2.4.0/buildandroid64/include/* $(WORKDIR)/../../include
49         rename "s/-static//g" $(WORKDIR)/allegro-5.2.4.0/buildandroid64/lib/*.a
50         cp -rf $(WORKDIR)/allegro-5.2.4.0/buildandroid64/lib/*.a $(WORKDIR)/../../lib/android_arm64
51
52 .PHONY: clean
53 clean:
54         rm -rf allegro-5.2.4.0