New file |
| | |
| | | # 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-" |
| | | # ``` |
| | | |
| | | # set ARCH, NDKLEVEL |
| | | # ./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-" |
| | | |
| | | ARCH = arm |
| | | NDKLEVEL = 22 |
| | | 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 = |