xuxiuxi
2017-05-11 109ffe9a777658936a38d0c146579a67c60a0d17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# https://github.com/ph1ee/liveMedia-Android
 
# README.md
# Instructions
# ```sh
# $ ./genMakefiles android
# $ make NDKROOT="$HOME/.local/share/android/android-ndk-r13b" TOOLCHAINPREFIX="$HOME/.local/share/android/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-"
# ```
 
# for ARM
# set ARCH = arm, NDKLEVEL = 23
# ./genMakefiles android
# make NDKROOT="/opt/android-ndk-r13b" TOOLCHAINPREFIX="/opt/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-" clean
# make NDKROOT="/opt/android-ndk-r13b" TOOLCHAINPREFIX="/opt/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-"
# make NDKROOT="/opt/android-ndk-r13b" TOOLCHAINPREFIX="/opt/android-ndk-r13b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-" PREFIX="/opt/live.android/inst" install
 
#for x86
# ./genMakefiles android
# make NDKROOT="/opt/android-ndk-r13b" TOOLCHAINPREFIX="/opt/android-ndk-r13b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-" clean
# make NDKROOT="/opt/android-ndk-r13b" TOOLCHAINPREFIX="/opt/android-ndk-r13b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-"
# make NDKROOT="/opt/android-ndk-r13b" TOOLCHAINPREFIX="/opt/android-ndk-r13b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-" PREFIX="/opt/live.android/inst" install
 
ARCH = x86
NDKLEVEL = 23
ifeq ($(ARCH), arm)
  ifneq ($(APP_ABI), armeabi)
    CFLAGS += -march=armv7-a -mfloat-abi=softfp
    CFLAGS += -mfpu=vfpv3-d16
    LDFLAGS += -march=armv7-a -Wl,--fix-cortex-a8
    APP_ABI = armeabi-v7a
  endif
else ifeq ($(ARCH), arm64)
  APP_ABI = arm64-v8a
else ifeq ($(ARCH), x86)
  APP_ABI = x86
  ifeq (Yes, $(USE_ASM))
    ASMFLAGS += -f elf
  endif
else ifeq ($(ARCH), x86_64)
  APP_ABI = x86_64
  ifeq (Yes, $(USE_ASM))
    ASMFLAGS += -f elf64
  endif
else
  APP_ABI = $(ARCH)
endif
 
ifndef TOOLCHAINPREFIX
$(error TOOLCHAINPREFIX is not set)
endif
ifndef NDKROOT
$(error NDKROOT is not set)
endif
 
SYSROOT = $(NDKROOT)/platforms/android-$(NDKLEVEL)/arch-$(ARCH)
CXX = $(TOOLCHAINPREFIX)g++
CC = $(TOOLCHAINPREFIX)gcc
AR = $(TOOLCHAINPREFIX)ar
CFLAGS += -DANDROID_NDK -fpic --sysroot=$(SYSROOT) -MMD -MP
CXXFLAGS += -fno-rtti
LDFLAGS += --sysroot=$(SYSROOT)
 
ifneq ($(CXX),$(wildcard $(CXX)))
ifneq ($(CXX).exe,$(wildcard $(CXX).exe))
$(error Compiler not found, bad NDKROOT or ARCH?)
endif
endif
 
STL_INCLUDES = \
    -I$(NDKROOT)/sources/cxx-stl/stlport/stlport
STL_LIB = \
    $(NDKROOT)/sources/cxx-stl/stlport/libs/$(APP_ABI)/libstlport_static.a
 
COMPILE_OPTS = $(INCLUDES) -I. -O2 -DSOCKLEN_T=socklen_t -DNO_SSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DXLOCALE_NOT_USED=1 $(STL_INCLUDES) $(CFLAGS)
C = c
C_COMPILER = $(CC)
C_FLAGS = $(COMPILE_OPTS)
CPP = cpp
CPLUSPLUS_COMPILER = $(CXX)
CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -Wall -DBSD=1 $(CXXFLAGS)
OBJ = o
LINK = $(CXX) -o
LINK_OPTS =
CONSOLE_LINK_OPTS = $(LINK_OPTS) $(LDFLAGS)
LIBRARY_LINK = $(AR) cr # must preserve a trailing space here
LIBRARY_LINK_OPTS = $(LINK_OPTS)
LIB_SUFFIX = a
LIBS_FOR_CONSOLE_APPLICATION = $(STL_LIB)
LIBS_FOR_GUI_APPLICATION = $(STL_LIB)
EXE =