• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# GNU Make makefile for building static libraries for use with the Android NDK
3# Copyright (C) 2016, Alexander Bruines <alexander.bruines@gmail.com>
4#
5# This file is made available under the Creative Commons CC0 1.0
6# Universal Public Domain Dedication.
7#
8# The person who associated a work with this deed has dedicated
9# the work to the public domain by waiving all of his or her rights
10# to the work worldwide under copyright law, including all related
11# and neighboring rights, to the extent allowed by law. You can copy,
12# modify, distribute and perform the work, even for commercial purposes,
13# all without asking permission.
14#
15# The test apps are intended to be adapted for use in your code, which
16# may be proprietary.  So unlike the library itself, they are licensed
17# Public Domain.
18#
19
20#
21# This makefile is fully intergrated with this Android Studio project and
22# it will be called automaticaly when you build the project with Gradle.
23#
24# The source packages for the libraries will be automaticaly downloaded.
25# Alternativly you can provide your own sources by placing the following
26# files in the 'jni' directory:
27#
28#  zlib-1.2.8.tar.gz
29#  openssl-1.0.2g.tar.gz
30#  libwebsockets.tar.gz
31#
32# This makefile was tested with the latest NDK/SDK and Android Studio at the
33# time of this writing. As these software packages evolve changes to this
34# makefile may be needed or it may become obselete...
35#
36# This makefile was made for use in Linux but you may be able to edit it
37# and make it work under Windows.
38#
39# At least on Debian, building openssl requires package xutils-dev
40# for makedepend. Ofcourse the standard development packages must also be
41# installed, but xutils-dev is not that obvious in this case...
42#
43# Makedepend will most likely print a lot of warnings during the 'make depend'
44# stage of building openssl. In this case these warnings can be safely ignored.
45#
46
47# Include Application.mk but do not complain if it is not found
48#
49ifeq ($(MAKE_NO_INCLUDES),)
50-include Application.mk
51endif
52
53# Location of the NDK.
54#
55ifeq ($(NDK_ROOT),)
56NDK_ROOT := /opt/Android/SDK/ndk-bundle
57endif
58
59# Select the ABIs to compile for
60#
61NDK_APP_ABI = $(APP_ABI)
62ifeq ($(NDK_APP_ABI),)
63# Set to 'all' if APP_ABI is undefined
64NDK_APP_ABI = all
65endif
66ifeq ($(NDK_APP_ABI),all)
67# Translate 'all' to the individual targets
68NDK_APP_ABI = armeabi armeabi-v7a arm64-v8a mips mips64 x86 x86_64
69else
70# Use the targets from APP_ABI
71NDK_APP_ABI = $(APP_ABI)
72endif
73
74# Select the Android platform to compile for
75#
76ifeq ($(APP_PLATFORM),)
77# use a level that supports all specified ABIs if none was specified
78APP_PLATFORM = android-21
79endif
80
81NDK_MAKE_TOOLCHAIN := $(NDK_ROOT)/build/tools/make_standalone_toolchain.py
82
83#
84# The source packages we want/need
85# Zlib and openssl should be defined in Application.mk, libwebsockets is
86# cloned from github
87#
88
89ifeq ($(ZLIB_VERSION),)
90ZLIB_VERSION := 1.2.8
91endif
92ifeq ($(OPENSSL_VERSION),)
93OPENSSL_VERSION := 1.0.2g
94endif
95
96ifeq ($(ZLIB_TGZ_SOURCE),)
97ZLIB_TGZ_SOURCE := zlib-$(ZLIB_VERSION).tar.gz
98endif
99ifeq ($(OPENSSL_TGZ_SOURCE),)
100OPENSSL_TGZ_SOURCE := openssl-$(OPENSSL_VERSION).tar.gz
101endif
102LIBWEBSOCKETS_TGZ_SOURCE := libwebsockets.tar.gz
103
104# The names of the directories in the source tgz files
105ZLIB_DIR := $(basename $(basename $(ZLIB_TGZ_SOURCE)))
106OPENSSL_DIR := $(basename $(basename $(OPENSSL_TGZ_SOURCE)))
107LIBWEBSOCKETS_DIR := $(basename $(basename $(LIBWEBSOCKETS_TGZ_SOURCE)))
108
109# The URLs used to fetch the source tgz files
110ZLIB_TGZ_URL := http://prdownloads.sourceforge.net/libpng/$(ZLIB_TGZ_SOURCE)
111OPENSSL_TGZ_URL := https://openssl.org/source/$(OPENSSL_TGZ_SOURCE)
112ifeq ($(LIBWEBSOCKETS_GIT_URL),)
113LIBWEBSOCKETS_GIT_URL := https://github.com/warmcat/libwebsockets.git
114endif
115
116# These values are the same as the values for $TARGET_ARCH_ABI in Android.mk
117# This way 'make $TARGET_ARCH_ABI' builds libraries for that ABI.
118# This is also the name for the directory where the libraries are installed to.
119#
120TARGET_X86 := x86
121TARGET_X86_64 := x86_64
122TARGET_ARM := armeabi
123TARGET_ARM_V7A := armeabi-v7a
124TARGET_ARM_V7A_HARD := armeabi-v7a-hard
125TARGET_ARM64_V8A := arm64-v8a
126TARGET_MIPS := mips
127TARGET_MIPS64 := mips64
128
129# The Android NDK API version to build the libraries with.
130#
131#  android-9 ... android-19 support arm mips and x86
132#  android-21 and higher also support arm64 mips64 and x86_64
133#
134# These should be set to the same value as APP_PLATFORM (Application.mk)
135#
136# http://developer.android.com/ndk/guides/stable_apis.html
137#
138# If you change these or APP_PLATFORM you must do a 'make clean'
139#
140# Note:
141# libraries compiled for android-21 and upwards are incompatible with devices below that version!
142# http://stackoverflow.com/questions/28740315/android-ndk-getting-java-lang-unsatisfiedlinkerror-dlopen-failed-cannot-loca
143#
144TARGET_X86_NDK_API := $(subst android-,,$(APP_PLATFORM))
145TARGET_X86_64_NDK_API := $(subst android-,,$(APP_PLATFORM))
146TARGET_ARM_NDK_API := $(subst android-,,$(APP_PLATFORM))
147TARGET_ARM_V7A_NDK_API := $(subst android-,,$(APP_PLATFORM))
148TARGET_ARM_V7A_HARD_NDK_API := $(subst android-,,$(APP_PLATFORM))
149TARGET_ARM64_V8A_NDK_API := $(subst android-,,$(APP_PLATFORM))
150TARGET_MIPS_NDK_API := $(subst android-,,$(APP_PLATFORM))
151TARGET_MIPS64_NDK_API := $(subst android-,,$(APP_PLATFORM))
152
153# The configure arguments to pass to the OpenSSL Configure script
154# (--prefix and --openssldir are added automaticaly).
155# (note: use no-asm on x86 and x86_64 to generate fully position independent code)
156#
157# x86
158TARGET_X86_OPENSSL_CONFIG_TARGET := android-x86
159TARGET_X86_OPENSSL_CONFIG := no-asm no-shared no-idea no-mdc2 no-rc5 no-zlib no-zlib-dynamic enable-tlsext no-ssl2 no-ssl3 enable-ec enable-ecdh enable-ecp
160# x86_64
161TARGET_X86_64_OPENSSL_CONFIG_TARGET := linux-x86_64
162TARGET_X86_64_OPENSSL_CONFIG := no-asm no-shared no-idea no-mdc2 no-rc5 no-zlib no-zlib-dynamic enable-tlsext no-ssl2 no-ssl3 enable-ec enable-ecdh enable-ecp enable-ec_nistp_64_gcc_128
163# armeabi
164TARGET_ARM_OPENSSL_CONFIG_TARGET := android
165TARGET_ARM_OPENSSL_CONFIG := no-shared no-idea no-mdc2 no-rc5 no-zlib no-zlib-dynamic enable-tlsext no-ssl2 no-ssl3 enable-ec enable-ecdh enable-ecp
166# armeabi-v7a
167TARGET_ARM_V7A_OPENSSL_CONFIG_TARGET := android-armv7
168TARGET_ARM_V7A_OPENSSL_CONFIG := no-shared no-idea no-mdc2 no-rc5 no-zlib no-zlib-dynamic enable-tlsext no-ssl2 no-ssl3 enable-ec enable-ecdh enable-ecp
169# armeabi-v7a-hard
170TARGET_ARM_V7A_HARD_OPENSSL_CONFIG_TARGET := android-armv7
171TARGET_ARM_V7A_HARD_OPENSSL_CONFIG := no-shared no-idea no-mdc2 no-rc5 no-zlib no-zlib-dynamic enable-tlsext no-ssl2 no-ssl3 enable-ec enable-ecdh enable-ecp
172# arm64-v8a
173TARGET_ARM64_V8A_OPENSSL_CONFIG_TARGET := android
174TARGET_ARM64_V8A_OPENSSL_CONFIG := no-shared no-idea no-mdc2 no-rc5 no-zlib no-zlib-dynamic enable-tlsext no-ssl2 no-ssl3 enable-ec enable-ecdh enable-ecp
175# mips
176TARGET_MIPS_OPENSSL_CONFIG_TARGET := android-mips
177TARGET_MIPS_OPENSSL_CONFIG := no-shared no-idea no-mdc2 no-rc5 no-zlib no-zlib-dynamic enable-tlsext no-ssl2 no-ssl3 enable-ec enable-ecdh enable-ecp
178# mips64
179TARGET_MIPS64_OPENSSL_CONFIG_TARGET := android
180TARGET_MIPS64_OPENSSL_CONFIG := no-shared no-idea no-mdc2 no-rc5 no-zlib no-zlib-dynamic enable-tlsext no-ssl2 no-ssl3 enable-ec enable-ecdh enable-ecp
181
182# The cmake configuration options for libwebsockets per target ABI,
183# --prefix and openssl library/header paths are set automaticaly and
184# the location of zlib should be picked up by CMake
185# x86
186TARGET_X86_LWS_OPTIONS = \
187 -DCMAKE_C_COMPILER=$(shell pwd)/$(TOOLCHAIN_X86)/bin/$(TOOLCHAIN_X86_PREFIX)-gcc \
188 -DCMAKE_AR=$(shell pwd)/$(TOOLCHAIN_X86)/bin/$(TOOLCHAIN_X86_PREFIX)-ar \
189 -DCMAKE_RANLIB=$(shell pwd)/$(TOOLCHAIN_X86)/bin/$(TOOLCHAIN_X86_PREFIX)-ranlib \
190 -DCMAKE_C_FLAGS="$$CFLAGS" \
191 -DLWS_WITH_SHARED=OFF \
192 -DLWS_WITH_STATIC=ON \
193 -DLWS_WITHOUT_DAEMONIZE=ON \
194 -DLWS_WITHOUT_TESTAPPS=ON \
195 -DLWS_IPV6=OFF \
196 -DLWS_WITH_BUNDLED_ZLIB=OFF \
197 -DLWS_WITH_SSL=ON  \
198 -DLWS_WITH_HTTP2=ON \
199 -DCMAKE_BUILD_TYPE=Release
200# x86_64
201TARGET_X86_64_LWS_OPTIONS = \
202 -DCMAKE_C_COMPILER=$(shell pwd)/$(TOOLCHAIN_X86_64)/bin/$(TOOLCHAIN_X86_64_PREFIX)-gcc \
203 -DCMAKE_AR=$(shell pwd)/$(TOOLCHAIN_X86_64)/bin/$(TOOLCHAIN_X86_64_PREFIX)-ar \
204 -DCMAKE_RANLIB=$(shell pwd)/$(TOOLCHAIN_X86_64)/bin/$(TOOLCHAIN_X86_64_PREFIX)-ranlib \
205 -DCMAKE_C_FLAGS="$$CFLAGS" \
206 -DLWS_WITH_SHARED=OFF \
207 -DLWS_WITH_STATIC=ON \
208 -DLWS_WITHOUT_DAEMONIZE=ON \
209 -DLWS_WITHOUT_TESTAPPS=ON \
210 -DLWS_IPV6=OFF \
211 -DLWS_WITH_BUNDLED_ZLIB=OFF \
212 -DLWS_WITH_SSL=ON  \
213 -DLWS_WITH_HTTP2=ON \
214 -DCMAKE_BUILD_TYPE=Release
215# armeabi
216TARGET_ARM_LWS_OPTIONS = \
217 -DCMAKE_C_COMPILER=$(shell pwd)/$(TOOLCHAIN_ARM)/bin/$(TOOLCHAIN_ARM_PREFIX)-gcc \
218 -DCMAKE_AR=$(shell pwd)/$(TOOLCHAIN_ARM)/bin/$(TOOLCHAIN_ARM_PREFIX)-ar \
219 -DCMAKE_RANLIB=$(shell pwd)/$(TOOLCHAIN_ARM)/bin/$(TOOLCHAIN_ARM_PREFIX)-ranlib \
220 -DCMAKE_C_FLAGS="$$CFLAGS" \
221 -DLWS_WITH_SHARED=OFF \
222 -DLWS_WITH_STATIC=ON \
223 -DLWS_WITHOUT_DAEMONIZE=ON \
224 -DLWS_WITHOUT_TESTAPPS=ON \
225 -DLWS_IPV6=OFF \
226 -DLWS_WITH_BUNDLED_ZLIB=OFF \
227 -DLWS_WITH_SSL=ON  \
228 -DLWS_WITH_HTTP2=ON \
229 -DCMAKE_BUILD_TYPE=Release
230# armeabi-v7a
231TARGET_ARM_V7A_LWS_OPTIONS = \
232 -DCMAKE_C_COMPILER=$(shell pwd)/$(TOOLCHAIN_ARM_V7A)/bin/$(TOOLCHAIN_ARM_V7A_PREFIX)-gcc \
233 -DCMAKE_AR=$(shell pwd)/$(TOOLCHAIN_ARM_V7A)/bin/$(TOOLCHAIN_ARM_V7A_PREFIX)-ar \
234 -DCMAKE_RANLIB=$(shell pwd)/$(TOOLCHAIN_ARM_V7A)/bin/$(TOOLCHAIN_ARM_V7A_PREFIX)-ranlib \
235 -DCMAKE_C_FLAGS="$$CFLAGS" \
236 -DLWS_WITH_SHARED=OFF \
237 -DLWS_WITH_STATIC=ON \
238 -DLWS_WITHOUT_DAEMONIZE=ON \
239 -DLWS_WITHOUT_TESTAPPS=ON \
240 -DLWS_IPV6=OFF \
241 -DLWS_WITH_BUNDLED_ZLIB=OFF \
242 -DLWS_WITH_SSL=ON  \
243 -DLWS_WITH_HTTP2=ON \
244 -DCMAKE_BUILD_TYPE=Release
245# armeabi-v7a-hard
246TARGET_ARM_V7A_HARD_LWS_OPTIONS = \
247 -DCMAKE_C_COMPILER=$(shell pwd)/$(TOOLCHAIN_ARM_V7A_HARD)/bin/$(TOOLCHAIN_ARM_V7A_HARD_PREFIX)-gcc \
248 -DCMAKE_AR=$(shell pwd)/$(TOOLCHAIN_ARM_V7A_HARD)/bin/$(TOOLCHAIN_ARM_V7A_HARD_PREFIX)-ar \
249 -DCMAKE_RANLIB=$(shell pwd)/$(TOOLCHAIN_ARM_V7A_HARD)/bin/$(TOOLCHAIN_ARM_V7A_HARD_PREFIX)-ranlib \
250 -DCMAKE_C_FLAGS="$$CFLAGS" \
251 -DLWS_WITH_SHARED=OFF \
252 -DLWS_WITH_STATIC=ON \
253 -DLWS_WITHOUT_DAEMONIZE=ON \
254 -DLWS_WITHOUT_TESTAPPS=ON \
255 -DLWS_IPV6=OFF \
256 -DLWS_WITH_BUNDLED_ZLIB=OFF \
257 -DLWS_WITH_SSL=ON  \
258 -DLWS_WITH_HTTP2=ON \
259 -DCMAKE_BUILD_TYPE=Release
260# arm64-v8a
261TARGET_ARM64_V8A_LWS_OPTIONS = \
262 -DCMAKE_C_COMPILER=$(shell pwd)/$(TOOLCHAIN_ARM64_V8A)/bin/$(TOOLCHAIN_ARM64_V8A_PREFIX)-gcc \
263 -DCMAKE_AR=$(shell pwd)/$(TOOLCHAIN_ARM64_V8A)/bin/$(TOOLCHAIN_ARM64_V8A_PREFIX)-ar \
264 -DCMAKE_RANLIB=$(shell pwd)/$(TOOLCHAIN_ARM64_V8A)/bin/$(TOOLCHAIN_ARM64_V8A_PREFIX)-ranlib \
265 -DCMAKE_C_FLAGS="$$CFLAGS" \
266 -DLWS_WITH_SHARED=OFF \
267 -DLWS_WITH_STATIC=ON \
268 -DLWS_WITHOUT_DAEMONIZE=ON \
269 -DLWS_WITHOUT_TESTAPPS=ON \
270 -DLWS_IPV6=OFF \
271 -DLWS_WITH_BUNDLED_ZLIB=OFF \
272 -DLWS_WITH_SSL=ON  \
273 -DLWS_WITH_HTTP2=ON \
274 -DCMAKE_BUILD_TYPE=Release
275# mips
276TARGET_MIPS_LWS_OPTIONS = \
277 -DCMAKE_C_COMPILER=$(shell pwd)/$(TOOLCHAIN_MIPS)/bin/$(TOOLCHAIN_MIPS_PREFIX)-gcc \
278 -DCMAKE_AR=$(shell pwd)/$(TOOLCHAIN_MIPS)/bin/$(TOOLCHAIN_MIPS_PREFIX)-ar \
279 -DCMAKE_RANLIB=$(shell pwd)/$(TOOLCHAIN_MIPS)/bin/$(TOOLCHAIN_MIPS_PREFIX)-ranlib \
280 -DCMAKE_C_FLAGS="$$CFLAGS" \
281 -DLWS_WITH_SHARED=OFF \
282 -DLWS_WITH_STATIC=ON \
283 -DLWS_WITHOUT_DAEMONIZE=ON \
284 -DLWS_WITHOUT_TESTAPPS=ON \
285 -DLWS_IPV6=OFF \
286 -DLWS_WITH_BUNDLED_ZLIB=OFF \
287 -DLWS_WITH_SSL=ON  \
288 -DLWS_WITH_HTTP2=ON \
289 -DCMAKE_BUILD_TYPE=Release
290# mips64
291TARGET_MIPS64_LWS_OPTIONS = \
292 -DCMAKE_C_COMPILER=$(shell pwd)/$(TOOLCHAIN_MIPS64)/bin/$(TOOLCHAIN_MIPS64_PREFIX)-gcc \
293 -DCMAKE_AR=$(shell pwd)/$(TOOLCHAIN_MIPS64)/bin/$(TOOLCHAIN_MIPS64_PREFIX)-ar \
294 -DCMAKE_RANLIB=$(shell pwd)/$(TOOLCHAIN_MIPS64)/bin/$(TOOLCHAIN_MIPS64_PREFIX)-ranlib \
295 -DCMAKE_C_FLAGS="$$CFLAGS" \
296 -DLWS_WITH_SHARED=OFF \
297 -DLWS_WITH_STATIC=ON \
298 -DLWS_WITHOUT_DAEMONIZE=ON \
299 -DLWS_WITHOUT_TESTAPPS=ON \
300 -DLWS_IPV6=OFF \
301 -DLWS_WITH_BUNDLED_ZLIB=OFF \
302 -DLWS_WITH_SSL=ON  \
303 -DLWS_WITH_HTTP2=ON \
304 -DCMAKE_BUILD_TYPE=Release
305
306#
307# Toolchain configuration
308#
309
310# The directory names for the different toolchains
311TOOLCHAIN_X86 := toolchains/x86
312TOOLCHAIN_X86_64 := toolchains/x86_64
313TOOLCHAIN_ARM := toolchains/arm
314TOOLCHAIN_ARM_V7A := toolchains/arm-v7a
315TOOLCHAIN_ARM_V7A_HARD := toolchains/arm-v7a-hard
316TOOLCHAIN_ARM64_V8A := toolchains/arm64-v8a
317TOOLCHAIN_MIPS := toolchains/mips
318TOOLCHAIN_MIPS64 := toolchains/mips64
319
320# Use APP_STL to determine what STL to use.
321#
322ifeq ($(APP_STL),stlport_static)
323TOOLCHAIN_STL := stlport
324else ifeq ($(APP_STL),stlport_shared)
325TOOLCHAIN_STL := stlport
326else ifeq ($(APP_STL),gnustl_static)
327TOOLCHAIN_STL := gnustl
328else ifeq ($(APP_STL),gnustl_shared)
329TOOLCHAIN_STL := gnustl
330else ifeq ($(APP_STL),c++_static)
331TOOLCHAIN_STL := libc++
332else ifeq ($(APP_STL),c++_shared)
333TOOLCHAIN_STL := libc++
334endif
335
336# The settings to use for the individual toolchains:
337# x86
338TOOLCHAIN_X86_API := $(TARGET_X86_NDK_API)
339TOOLCHAIN_X86_PREFIX := i686-linux-android
340TOOLCHAIN_X86_FLAGS := -march=i686 -msse3 -mstackrealign -mfpmath=sse
341TOOLCHAIN_X86_LINK :=
342TOOLCHAIN_X86_PLATFORM_HEADERS := $(shell pwd)/$(TOOLCHAIN_X86)/sysroot/usr/include
343TOOLCHAIN_X86_PLATFORM_LIBS := $(shell pwd)/$(TOOLCHAIN_X86)/sysroot/usr/lib
344# x86_64
345TOOLCHAIN_X86_64_API := $(TARGET_X86_64_NDK_API)
346TOOLCHAIN_X86_64_PREFIX := x86_64-linux-android
347TOOLCHAIN_X86_64_FLAGS :=
348TOOLCHAIN_X86_64_LINK :=
349TOOLCHAIN_X86_64_PLATFORM_HEADERS := $(shell pwd)/$(TOOLCHAIN_X86_64)/sysroot/usr/include
350TOOLCHAIN_X86_64_PLATFORM_LIBS := $(shell pwd)/$(TOOLCHAIN_X86_64)/sysroot/usr/lib
351# arm
352TOOLCHAIN_ARM_API := $(TARGET_ARM_NDK_API)
353TOOLCHAIN_ARM_PREFIX := arm-linux-androideabi
354TOOLCHAIN_ARM_FLAGS := -mthumb
355TOOLCHAIN_ARM_LINK :=
356TOOLCHAIN_ARM_PLATFORM_HEADERS := $(shell pwd)/$(TOOLCHAIN_ARM)/sysroot/usr/include
357TOOLCHAIN_ARM_PLATFORM_LIBS := $(shell pwd)/$(TOOLCHAIN_ARM)/sysroot/usr/lib
358# arm-v7a
359TOOLCHAIN_ARM_V7A_API := $(TARGET_ARM_V7A_NDK_API)
360TOOLCHAIN_ARM_V7A_PREFIX := arm-linux-androideabi
361TOOLCHAIN_ARM_V7A_FLAGS := -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
362TOOLCHAIN_ARM_V7A_LINK := -march=armv7-a -Wl,--fix-cortex-a8
363TOOLCHAIN_ARM_V7A_PLATFORM_HEADERS :=  $(shell pwd)/$(TOOLCHAIN_ARM_V7A)/sysroot/usr/include
364TOOLCHAIN_ARM_V7A_PLATFORM_LIBS := $(shell pwd)/$(TOOLCHAIN_ARM_V7A)/sysroot/usr/lib
365# arm-v7a-hard
366TOOLCHAIN_ARM_V7A_HARD_API := $(TARGET_ARM_V7A_HARD_NDK_API)
367TOOLCHAIN_ARM_V7A_HARD_PREFIX := arm-linux-androideabi
368TOOLCHAIN_ARM_V7A_HARD_FLAGS := -march=armv7-a -mfpu=vfpv3-d16 -mhard-float -mfloat-abi=hard -D_NDK_MATH_NO_SOFTFP=1
369TOOLCHAIN_ARM_V7A_HARD_LINK := -march=armv7-a -Wl,--fix-cortex-a8 -Wl,--no-warn-mismatch -lm_hard
370TOOLCHAIN_ARM_V7A_HARD_PLATFORM_HEADERS :=  $(shell pwd)/$(TOOLCHAIN_ARM_V7A_HARD)/sysroot/usr/include
371TOOLCHAIN_ARM_V7A_HARD_PLATFORM_LIBS := $(shell pwd)/$(TOOLCHAIN_ARM_V7A_HARD)/sysroot/usr/lib
372# arm64-v8a
373TOOLCHAIN_ARM64_V8A_API := $(TARGET_ARM64_V8A_NDK_API)
374TOOLCHAIN_ARM64_V8A_PREFIX := aarch64-linux-android
375TOOLCHAIN_ARM64_V8A_FLAGS :=
376TOOLCHAIN_ARM64_V8A_LINK :=
377TOOLCHAIN_ARM64_V8A_PLATFORM_HEADERS := $(shell pwd)/$(TOOLCHAIN_ARM64_V8A)/sysroot/usr/include
378TOOLCHAIN_ARM64_V8A_PLATFORM_LIBS := $(shell pwd)/$(TOOLCHAIN_ARM64_V8A)/sysroot/usr/lib
379# mips
380TOOLCHAIN_MIPS_API := $(TARGET_MIPS_NDK_API)
381TOOLCHAIN_MIPS_PREFIX := mipsel-linux-android
382TOOLCHAIN_MIPS_FLAGS :=
383TOOLCHAIN_MIPS_LINK :=
384TOOLCHAIN_MIPS_PLATFORM_HEADERS := $(shell pwd)/$(TOOLCHAIN_MIPS)/sysroot/usr/include
385TOOLCHAIN_MIPS_PLATFORM_LIBS := $(shell pwd)/$(TOOLCHAIN_MIPS)/sysroot/usr/lib
386# mips64
387TOOLCHAIN_MIPS64_API := $(TARGET_MIPS64_NDK_API)
388TOOLCHAIN_MIPS64_PREFIX := mips64el-linux-android
389TOOLCHAIN_MIPS64_FLAGS :=
390TOOLCHAIN_MIPS64_LINK :=
391TOOLCHAIN_MIPS64_PLATFORM_HEADERS := $(shell pwd)/$(TOOLCHAIN_MIPS64)/sysroot/usr/include
392TOOLCHAIN_MIPS64_PLATFORM_LIBS := $(shell pwd)/$(TOOLCHAIN_MIPS64)/sysroot/usr/lib
393
394# Environment variables to set while compiling for each ABI
395# x86
396TOOLCHAIN_X86_ENV = \
397 ANDROID_DEV="$(shell pwd)/$(TOOLCHAIN_X86)/bin" \
398 CC=$(TOOLCHAIN_X86_PREFIX)-gcc \
399 CXX=$(TOOLCHAIN_X86_PREFIX)-g++ \
400 LINK=$(TOOLCHAIN_X86_PREFIX)-g++ \
401 LD=$(TOOLCHAIN_X86_PREFIX)-ld \
402 AR=$(TOOLCHAIN_X86_PREFIX)-ar \
403 RANLIB=$(TOOLCHAIN_X86_PREFIX)-ranlib \
404 STRIP=$(TOOLCHAIN_X86_PREFIX)-strip \
405 ARCH_FLAGS="$(TOOLCHAIN_X86_FLAGS)" \
406 ARCH_LINK="$(TOOLCHAIN_X86_LINK)" \
407 CPPFLAGS="-I. $(TOOLCHAIN_X86_FLAGS) -I$(TOOLCHAIN_X86_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
408 CXXFLAGS="-I. $(TOOLCHAIN_X86_FLAGS) -I$(TOOLCHAIN_X86_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions" \
409 CFLAGS="-I. $(TOOLCHAIN_X86_FLAGS) -I$(TOOLCHAIN_X86_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
410 LDFLAGS="$(TOOLCHAIN_X86_LINK)" \
411 PATH="$(shell pwd)/$(TOOLCHAIN_X86)/bin:$$PATH"
412# x86_64
413TOOLCHAIN_X86_64_ENV = \
414 ANDROID_DEV="$(shell pwd)/$(TOOLCHAIN_X86_64)/bin" \
415 CC=$(TOOLCHAIN_X86_64_PREFIX)-gcc \
416 CXX=$(TOOLCHAIN_X86_64_PREFIX)-g++ \
417 LINK=$(TOOLCHAIN_X86_64_PREFIX)-g++ \
418 LD=$(TOOLCHAIN_X86_64_PREFIX)-ld \
419 AR=$(TOOLCHAIN_X86_64_PREFIX)-ar \
420 RANLIB=$(TOOLCHAIN_X86_64_PREFIX)-ranlib \
421 STRIP=$(TOOLCHAIN_X86_64_PREFIX)-strip \
422 ARCH_FLAGS="$(TOOLCHAIN_X86_64_FLAGS)" \
423 ARCH_LINK="$(TOOLCHAIN_X86_64_LINK)" \
424 CPPFLAGS="-I. $(TOOLCHAIN_X86_64_FLAGS) -I$(TOOLCHAIN_X86_64_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
425 CXXFLAGS="-I. $(TOOLCHAIN_X86_64_FLAGS) -I$(TOOLCHAIN_X86_64_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions" \
426 CFLAGS="-I. $(TOOLCHAIN_X86_64_FLAGS) -I$(TOOLCHAIN_X86_64_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
427 LDFLAGS="$(TOOLCHAIN_X86_64_LINK)" \
428 PATH="$(shell pwd)/$(TOOLCHAIN_X86_64)/bin:$$PATH"
429# arm
430TOOLCHAIN_ARM_ENV = \
431 ANDROID_DEV="$(shell pwd)/$(TOOLCHAIN_ARM)/bin" \
432 CC=$(TOOLCHAIN_ARM_PREFIX)-gcc \
433 CXX=$(TOOLCHAIN_ARM_PREFIX)-g++ \
434 LINK=$(TOOLCHAIN_ARM_PREFIX)-g++ \
435 LD=$(TOOLCHAIN_ARM_PREFIX)-ld \
436 AR=$(TOOLCHAIN_ARM_PREFIX)-ar \
437 RANLIB=$(TOOLCHAIN_ARM_PREFIX)-ranlib \
438 STRIP=$(TOOLCHAIN_ARM_PREFIX)-strip \
439 ARCH_FLAGS="$(TOOLCHAIN_ARM_FLAGS)" \
440 ARCH_LINK="$(TOOLCHAIN_ARM_LINK)" \
441 CPPFLAGS="-I. $(TOOLCHAIN_ARM_FLAGS) -I$(TOOLCHAIN_ARM_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
442 CXXFLAGS="-I. $(TOOLCHAIN_ARM_FLAGS) -I$(TOOLCHAIN_ARM_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions" \
443 CFLAGS="-I. $(TOOLCHAIN_ARM_FLAGS) -I$(TOOLCHAIN_ARM_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
444 LDFLAGS="$(TOOLCHAIN_ARM_LINK)" \
445 PATH="$(shell pwd)/$(TOOLCHAIN_ARM)/bin:$$PATH"
446# arm-v7a
447TOOLCHAIN_ARM_V7A_ENV = \
448 ANDROID_DEV="$(shell pwd)/$(TOOLCHAIN_ARM_V7A)/bin" \
449 CC=$(TOOLCHAIN_ARM_V7A_PREFIX)-gcc \
450 CXX=$(TOOLCHAIN_ARM_V7A_PREFIX)-g++ \
451 LINK=$(TOOLCHAIN_ARM_V7A_PREFIX)-g++ \
452 LD=$(TOOLCHAIN_ARM_V7A_PREFIX)-ld \
453 AR=$(TOOLCHAIN_ARM_V7A_PREFIX)-ar \
454 RANLIB=$(TOOLCHAIN_ARM_V7A_PREFIX)-ranlib \
455 STRIP=$(TOOLCHAIN_ARM_V7A_PREFIX)-strip \
456 ARCH_FLAGS="$(TOOLCHAIN_ARM_V7A_FLAGS)" \
457 ARCH_LINK="$(TOOLCHAIN_ARM_V7A_LINK)" \
458 CPPFLAGS="-I. $(TOOLCHAIN_ARM_V7A_FLAGS) -I$(TOOLCHAIN_ARM_V7A_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
459 CXXFLAGS="-I. $(TOOLCHAIN_ARM_V7A_FLAGS) -I$(TOOLCHAIN_ARM_V7A_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions" \
460 CFLAGS="-I. $(TOOLCHAIN_ARM_V7A_FLAGS) -I$(TOOLCHAIN_ARM_V7A_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
461 LDFLAGS="$(TOOLCHAIN_ARM_V7A_LINK)" \
462 PATH="$(shell pwd)/$(TOOLCHAIN_ARM_V7A)/bin:$$PATH"
463# arm-v7a-hard
464TOOLCHAIN_ARM_V7A_HARD_ENV = \
465 ANDROID_DEV="$(shell pwd)/$(TOOLCHAIN_ARM_V7A_HARD)/bin" \
466 CC=$(TOOLCHAIN_ARM_V7A_HARD_PREFIX)-gcc \
467 CXX=$(TOOLCHAIN_ARM_V7A_HARD_PREFIX)-g++ \
468 LINK=$(TOOLCHAIN_ARM_V7A_HARD_PREFIX)-g++ \
469 LD=$(TOOLCHAIN_ARM_V7A_HARD_PREFIX)-ld \
470 AR=$(TOOLCHAIN_ARM_V7A_HARD_PREFIX)-ar \
471 RANLIB=$(TOOLCHAIN_ARM_V7A_HARD_PREFIX)-ranlib \
472 STRIP=$(TOOLCHAIN_ARM_V7A_HARD_PREFIX)-strip \
473 ARCH_FLAGS="$(TOOLCHAIN_ARM_V7A_HARD_FLAGS)" \
474 ARCH_LINK="$(TOOLCHAIN_ARM_V7A_HARD_LINK)" \
475 CPPFLAGS="-I. $(TOOLCHAIN_ARM_V7A_HARD_FLAGS) -I$(TOOLCHAIN_ARM_V7A_HARD_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
476 CXXFLAGS="-I. $(TOOLCHAIN_ARM_V7A_HARD_FLAGS) -I$(TOOLCHAIN_ARM_V7A_HARD_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions" \
477 CFLAGS="-I. $(TOOLCHAIN_ARM_V7A_HARD_FLAGS) -I$(TOOLCHAIN_ARM_V7A_HARD_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
478 LDFLAGS="$(TOOLCHAIN_ARM_V7A_HARD_LINK)" \
479 PATH="$(shell pwd)/$(TOOLCHAIN_ARM_V7A_HARD)/bin:$$PATH"
480# arm64-v8a
481TOOLCHAIN_ARM64_V8A_ENV = \
482 ANDROID_DEV="$(shell pwd)/$(TOOLCHAIN_ARM64_V8A)/bin" \
483 CC=$(TOOLCHAIN_ARM64_V8A_PREFIX)-gcc \
484 CXX=$(TOOLCHAIN_ARM64_V8A_PREFIX)-g++ \
485 LINK=$(TOOLCHAIN_ARM64_V8A_PREFIX)-g++ \
486 LD=$(TOOLCHAIN_ARM64_V8A_PREFIX)-ld \
487 AR=$(TOOLCHAIN_ARM64_V8A_PREFIX)-ar \
488 RANLIB=$(TOOLCHAIN_ARM64_V8A_PREFIX)-ranlib \
489 STRIP=$(TOOLCHAIN_ARM64_V8A_PREFIX)-strip \
490 ARCH_FLAGS="$(TOOLCHAIN_ARM64_V8A_FLAGS)" \
491 ARCH_LINK="$(TOOLCHAIN_ARM64_V8A_LINK)" \
492 CPPFLAGS="-I. $(TOOLCHAIN_ARM64_V8A_FLAGS) -I$(TOOLCHAIN_ARM64_V8A_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
493 CXXFLAGS="-I. $(TOOLCHAIN_ARM64_V8A_FLAGS) -I$(TOOLCHAIN_ARM64_V8A_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions" \
494 CFLAGS="-I. $(TOOLCHAIN_ARM64_V8A_FLAGS) -I$(TOOLCHAIN_ARM64_V8A_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
495 LDFLAGS="$(TOOLCHAIN_ARM64_V8A_LINK)" \
496 PATH="$(shell pwd)/$(TOOLCHAIN_ARM64_V8A)/bin:$$PATH"
497# mips
498TOOLCHAIN_MIPS_ENV = \
499 ANDROID_DEV="$(shell pwd)/$(TOOLCHAIN_MIPS)/bin" \
500 CC=$(TOOLCHAIN_MIPS_PREFIX)-gcc \
501 CXX=$(TOOLCHAIN_MIPS_PREFIX)-g++ \
502 LINK=$(TOOLCHAIN_MIPS_PREFIX)-g++ \
503 LD=$(TOOLCHAIN_MIPS_PREFIX)-ld \
504 AR=$(TOOLCHAIN_MIPS_PREFIX)-ar \
505 RANLIB=$(TOOLCHAIN_MIPS_PREFIX)-ranlib \
506 STRIP=$(TOOLCHAIN_MIPS_PREFIX)-strip \
507 ARCH_FLAGS="$(TOOLCHAIN_MIPS_FLAGS)" \
508 ARCH_LINK="$(TOOLCHAIN_MIPS_LINK)" \
509 CPPFLAGS="-I. $(TOOLCHAIN_MIPS_FLAGS) -I$(TOOLCHAIN_MIPS_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
510 CXXFLAGS="-I. $(TOOLCHAIN_MIPS_FLAGS) -I$(TOOLCHAIN_MIPS_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions" \
511 CFLAGS="-I. $(TOOLCHAIN_MIPS_FLAGS) -I$(TOOLCHAIN_MIPS_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
512 LDFLAGS="$(TOOLCHAIN_MIPS_LINK)" \
513 PATH="$(shell pwd)/$(TOOLCHAIN_MIPS)/bin:$$PATH"
514# mips64
515TOOLCHAIN_MIPS64_ENV = \
516 ANDROID_DEV="$(shell pwd)/$(TOOLCHAIN_MIPS64)/bin" \
517 CC=$(TOOLCHAIN_MIPS64_PREFIX)-gcc \
518 CXX=$(TOOLCHAIN_MIPS64_PREFIX)-g++ \
519 LINK=$(TOOLCHAIN_MIPS64_PREFIX)-g++ \
520 LD=$(TOOLCHAIN_MIPS64_PREFIX)-ld \
521 AR=$(TOOLCHAIN_MIPS64_PREFIX)-ar \
522 RANLIB=$(TOOLCHAIN_MIPS64_PREFIX)-ranlib \
523 STRIP=$(TOOLCHAIN_MIPS64_PREFIX)-strip \
524 ARCH_FLAGS="$(TOOLCHAIN_MIPS64_FLAGS)" \
525 ARCH_LINK="$(TOOLCHAIN_MIPS64_LINK)" \
526 CPPFLAGS="-I. $(TOOLCHAIN_MIPS64_FLAGS) -I$(TOOLCHAIN_MIPS64_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
527 CXXFLAGS="-I. $(TOOLCHAIN_MIPS64_FLAGS) -I$(TOOLCHAIN_MIPS64_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions" \
528 CFLAGS="-I. $(TOOLCHAIN_MIPS64_FLAGS) -I$(TOOLCHAIN_MIPS64_PLATFORM_HEADERS) -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64" \
529 LDFLAGS="$(TOOLCHAIN_MIPS64_LINK)" \
530 PATH="$(shell pwd)/$(TOOLCHAIN_MIPS64)/bin:$$PATH"
531
532#
533# All the external tools we use in this Makefile
534#
535
536AWK := awk
537CD := cd
538CMAKE := cmake
539ECHO := echo
540EGREP := egrep
541GIT := git
542LN := ln
543MKDIR := mkdir
544RM := rm
545SORT := sort
546TAR := tar
547WGET := wget
548
549#
550# End of user configurable options.
551#
552
553.PHONY: \
554 all \
555 all-x86 \
556 all-x86_64 \
557 all-armeabi \
558 all-armeabi-v7a \
559 all-armeabi-v7a-hard \
560 all-arm64-v8a \
561 all-mips \
562 all-mips64 \
563 common \
564 sources \
565 toolchains \
566 toolchain-x86 \
567 toolchain-x86_64 \
568 toolchain-armeabi \
569 toolchain-armeabi-v7a \
570 toolchain-armeabi-v7a-hard \
571 toolchain-arm64-v8a \
572 toolchain-mips \
573 toolchain-mips64 \
574 zlib \
575 zlib-x86 \
576 zlib-x86_64 \
577 zlib-armeabi \
578 zlib-armeabi-v7a \
579 zlib-armeabi-v7a-hard \
580 zlib-arm64-v8a \
581 zlib-mips \
582 zlib-mips64 \
583 openssl \
584 openssl-x86 \
585 openssl-x86_64 \
586 openssl-armeabi \
587 openssl-armeabi-v7a \
588 openssl-armeabi-v7a-hard \
589 openssl-arm64-v8a \
590 openssl-mips \
591 openssl-mips64 \
592 libwebsockets \
593 libwebsockets-x86 \
594 libwebsockets-x86_64 \
595 libwebsockets-armeabi \
596 libwebsockets-armeabi-v7a \
597 libwebsockets-armeabi-v7a-hard \
598 libwebsockets-arm64-v8a \
599 libwebsockets-mips \
600 libwebsockets-mips64 \
601 clean-ndk \
602 clean \
603 dist-clean \
604 clean-targets \
605 clean-target-x86 \
606 clean-target-x86_64 \
607 clean-target-armeabi \
608 clean-target-armeabi-v7a \
609 clean-target-armeabi-v7a-hard \
610 clean-target-arm64-v8a \
611 clean-target-mips \
612 clean-target-mips64 \
613 clean-sources \
614 clean-source-zlib \
615 clean-source-openssl \
616 clean-source-libwebsockets \
617 clean-toolchains \
618 clean-toolchain-x86 \
619 clean-toolchain-x86_64 \
620 clean-toolchain-armeabi \
621 clean-toolchain-armeabi-v7a \
622 clean-toolchain-armeabi-v7a-hard \
623 clean-toolchain-arm64-v8a \
624 clean-toolchain-mips \
625 clean-toolchain-mips64 \
626 list-targets
627
628# Default rule: build the libraries for all ABIs defined in NDK_APP_ABI then run ndk-build
629all: $(NDK_APP_ABI)
630	$(NDK_ROOT)/ndk-build clean
631	$(NDK_ROOT)/ndk-build
632
633# Libraries may also be build per ABI
634all-x86: $(TARGET_X86)
635all-x86_64: $(TARGET_X86_64)
636all-armeabi: $(TARGET_ARM)
637all-armeabi-v7a: $(TARGET_ARM_V7A)
638all-armeabi-v7a-hard: $(TARGET_ARM_V7A_HARD)
639all-arm64-v8a: $(TARGET_ARM64_V8A)
640all-mips: $(TARGET_MIPS)
641all-mips64: $(TARGET_MIPS64)
642
643# Common rule all targets depend on
644common: ../jniLibs
645
646# These rules are called from Android.mk when executing ndk-build
647$(TARGET_X86): common zlib-x86 openssl-x86 libwebsockets-x86
648$(TARGET_X86_64): common zlib-x86_64 openssl-x86_64 libwebsockets-x86_64
649$(TARGET_ARM): common zlib-armeabi openssl-armeabi libwebsockets-armeabi
650$(TARGET_ARM_V7A): common zlib-armeabi-v7a openssl-armeabi-v7a libwebsockets-armeabi-v7a
651$(TARGET_ARM_V7A_HARD): common zlib-armeabi-v7a-hard openssl-armeabi-v7a-hard libwebsockets-armeabi-v7a-hard
652$(TARGET_ARM64_V8A): common zlib-arm64-v8a openssl-arm64-v8a libwebsockets-arm64-v8a
653$(TARGET_MIPS): common zlib-mips openssl-mips libwebsockets-mips
654$(TARGET_MIPS64): common zlib-mips64 openssl-mips64 libwebsockets-mips64
655
656#
657# A rule to ensure ../jniLibs points to ../libs
658# (ndk-build creates ../libs but Gradle looks for ../jniLibs)
659#
660
661../libs:
662	$(MKDIR) ../libs
663
664../jniLibs: ../libs
665	$(CD) .. && $(LN) -s libs jniLibs
666
667#
668# Some rules to download the sources
669#
670
671sources: $(ZLIB_TGZ_SOURCE) $(OPENSSL_TGZ_SOURCE) $(LIBWEBSOCKETS_TGZ_SOURCE)
672
673$(ZLIB_TGZ_SOURCE):
674	$(WGET) -q $(ZLIB_TGZ_URL)
675
676$(OPENSSL_TGZ_SOURCE):
677	$(WGET) -q $(OPENSSL_TGZ_URL)
678
679$(LIBWEBSOCKETS_TGZ_SOURCE):
680	if [ -d $(LIBWEBSOCKETS_DIR) ]; then $(RM) -fr $(LIBWEBSOCKETS_DIR); fi
681	$(GIT) clone $(LIBWEBSOCKETS_GIT_URL)
682	$(TAR) caf $(LIBWEBSOCKETS_TGZ_SOURCE) $(LIBWEBSOCKETS_DIR)
683	$(RM) -fR $(LIBWEBSOCKETS_DIR)
684
685#
686# Some rules to install the required toolchains
687#
688
689toolchains: \
690 toolchain-x86 \
691 toolchain-x86_64 \
692 toolchain-armeabi \
693 toolchain-armeabi-v7a \
694 toolchain-armeabi-v7a-hard \
695 toolchain-arm64-v8a \
696 toolchain-mips \
697 toolchain-mips64
698
699toolchain-x86: $(TOOLCHAIN_X86)
700toolchain-x86_64: $(TOOLCHAIN_X86_64)
701toolchain-armeabi: $(TOOLCHAIN_ARM)
702toolchain-armeabi-v7a: $(TOOLCHAIN_ARM_V7A)
703toolchain-armeabi-v7a-hard: $(TOOLCHAIN_ARM_V7A_HARD)
704toolchain-arm64-v8a: $(TOOLCHAIN_ARM64_V8A)
705toolchain-mips: $(TOOLCHAIN_MIPS)
706toolchain-mips64: $(TOOLCHAIN_MIPS64)
707
708$(TOOLCHAIN_X86):
709ifneq ($(TOOLCHAIN_STL),)
710	$(NDK_MAKE_TOOLCHAIN) \
711	  --stl $(TOOLCHAIN_STL) \
712	  --api $(TOOLCHAIN_X86_API) \
713	  --arch x86 \
714	  --install-dir $(shell pwd)/$(TOOLCHAIN_X86)
715else
716	$(NDK_MAKE_TOOLCHAIN) \
717	  --api $(TOOLCHAIN_X86_API) \
718	  --arch x86 \
719	  --install-dir $(shell pwd)/$(TOOLCHAIN_X86)
720endif
721
722$(TOOLCHAIN_X86_64):
723ifneq ($(TOOLCHAIN_STL),)
724	$(NDK_MAKE_TOOLCHAIN) \
725	  --stl $(TOOLCHAIN_STL) \
726	  --api $(TOOLCHAIN_X86_64_API) \
727	  --arch x86_64 \
728	  --install-dir $(shell pwd)/$(TOOLCHAIN_X86_64)
729else
730	$(NDK_MAKE_TOOLCHAIN) \
731	  --api $(TOOLCHAIN_X86_64_API) \
732	  --arch x86_64 \
733	  --install-dir $(shell pwd)/$(TOOLCHAIN_X86_64)
734endif
735
736$(TOOLCHAIN_ARM):
737ifneq ($(TOOLCHAIN_STL),)
738	$(NDK_MAKE_TOOLCHAIN) \
739	  --stl $(TOOLCHAIN_STL) \
740	  --api $(TOOLCHAIN_ARM_API) \
741	  --arch arm \
742	  --install-dir $(shell pwd)/$(TOOLCHAIN_ARM)
743else
744	$(NDK_MAKE_TOOLCHAIN) \
745	  --api $(TOOLCHAIN_ARM_API) \
746	  --arch arm \
747	  --install-dir $(shell pwd)/$(TOOLCHAIN_ARM)
748endif
749
750$(TOOLCHAIN_ARM_V7A):
751ifneq ($(TOOLCHAIN_STL),)
752	$(NDK_MAKE_TOOLCHAIN) \
753	  --stl $(TOOLCHAIN_STL) \
754	  --api $(TOOLCHAIN_ARM_V7A_API) \
755	  --arch arm \
756	  --install-dir $(shell pwd)/$(TOOLCHAIN_ARM_V7A)
757else
758	$(NDK_MAKE_TOOLCHAIN) \
759	  --api $(TOOLCHAIN_ARM_V7A_API) \
760	  --arch arm \
761	  --install-dir $(shell pwd)/$(TOOLCHAIN_ARM_V7A)
762endif
763
764$(TOOLCHAIN_ARM_V7A_HARD):
765ifneq ($(TOOLCHAIN_STL),)
766	$(NDK_MAKE_TOOLCHAIN) \
767	  --stl $(TOOLCHAIN_STL) \
768	  --api $(TOOLCHAIN_ARM_V7A_HARD_API) \
769	  --arch arm \
770	  --install-dir $(shell pwd)/$(TOOLCHAIN_ARM_V7A_HARD)
771else
772	$(NDK_MAKE_TOOLCHAIN) \
773	  --api $(TOOLCHAIN_ARM_V7A_HARD_API) \
774	  --arch arm \
775	  --install-dir $(shell pwd)/$(TOOLCHAIN_ARM_V7A_HARD)
776endif
777
778$(TOOLCHAIN_ARM64_V8A):
779ifneq ($(TOOLCHAIN_STL),)
780	$(NDK_MAKE_TOOLCHAIN) \
781	  --stl $(TOOLCHAIN_STL) \
782	  --api $(TOOLCHAIN_ARM64_V8A_API) \
783	  --arch arm64 \
784	  --install-dir $(shell pwd)/$(TOOLCHAIN_ARM64_V8A)
785else
786	$(NDK_MAKE_TOOLCHAIN) \
787	  --api $(TOOLCHAIN_ARM64_V8A_API) \
788	  --arch arm64 \
789	  --install-dir $(shell pwd)/$(TOOLCHAIN_ARM64_V8A)
790endif
791
792$(TOOLCHAIN_MIPS):
793ifneq ($(TOOLCHAIN_STL),)
794	$(NDK_MAKE_TOOLCHAIN) \
795	  --stl $(TOOLCHAIN_STL) \
796	  --api $(TOOLCHAIN_MIPS_API) \
797	  --arch mips \
798	  --install-dir $(shell pwd)/$(TOOLCHAIN_MIPS)
799else
800	$(NDK_MAKE_TOOLCHAIN) \
801	  --api $(TOOLCHAIN_MIPS_API) \
802	  --arch mips \
803	  --install-dir $(shell pwd)/$(TOOLCHAIN_MIPS)
804endif
805
806$(TOOLCHAIN_MIPS64):
807ifneq ($(TOOLCHAIN_STL),)
808	$(NDK_MAKE_TOOLCHAIN) \
809	  --stl $(TOOLCHAIN_STL) \
810	  --api $(TOOLCHAIN_MIPS64_API) \
811	  --arch mips64 \
812	  --install-dir $(shell pwd)/$(TOOLCHAIN_MIPS64)
813else
814	$(NDK_MAKE_TOOLCHAIN) \
815	  --api $(TOOLCHAIN_MIPS64_API) \
816	  --arch mips64 \
817	  --install-dir $(shell pwd)/$(TOOLCHAIN_MIPS64)
818endif
819
820#
821# Rules to build zlib
822#
823
824zlib: \
825 zlib-x86 \
826 zlib-x86_64 \
827 zlib-armeabi \
828 zlib-armeabi-v7a \
829 zlib-armeabi-v7a-hard \
830 zlib-arm64-v8a \
831 zlib-mips \
832 zlib-mips64
833
834zlib-x86: $(TARGET_X86)/lib/libz.a
835zlib-x86_64: $(TARGET_X86_64)/lib/libz.a
836zlib-armeabi: $(TARGET_ARM)/lib/libz.a
837zlib-armeabi-v7a: $(TARGET_ARM_V7A)/lib/libz.a
838zlib-armeabi-v7a-hard: $(TARGET_ARM_V7A_HARD)/lib/libz.a
839zlib-arm64-v8a: $(TARGET_ARM64_V8A)/lib/libz.a
840zlib-mips: $(TARGET_MIPS)/lib/libz.a
841zlib-mips64: $(TARGET_MIPS64)/lib/libz.a
842
843# Extracting/configuring sources
844
845$(TARGET_X86)/src/$(ZLIB_DIR): $(ZLIB_TGZ_SOURCE) $(TOOLCHAIN_X86)
846	-$(MKDIR) -p $(TARGET_X86)/src
847	$(TAR) xf $(ZLIB_TGZ_SOURCE) -C $(TARGET_X86)/src
848	$(CD) $(TARGET_X86)/src/$(ZLIB_DIR) && $(TOOLCHAIN_X86_ENV) \
849	  ./configure --static --prefix=$(shell pwd)/$(TARGET_X86)
850
851$(TARGET_X86_64)/src/$(ZLIB_DIR): $(ZLIB_TGZ_SOURCE) $(TOOLCHAIN_X86_64)
852	-$(MKDIR) -p $(TARGET_X86_64)/src
853	$(TAR) xf $(ZLIB_TGZ_SOURCE) -C $(TARGET_X86_64)/src
854	$(CD) $(TARGET_X86_64)/src/$(ZLIB_DIR) && $(TOOLCHAIN_X86_64_ENV) \
855	  ./configure --static --prefix=$(shell pwd)/$(TARGET_X86_64)
856
857$(TARGET_ARM)/src/$(ZLIB_DIR): $(ZLIB_TGZ_SOURCE) $(TOOLCHAIN_ARM)
858	-$(MKDIR) -p $(TARGET_ARM)/src
859	$(TAR) xf $(ZLIB_TGZ_SOURCE) -C $(TARGET_ARM)/src
860	$(CD) $(TARGET_ARM)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM_ENV) \
861	  ./configure --static --prefix=$(shell pwd)/$(TARGET_ARM)
862
863$(TARGET_ARM_V7A)/src/$(ZLIB_DIR): $(ZLIB_TGZ_SOURCE) $(TOOLCHAIN_ARM_V7A)
864	-$(MKDIR) -p $(TARGET_ARM_V7A)/src
865	$(TAR) xf $(ZLIB_TGZ_SOURCE) -C $(TARGET_ARM_V7A)/src
866	$(CD) $(TARGET_ARM_V7A)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM_V7A_ENV) \
867	  ./configure --static --prefix=$(shell pwd)/$(TARGET_ARM_V7A)
868
869$(TARGET_ARM_V7A_HARD)/src/$(ZLIB_DIR): $(ZLIB_TGZ_SOURCE) $(TOOLCHAIN_ARM_V7A_HARD)
870	-$(MKDIR) -p $(TARGET_ARM_V7A_HARD)/src
871	$(TAR) xf $(ZLIB_TGZ_SOURCE) -C $(TARGET_ARM_V7A_HARD)/src
872	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM_V7A_HARD_ENV) \
873	  ./configure --static --prefix=$(shell pwd)/$(TARGET_ARM_V7A_HARD)
874
875$(TARGET_ARM64_V8A)/src/$(ZLIB_DIR): $(ZLIB_TGZ_SOURCE) $(TOOLCHAIN_ARM64_V8A)
876	-$(MKDIR) -p $(TARGET_ARM64_V8A)/src
877	$(TAR) xf $(ZLIB_TGZ_SOURCE) -C $(TARGET_ARM64_V8A)/src
878	$(CD) $(TARGET_ARM64_V8A)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM64_V8A_ENV) \
879	  ./configure --static --prefix=$(shell pwd)/$(TARGET_ARM64_V8A)
880
881$(TARGET_MIPS)/src/$(ZLIB_DIR): $(ZLIB_TGZ_SOURCE) $(TOOLCHAIN_MIPS)
882	-$(MKDIR) -p $(TARGET_MIPS)/src
883	$(TAR) xf $(ZLIB_TGZ_SOURCE) -C $(TARGET_MIPS)/src
884	$(CD) $(TARGET_MIPS)/src/$(ZLIB_DIR) && $(TOOLCHAIN_MIPS_ENV) \
885	  ./configure --static --prefix=$(shell pwd)/$(TARGET_MIPS)
886
887$(TARGET_MIPS64)/src/$(ZLIB_DIR): $(ZLIB_TGZ_SOURCE) $(TOOLCHAIN_MIPS64)
888	-$(MKDIR) -p $(TARGET_MIPS64)/src
889	$(TAR) xf $(ZLIB_TGZ_SOURCE) -C $(TARGET_MIPS64)/src
890	$(CD) $(TARGET_MIPS64)/src/$(ZLIB_DIR) && $(TOOLCHAIN_MIPS64_ENV) \
891	  ./configure --static --prefix=$(shell pwd)/$(TARGET_MIPS64)
892
893# Build/install library
894
895$(TARGET_X86)/lib/libz.a: $(TARGET_X86)/src/$(ZLIB_DIR)
896	$(CD) $(TARGET_X86)/src/$(ZLIB_DIR) && $(TOOLCHAIN_X86_ENV) $(MAKE) libz.a
897	$(CD) $(TARGET_X86)/src/$(ZLIB_DIR) && $(TOOLCHAIN_X86_ENV) $(MAKE) install
898
899$(TARGET_X86_64)/lib/libz.a: $(TARGET_X86_64)/src/$(ZLIB_DIR)
900	$(CD) $(TARGET_X86_64)/src/$(ZLIB_DIR) && $(TOOLCHAIN_X86_64_ENV) $(MAKE) libz.a
901	$(CD) $(TARGET_X86_64)/src/$(ZLIB_DIR) && $(TOOLCHAIN_X86_64_ENV) $(MAKE) install
902
903$(TARGET_ARM)/lib/libz.a: $(TARGET_ARM)/src/$(ZLIB_DIR)
904	$(CD) $(TARGET_ARM)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM_ENV) $(MAKE) libz.a
905	$(CD) $(TARGET_ARM)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM_ENV) $(MAKE) install
906
907$(TARGET_ARM_V7A)/lib/libz.a: $(TARGET_ARM_V7A)/src/$(ZLIB_DIR)
908	$(CD) $(TARGET_ARM_V7A)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM_V7A_ENV) $(MAKE) libz.a
909	$(CD) $(TARGET_ARM_V7A)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM_V7A_ENV) $(MAKE) install
910
911$(TARGET_ARM_V7A_HARD)/lib/libz.a: $(TARGET_ARM_V7A_HARD)/src/$(ZLIB_DIR)
912	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM_V7A_HARD_ENV) $(MAKE) libz.a
913	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM_V7A_HARD_ENV) $(MAKE) install
914
915$(TARGET_ARM64_V8A)/lib/libz.a: $(TARGET_ARM64_V8A)/src/$(ZLIB_DIR)
916	$(CD) $(TARGET_ARM64_V8A)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM64_V8A_ENV) $(MAKE) libz.a
917	$(CD) $(TARGET_ARM64_V8A)/src/$(ZLIB_DIR) && $(TOOLCHAIN_ARM64_V8A_ENV) $(MAKE) install
918
919$(TARGET_MIPS)/lib/libz.a: $(TARGET_MIPS)/src/$(ZLIB_DIR)
920	$(CD) $(TARGET_MIPS)/src/$(ZLIB_DIR) && $(TOOLCHAIN_MIPS_ENV) $(MAKE) libz.a
921	$(CD) $(TARGET_MIPS)/src/$(ZLIB_DIR) && $(TOOLCHAIN_MIPS_ENV) $(MAKE) install
922
923$(TARGET_MIPS64)/lib/libz.a: $(TARGET_MIPS64)/src/$(ZLIB_DIR)
924	$(CD) $(TARGET_MIPS64)/src/$(ZLIB_DIR) && $(TOOLCHAIN_MIPS64_ENV) $(MAKE) libz.a
925	$(CD) $(TARGET_MIPS64)/src/$(ZLIB_DIR) && $(TOOLCHAIN_MIPS64_ENV) $(MAKE) install
926
927#
928# Rules to build OpenSSL
929#
930
931openssl: \
932 openssl-x86 \
933 openssl-x86_64 \
934 openssl-armeabi \
935 openssl-armeabi-v7a \
936 openssl-armeabi-v7a-hard \
937 openssl-arm64-v8a \
938 openssl-mips \
939 openssl-mips64
940
941openssl-x86: $(TARGET_X86)/lib/libssl.a
942openssl-x86_64: $(TARGET_X86_64)/lib/libssl.a
943openssl-armeabi: $(TARGET_ARM)/lib/libssl.a
944openssl-armeabi-v7a: $(TARGET_ARM_V7A)/lib/libssl.a
945openssl-armeabi-v7a-hard: $(TARGET_ARM_V7A_HARD)/lib/libssl.a
946openssl-arm64-v8a: $(TARGET_ARM64_V8A)/lib/libssl.a
947openssl-mips: $(TARGET_MIPS)/lib/libssl.a
948openssl-mips64: $(TARGET_MIPS64)/lib/libssl.a
949
950# Extracting/configuring sources
951
952$(TARGET_X86)/src/$(OPENSSL_DIR): $(OPENSSL_TGZ_SOURCE) $(TOOLCHAIN_X86)
953	-$(MKDIR) -p $(TARGET_X86)/src
954	$(TAR) xf $(OPENSSL_TGZ_SOURCE) -C $(TARGET_X86)/src
955	$(CD) $(TARGET_X86)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_X86_ENV) \
956	  ./Configure $(TARGET_X86_OPENSSL_CONFIG_TARGET) \
957	    --prefix=$(shell pwd)/$(TARGET_X86) \
958	    --openssldir=$(shell pwd)/$(TARGET_X86)/lib/ssl \
959	    $(TARGET_X86_OPENSSL_CONFIG)
960
961$(TARGET_X86_64)/src/$(OPENSSL_DIR): $(OPENSSL_TGZ_SOURCE) $(TOOLCHAIN_X86_64)
962	-$(MKDIR) -p $(TARGET_X86_64)/src
963	$(TAR) xf $(OPENSSL_TGZ_SOURCE) -C $(TARGET_X86_64)/src
964	$(CD) $(TARGET_X86_64)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_X86_64_ENV) \
965	  ./Configure $(TARGET_X86_64_OPENSSL_CONFIG_TARGET) \
966	    --prefix=$(shell pwd)/$(TARGET_X86_64) \
967	    --openssldir=$(shell pwd)/$(TARGET_X86_64)/lib/ssl \
968	    $(TARGET_X86_64_OPENSSL_CONFIG)
969
970$(TARGET_ARM)/src/$(OPENSSL_DIR): $(OPENSSL_TGZ_SOURCE) $(TOOLCHAIN_ARM)
971	-$(MKDIR) -p $(TARGET_ARM)/src
972	$(TAR) xf $(OPENSSL_TGZ_SOURCE) -C $(TARGET_ARM)/src
973	$(CD) $(TARGET_ARM)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_ENV) \
974	  ./Configure $(TARGET_ARM_OPENSSL_CONFIG_TARGET) \
975	    --prefix=$(shell pwd)/$(TARGET_ARM) \
976	    --openssldir=$(shell pwd)/$(TARGET_ARM)/lib/ssl \
977	    $(TARGET_ARM_OPENSSL_CONFIG)
978
979$(TARGET_ARM_V7A)/src/$(OPENSSL_DIR): $(OPENSSL_TGZ_SOURCE) $(TOOLCHAIN_ARM_V7A)
980	-$(MKDIR) -p $(TARGET_ARM_V7A)/src
981	$(TAR) xf $(OPENSSL_TGZ_SOURCE) -C $(TARGET_ARM_V7A)/src
982	$(CD) $(TARGET_ARM_V7A)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_V7A_ENV) \
983	  ./Configure $(TARGET_ARM_V7A_OPENSSL_CONFIG_TARGET) \
984	    --prefix=$(shell pwd)/$(TARGET_ARM_V7A) \
985	    --openssldir=$(shell pwd)/$(TARGET_ARM_V7A)/lib/ssl \
986	    $(TARGET_ARM_V7A_OPENSSL_CONFIG)
987
988$(TARGET_ARM_V7A_HARD)/src/$(OPENSSL_DIR): $(OPENSSL_TGZ_SOURCE) $(TOOLCHAIN_ARM_V7A_HARD)
989	-$(MKDIR) -p $(TARGET_ARM_V7A_HARD)/src
990	$(TAR) xf $(OPENSSL_TGZ_SOURCE) -C $(TARGET_ARM_V7A_HARD)/src
991	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_V7A_HARD_ENV) \
992	  ./Configure $(TARGET_ARM_V7A_HARD_OPENSSL_CONFIG_TARGET) \
993	    --prefix=$(shell pwd)/$(TARGET_ARM_V7A_HARD) \
994	    --openssldir=$(shell pwd)/$(TARGET_ARM_V7A_HARD)/lib/ssl \
995	    $(TARGET_ARM_V7A_HARD_OPENSSL_CONFIG)
996
997$(TARGET_ARM64_V8A)/src/$(OPENSSL_DIR): $(OPENSSL_TGZ_SOURCE) $(TOOLCHAIN_ARM64_V8A)
998	-$(MKDIR) -p $(TARGET_ARM64_V8A)/src
999	$(TAR) xf $(OPENSSL_TGZ_SOURCE) -C $(TARGET_ARM64_V8A)/src
1000	$(CD) $(TARGET_ARM64_V8A)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM64_V8A_ENV) \
1001	  ./Configure $(TARGET_ARM64_V8A_OPENSSL_CONFIG_TARGET) \
1002	    --prefix=$(shell pwd)/$(TARGET_ARM64_V8A) \
1003	    --openssldir=$(shell pwd)/$(TARGET_ARM64_V8A)/lib/ssl \
1004	    $(TARGET_ARM64_V8A_OPENSSL_CONFIG)
1005
1006$(TARGET_MIPS)/src/$(OPENSSL_DIR): $(OPENSSL_TGZ_SOURCE) $(TOOLCHAIN_MIPS)
1007	-$(MKDIR) -p $(TARGET_MIPS)/src
1008	$(TAR) xf $(OPENSSL_TGZ_SOURCE) -C $(TARGET_MIPS)/src
1009	$(CD) $(TARGET_MIPS)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_MIPS_ENV) \
1010	  ./Configure $(TARGET_MIPS_OPENSSL_CONFIG_TARGET) \
1011	    --prefix=$(shell pwd)/$(TARGET_MIPS) \
1012	    --openssldir=$(shell pwd)/$(TARGET_MIPS)/lib/ssl \
1013	    $(TARGET_MIPS_OPENSSL_CONFIG)
1014
1015$(TARGET_MIPS64)/src/$(OPENSSL_DIR): $(OPENSSL_TGZ_SOURCE) $(TOOLCHAIN_MIPS64)
1016	-$(MKDIR) -p $(TARGET_MIPS64)/src
1017	$(TAR) xf $(OPENSSL_TGZ_SOURCE) -C $(TARGET_MIPS64)/src
1018	$(CD) $(TARGET_MIPS64)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_MIPS64_ENV) \
1019	  ./Configure $(TARGET_MIPS64_OPENSSL_CONFIG_TARGET) \
1020	    --prefix=$(shell pwd)/$(TARGET_MIPS64) \
1021	    --openssldir=$(shell pwd)/$(TARGET_MIPS64)/lib/ssl \
1022	    $(TARGET_MIPS64_OPENSSL_CONFIG)
1023
1024# Build/install library
1025
1026$(TARGET_X86)/lib/libssl.a: $(TARGET_X86)/src/$(OPENSSL_DIR)
1027	$(CD) $(TARGET_X86)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_X86_ENV) $(MAKE) depend
1028	$(CD) $(TARGET_X86)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_X86_ENV) $(MAKE) build_libs
1029	$(CD) $(TARGET_X86)/src/$(OPENSSL_DIR) && $(ECHO) '#!/bin/sh\n\nfalse\n' > apps/openssl
1030	$(CD) $(TARGET_X86)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_X86_ENV) $(MAKE) install_sw
1031
1032$(TARGET_X86_64)/lib/libssl.a: $(TARGET_X86_64)/src/$(OPENSSL_DIR)
1033	$(CD) $(TARGET_X86_64)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_X86_64_ENV) $(MAKE) depend
1034	$(CD) $(TARGET_X86_64)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_X86_64_ENV) $(MAKE) build_libs
1035	$(CD) $(TARGET_X86_64)/src/$(OPENSSL_DIR) && $(ECHO) '#!/bin/sh\n\nfalse\n' > apps/openssl
1036	$(CD) $(TARGET_X86_64)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_X86_64_ENV) $(MAKE) install_sw
1037
1038$(TARGET_ARM)/lib/libssl.a: $(TARGET_ARM)/src/$(OPENSSL_DIR)
1039	$(CD) $(TARGET_ARM)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_ENV) $(MAKE) depend
1040	$(CD) $(TARGET_ARM)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_ENV) $(MAKE) build_libs
1041	$(CD) $(TARGET_ARM)/src/$(OPENSSL_DIR) && $(ECHO) '#!/bin/sh\n\nfalse\n' > apps/openssl
1042	$(CD) $(TARGET_ARM)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_ENV) $(MAKE) install_sw
1043
1044$(TARGET_ARM_V7A)/lib/libssl.a: $(TARGET_ARM_V7A)/src/$(OPENSSL_DIR)
1045	$(CD) $(TARGET_ARM_V7A)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_V7A_ENV) $(MAKE) depend
1046	$(CD) $(TARGET_ARM_V7A)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_V7A_ENV) $(MAKE) build_libs
1047	$(CD) $(TARGET_ARM_V7A)/src/$(OPENSSL_DIR) && $(ECHO) '#!/bin/sh\n\nfalse\n' > apps/openssl
1048	$(CD) $(TARGET_ARM_V7A)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_V7A_ENV) $(MAKE) install_sw
1049
1050$(TARGET_ARM_V7A_HARD)/lib/libssl.a: $(TARGET_ARM_V7A_HARD)/src/$(OPENSSL_DIR)
1051	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_V7A_HARD_ENV) $(MAKE) depend
1052	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_V7A_HARD_ENV) $(MAKE) build_libs
1053	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(OPENSSL_DIR) && $(ECHO) '#!/bin/sh\n\nfalse\n' > apps/openssl
1054	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM_V7A_HARD_ENV) $(MAKE) install_sw
1055
1056$(TARGET_ARM64_V8A)/lib/libssl.a: $(TARGET_ARM64_V8A)/src/$(OPENSSL_DIR)
1057	$(CD) $(TARGET_ARM64_V8A)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM64_V8A_ENV) $(MAKE) depend
1058	$(CD) $(TARGET_ARM64_V8A)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM64_V8A_ENV) $(MAKE) build_libs
1059	$(CD) $(TARGET_ARM64_V8A)/src/$(OPENSSL_DIR) && $(ECHO) '#!/bin/sh\n\nfalse\n' > apps/openssl
1060	$(CD) $(TARGET_ARM64_V8A)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_ARM64_V8A_ENV) $(MAKE) install_sw
1061
1062$(TARGET_MIPS)/lib/libssl.a: $(TARGET_MIPS)/src/$(OPENSSL_DIR)
1063	$(CD) $(TARGET_MIPS)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_MIPS_ENV) $(MAKE) depend
1064	$(CD) $(TARGET_MIPS)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_MIPS_ENV) $(MAKE) build_libs
1065	$(CD) $(TARGET_MIPS)/src/$(OPENSSL_DIR) && $(ECHO) '#!/bin/sh\n\nfalse\n' > apps/openssl
1066	$(CD) $(TARGET_MIPS)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_MIPS_ENV) $(MAKE) install_sw
1067
1068$(TARGET_MIPS64)/lib/libssl.a: $(TARGET_MIPS64)/src/$(OPENSSL_DIR)
1069	$(CD) $(TARGET_MIPS64)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_MIPS64_ENV) $(MAKE) depend
1070	$(CD) $(TARGET_MIPS64)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_MIPS64_ENV) $(MAKE) build_libs
1071	$(CD) $(TARGET_MIPS64)/src/$(OPENSSL_DIR) && $(ECHO) '#!/bin/sh\n\nfalse\n' > apps/openssl
1072	$(CD) $(TARGET_MIPS64)/src/$(OPENSSL_DIR) && $(TOOLCHAIN_MIPS64_ENV) $(MAKE) install_sw
1073
1074#
1075# Rules to build libwebsockets
1076#
1077
1078libwebsockets: \
1079 libwebsockets-x86 \
1080 libwebsockets-x86_64 \
1081 libwebsockets-armeabi \
1082 libwebsockets-armeabi-v7a \
1083 libwebsockets-armeabi-v7a-hard \
1084 libwebsockets-arm64-v8a \
1085 libwebsockets-mips \
1086 libwebsockets-mips64 \
1087
1088libwebsockets-x86: $(TARGET_X86)/lib/libwebsockets.a
1089libwebsockets-x86_64: $(TARGET_X86_64)/lib/libwebsockets.a
1090libwebsockets-armeabi: $(TARGET_ARM)/lib/libwebsockets.a
1091libwebsockets-armeabi-v7a: $(TARGET_ARM_V7A)/lib/libwebsockets.a
1092libwebsockets-armeabi-v7a-hard: $(TARGET_ARM_V7A_HARD)/lib/libwebsockets.a
1093libwebsockets-arm64-v8a: $(TARGET_ARM64_V8A)/lib/libwebsockets.a
1094libwebsockets-mips: $(TARGET_MIPS)/lib/libwebsockets.a
1095libwebsockets-mips64: $(TARGET_MIPS64)/lib/libwebsockets.a
1096
1097# Extracting/configuring sources
1098
1099$(TARGET_X86)/src/$(LIBWEBSOCKETS_DIR): $(LIBWEBSOCKETS_TGZ_SOURCE) $(TOOLCHAIN_X86) $(TARGET_X86)/lib/libssl.a $(TARGET_X86)/lib/libz.a
1100	-$(MKDIR) -p $(TARGET_X86)/src
1101	$(TAR) xf $(LIBWEBSOCKETS_TGZ_SOURCE) -C $(TARGET_X86)/src
1102	-$(MKDIR) -p $(TARGET_X86)/src/$(LIBWEBSOCKETS_DIR)/build
1103	$(CD) $(TARGET_X86)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_X86_ENV) \
1104	  $(CMAKE) $(TARGET_X86_LWS_OPTIONS) \
1105	    -DCMAKE_INSTALL_PREFIX=$(shell pwd)/$(TARGET_X86) \
1106	    -DLWS_OPENSSL_LIBRARIES="$(shell pwd)/$(TARGET_X86)/lib/libssl.a;$(shell pwd)/$(TARGET_X86)/lib/libcrypto.a" \
1107	    -DLWS_OPENSSL_INCLUDE_DIRS="$(shell pwd)/$(TARGET_X86)/include" \
1108	    ..
1109
1110$(TARGET_X86_64)/src/$(LIBWEBSOCKETS_DIR): $(LIBWEBSOCKETS_TGZ_SOURCE) $(TOOLCHAIN_X86_64) $(TARGET_X86_64)/lib/libssl.a $(TARGET_X86_64)/lib/libz.a
1111	-$(MKDIR) -p $(TARGET_X86_64)/src
1112	$(TAR) xf $(LIBWEBSOCKETS_TGZ_SOURCE) -C $(TARGET_X86_64)/src
1113	-$(MKDIR) -p $(TARGET_X86_64)/src/$(LIBWEBSOCKETS_DIR)/build
1114	$(CD) $(TARGET_X86_64)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_X86_64_ENV) \
1115	  $(CMAKE) $(TARGET_X86_64_LWS_OPTIONS) \
1116	    -DCMAKE_INSTALL_PREFIX=$(shell pwd)/$(TARGET_X86_64) \
1117	    -DLWS_OPENSSL_LIBRARIES="$(shell pwd)/$(TARGET_X86_64)/lib/libssl.a;$(shell pwd)/$(TARGET_X86_64)/lib/libcrypto.a" \
1118	    -DLWS_OPENSSL_INCLUDE_DIRS="$(shell pwd)/$(TARGET_X86_64)/include" \
1119	    ..
1120
1121$(TARGET_ARM)/src/$(LIBWEBSOCKETS_DIR): $(LIBWEBSOCKETS_TGZ_SOURCE) $(TOOLCHAIN_ARM) $(TARGET_ARM)/lib/libssl.a $(TARGET_ARM)/lib/libz.a
1122	-$(MKDIR) -p $(TARGET_ARM)/src
1123	$(TAR) xf $(LIBWEBSOCKETS_TGZ_SOURCE) -C $(TARGET_ARM)/src
1124	-$(MKDIR) -p $(TARGET_ARM)/src/$(LIBWEBSOCKETS_DIR)/build
1125	$(CD) $(TARGET_ARM)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM_ENV) \
1126	  $(CMAKE) $(TARGET_ARM_LWS_OPTIONS) \
1127	    -DCMAKE_INSTALL_PREFIX=$(shell pwd)/$(TARGET_ARM) \
1128	    -DLWS_OPENSSL_LIBRARIES="$(shell pwd)/$(TARGET_ARM)/lib/libssl.a;$(shell pwd)/$(TARGET_ARM)/lib/libcrypto.a" \
1129	    -DLWS_OPENSSL_INCLUDE_DIRS="$(shell pwd)/$(TARGET_ARM)/include" \
1130	    ..
1131
1132$(TARGET_ARM_V7A)/src/$(LIBWEBSOCKETS_DIR): $(LIBWEBSOCKETS_TGZ_SOURCE) $(TOOLCHAIN_ARM_V7A) $(TARGET_ARM_V7A)/lib/libssl.a $(TARGET_ARM_V7A)/lib/libz.a
1133	-$(MKDIR) -p $(TARGET_ARM_V7A)/src
1134	$(TAR) xf $(LIBWEBSOCKETS_TGZ_SOURCE) -C $(TARGET_ARM_V7A)/src
1135	-$(MKDIR) -p $(TARGET_ARM_V7A)/src/$(LIBWEBSOCKETS_DIR)/build
1136	$(CD) $(TARGET_ARM_V7A)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM_V7A_ENV) \
1137	  $(CMAKE) $(TARGET_ARM_V7A_LWS_OPTIONS) \
1138	    -DCMAKE_INSTALL_PREFIX=$(shell pwd)/$(TARGET_ARM_V7A) \
1139	    -DLWS_OPENSSL_LIBRARIES="$(shell pwd)/$(TARGET_ARM_V7A)/lib/libssl.a;$(shell pwd)/$(TARGET_ARM_V7A)/lib/libcrypto.a" \
1140	    -DLWS_OPENSSL_INCLUDE_DIRS="$(shell pwd)/$(TARGET_ARM_V7A)/include" \
1141	    ..
1142
1143$(TARGET_ARM_V7A_HARD)/src/$(LIBWEBSOCKETS_DIR): $(LIBWEBSOCKETS_TGZ_SOURCE) $(TOOLCHAIN_ARM_V7A_HARD) $(TARGET_ARM_V7A_HARD)/lib/libssl.a $(TARGET_ARM_V7A_HARD)/lib/libz.a
1144	-$(MKDIR) -p $(TARGET_ARM_V7A_HARD)/src
1145	$(TAR) xf $(LIBWEBSOCKETS_TGZ_SOURCE) -C $(TARGET_ARM_V7A_HARD)/src
1146	-$(MKDIR) -p $(TARGET_ARM_V7A_HARD)/src/$(LIBWEBSOCKETS_DIR)/build
1147	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM_V7A_HARD_ENV) \
1148	  $(CMAKE) $(TARGET_ARM_V7A_HARD_LWS_OPTIONS) \
1149	    -DCMAKE_INSTALL_PREFIX=$(shell pwd)/$(TARGET_ARM_V7A_HARD) \
1150	    -DLWS_OPENSSL_LIBRARIES="$(shell pwd)/$(TARGET_ARM_V7A_HARD)/lib/libssl.a;$(shell pwd)/$(TARGET_ARM_V7A_HARD)/lib/libcrypto.a" \
1151	    -DLWS_OPENSSL_INCLUDE_DIRS="$(shell pwd)/$(TARGET_ARM_V7A_HARD)/include" \
1152	    ..
1153
1154$(TARGET_ARM64_V8A)/src/$(LIBWEBSOCKETS_DIR): $(LIBWEBSOCKETS_TGZ_SOURCE) $(TOOLCHAIN_ARM64_V8A) $(TARGET_ARM64_V8A)/lib/libssl.a $(TARGET_ARM64_V8A)/lib/libz.a
1155	-$(MKDIR) -p $(TARGET_ARM64_V8A)/src
1156	$(TAR) xf $(LIBWEBSOCKETS_TGZ_SOURCE) -C $(TARGET_ARM64_V8A)/src
1157	-$(MKDIR) -p $(TARGET_ARM64_V8A)/src/$(LIBWEBSOCKETS_DIR)/build
1158	$(CD) $(TARGET_ARM64_V8A)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM64_V8A_ENV) \
1159	  $(CMAKE) $(TARGET_ARM64_V8A_LWS_OPTIONS) \
1160	    -DCMAKE_INSTALL_PREFIX=$(shell pwd)/$(TARGET_ARM64_V8A) \
1161	    -DLWS_OPENSSL_LIBRARIES="$(shell pwd)/$(TARGET_ARM64_V8A)/lib/libssl.a;$(shell pwd)/$(TARGET_ARM64_V8A)/lib/libcrypto.a" \
1162	    -DLWS_OPENSSL_INCLUDE_DIRS="$(shell pwd)/$(TARGET_ARM64_V8A)/include" \
1163	    ..
1164
1165$(TARGET_MIPS)/src/$(LIBWEBSOCKETS_DIR): $(LIBWEBSOCKETS_TGZ_SOURCE) $(TOOLCHAIN_MIPS) $(TARGET_MIPS)/lib/libssl.a $(TARGET_MIPS)/lib/libz.a
1166	-$(MKDIR) -p $(TARGET_MIPS)/src
1167	$(TAR) xf $(LIBWEBSOCKETS_TGZ_SOURCE) -C $(TARGET_MIPS)/src
1168	-$(MKDIR) -p $(TARGET_MIPS)/src/$(LIBWEBSOCKETS_DIR)/build
1169	$(CD) $(TARGET_MIPS)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_MIPS_ENV) \
1170	  $(CMAKE) $(TARGET_MIPS_LWS_OPTIONS) \
1171	    -DCMAKE_INSTALL_PREFIX=$(shell pwd)/$(TARGET_MIPS) \
1172	    -DLWS_OPENSSL_LIBRARIES="$(shell pwd)/$(TARGET_MIPS)/lib/libssl.a;$(shell pwd)/$(TARGET_MIPS)/lib/libcrypto.a" \
1173	    -DLWS_OPENSSL_INCLUDE_DIRS="$(shell pwd)/$(TARGET_MIPS)/include" \
1174	    ..
1175
1176$(TARGET_MIPS64)/src/$(LIBWEBSOCKETS_DIR): $(LIBWEBSOCKETS_TGZ_SOURCE) $(TOOLCHAIN_MIPS64) $(TARGET_MIPS64)/lib/libssl.a $(TARGET_MIPS64)/lib/libz.a
1177	-$(MKDIR) -p $(TARGET_MIPS64)/src
1178	$(TAR) xf $(LIBWEBSOCKETS_TGZ_SOURCE) -C $(TARGET_MIPS64)/src
1179	-$(MKDIR) -p $(TARGET_MIPS64)/src/$(LIBWEBSOCKETS_DIR)/build
1180	$(CD) $(TARGET_MIPS64)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_MIPS64_ENV) \
1181	  $(CMAKE) $(TARGET_MIPS64_LWS_OPTIONS) \
1182	    -DCMAKE_INSTALL_PREFIX=$(shell pwd)/$(TARGET_MIPS64) \
1183	    -DLWS_OPENSSL_LIBRARIES="$(shell pwd)/$(TARGET_MIPS64)/lib/libssl.a;$(shell pwd)/$(TARGET_MIPS64)/lib/libcrypto.a" \
1184	    -DLWS_OPENSSL_INCLUDE_DIRS="$(shell pwd)/$(TARGET_MIPS64)/include" \
1185	    ..
1186
1187# Build/install library
1188
1189$(TARGET_X86)/lib/libwebsockets.a: $(TARGET_X86)/src/$(LIBWEBSOCKETS_DIR)
1190	$(CD) $(TARGET_X86)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_X86_ENV) $(MAKE)
1191	$(CD) $(TARGET_X86)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_X86_ENV) $(MAKE) install
1192
1193$(TARGET_X86_64)/lib/libwebsockets.a: $(TARGET_X86_64)/src/$(LIBWEBSOCKETS_DIR)
1194	$(CD) $(TARGET_X86_64)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_X86_64_ENV) $(MAKE)
1195	$(CD) $(TARGET_X86_64)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_X86_64_ENV) $(MAKE) install
1196
1197$(TARGET_ARM)/lib/libwebsockets.a: $(TARGET_ARM)/src/$(LIBWEBSOCKETS_DIR)
1198	$(CD) $(TARGET_ARM)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM_ENV) $(MAKE)
1199	$(CD) $(TARGET_ARM)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM_ENV) $(MAKE) install
1200
1201$(TARGET_ARM_V7A)/lib/libwebsockets.a: $(TARGET_ARM_V7A)/src/$(LIBWEBSOCKETS_DIR)
1202	$(CD) $(TARGET_ARM_V7A)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM_V7A_ENV) $(MAKE)
1203	$(CD) $(TARGET_ARM_V7A)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM_V7A_ENV) $(MAKE) install
1204
1205$(TARGET_ARM_V7A_HARD)/lib/libwebsockets.a: $(TARGET_ARM_V7A_HARD)/src/$(LIBWEBSOCKETS_DIR)
1206	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM_V7A_HARD_ENV) $(MAKE)
1207	$(CD) $(TARGET_ARM_V7A_HARD)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM_V7A_HARD_ENV) $(MAKE) install
1208
1209$(TARGET_ARM64_V8A)/lib/libwebsockets.a: $(TARGET_ARM64_V8A)/src/$(LIBWEBSOCKETS_DIR)
1210	$(CD) $(TARGET_ARM64_V8A)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM64_V8A_ENV) $(MAKE)
1211	$(CD) $(TARGET_ARM64_V8A)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_ARM64_V8A_ENV) $(MAKE) install
1212
1213$(TARGET_MIPS)/lib/libwebsockets.a: $(TARGET_MIPS)/src/$(LIBWEBSOCKETS_DIR)
1214	$(CD) $(TARGET_MIPS)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_MIPS_ENV) $(MAKE)
1215	$(CD) $(TARGET_MIPS)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_MIPS_ENV) $(MAKE) install
1216
1217$(TARGET_MIPS64)/lib/libwebsockets.a: $(TARGET_MIPS64)/src/$(LIBWEBSOCKETS_DIR)
1218	$(CD) $(TARGET_MIPS64)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_MIPS64_ENV) $(MAKE)
1219	$(CD) $(TARGET_MIPS64)/src/$(LIBWEBSOCKETS_DIR)/build && $(TOOLCHAIN_MIPS64_ENV) $(MAKE) install
1220
1221#
1222# Some rules for housekeeping
1223#
1224
1225clean-ndk:
1226	$(NDK_ROOT)/ndk-build clean
1227
1228clean: clean-targets clean-toolchains
1229
1230dist-clean: clean clean-sources
1231
1232clean-targets: \
1233 clean-target-x86 \
1234 clean-target-x86_64 \
1235 clean-target-armeabi \
1236 clean-target-armeabi-v7a \
1237 clean-target-armeabi-v7a-hard \
1238 clean-target-arm64-v8a \
1239 clean-target-mips \
1240 clean-target-mips64
1241
1242clean-target-x86:
1243	-$(RM) -fr $(TARGET_X86)
1244
1245clean-target-x86_64:
1246	-$(RM) -fr $(TARGET_X86_64)
1247
1248clean-target-armeabi:
1249	-$(RM) -fr $(TARGET_ARM)
1250
1251clean-target-armeabi-v7a:
1252	-$(RM) -fr $(TARGET_ARM_V7A)
1253
1254clean-target-armeabi-v7a-hard:
1255	-$(RM) -fr $(TARGET_ARM_V7A_HARD)
1256
1257clean-target-arm64-v8a:
1258	-$(RM) -fr $(TARGET_ARM64_V8A)
1259
1260clean-target-mips:
1261	-$(RM) -fr $(TARGET_MIPS)
1262
1263clean-target-mips64:
1264	-$(RM) -fr $(TARGET_MIPS64)
1265
1266clean-sources: \
1267 clean-source-zlib \
1268 clean-source-openssl \
1269 clean-source-libwebsockets
1270
1271clean-source-zlib:
1272	-$(RM) $(ZLIB_TGZ_SOURCE)
1273
1274clean-source-openssl:
1275	-$(RM) $(OPENSSL_TGZ_SOURCE)
1276
1277clean-source-libwebsockets:
1278	-$(RM) $(LIBWEBSOCKETS_TGZ_SOURCE)
1279
1280clean-toolchains: \
1281 clean-toolchain-x86 \
1282 clean-toolchain-x86_64 \
1283 clean-toolchain-armeabi \
1284 clean-toolchain-armeabi-v7a \
1285 clean-toolchain-armeabi-v7a-hard \
1286 clean-toolchain-arm64-v8a \
1287 clean-toolchain-mips \
1288 clean-toolchain-mips64
1289	-$(RM) -fr toolchains
1290
1291clean-toolchain-x86:
1292	-$(RM) -fr $(TOOLCHAIN_X86)
1293
1294clean-toolchain-x86_64:
1295	-$(RM) -fr $(TOOLCHAIN_X86_64)
1296
1297clean-toolchain-armeabi:
1298	-$(RM) -fr $(TOOLCHAIN_ARM)
1299
1300clean-toolchain-armeabi-v7a:
1301	-$(RM) -fr $(TOOLCHAIN_ARM_V7A)
1302
1303clean-toolchain-armeabi-v7a-hard:
1304	-$(RM) -fr $(TOOLCHAIN_ARM_V7A_HARD)
1305
1306clean-toolchain-arm64-v8a:
1307	-$(RM) -fr $(TOOLCHAIN_ARM64_V8A)
1308
1309clean-toolchain-mips:
1310	-$(RM) -fr $(TOOLCHAIN_MIPS)
1311
1312clean-toolchain-mips64:
1313	-$(RM) -fr $(TOOLCHAIN_MIPS64)
1314
1315# 'make list-targets' prints a list of all targets.
1316# Thanks to: http://stackoverflow.com/questions/4219255/how-do-you-get-the-list-of-targets-in-a-makefile
1317# Modified to allow us to include files in this Makefile.
1318list-targets: MAKE_NO_INCLUDES := 1
1319export MAKE_NO_INCLUDES
1320list-targets:
1321	@$(MAKE) -s list-targets-no-includes
1322list-targets-no-includes:
1323	@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | $(AWK) -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | $(SORT) | $(EGREP) -v -e '^[^[:alnum:]]' -e '^$@$$'
1324
1325