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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
#
# Steps to compile for Android:
#
# 1) Download and extract the Android NDK from
# http://developer.android.com/sdk/ndk/index.html
# (e.g. into to /opt, otherwise call 'make NDK=')
#
# 2) Compile olsrd with the make command:
# make OS=android DEBUG=0 build_all
# (expect lots of warnings which is normal)
#
# 3) Install olsrd on your local PC, e.g.
# sudo make OS=android DEBUG=0 install_all
# which creates a /data directory on your PC.
#
# 4) Change /data/local/etc/olsrd.conf. You need
# to adapt the 'Interfaces' line, e.g. to use
# the eth0 on your android mobile. Also, the
# LoadPlugin lines needs adaption, e.g. you
# need "/data/local/lib/olsrd_txtinfo.so.0.1"
#
# 5) Copy all file from /data to your mobile, e.g.
# by pushing the files with the 'adb' tool.
#
#
# LINUX SPECIFIC CONFIGURATION
#
PREFIX ?= /data/local
SBINDIR = $(PREFIX)/bin
ETCDIR = $(PREFIX)/etc
LIBDIR = $(PREFIX)/lib
DOCDIR =
MANDIR =
SRCS += $(wildcard src/linux/*.c src/unix/*.c)
HDRS += $(wildcard src/linux/*.h src/unix/*.h)
CPPFLAGS += -Dlinux -DLINUX_NETLINK_ROUTING
CPPFLAGS += -Dandroid
# bionic libc: missing declaration
CPPFLAGS += -DINET_ADDRSTRLEN=16
# bionic libc: missing declarations
CPPFLAGS += -D'IPTOS_PREC(tos)=((tos)&0xe0)'
CPPFLAGS += -D'IPTOS_TOS(tos)=((tos)&0x1e)'
CPPFLAGS += -DOLSRD_GLOBAL_CONF_FILE=\"$(CFGFILE)\"
# Compilation flags from build/toolchains/arm-eabi-4.2.1/setup.mk
CPPFLAGS += \
-march=armv5te -mtune=xscale \
-msoft-float -fpic \
-mthumb-interwork \
-ffunction-sections \
-funwind-tables \
-fstack-protector \
-fno-short-enums \
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \
-D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__
ifeq ($(DEBUG),0)
CPPFLAGS += \
-fomit-frame-pointer \
-fstrict-aliasing \
-funswitch-loops \
-finline-limit=300
else
CPPFLAGS += \
-fno-omit-frame-pointer \
-fno-strict-aliasing
endif
PLUGIN_SONAME ?= $(PLUGIN_NAME)
PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
INSTALL_LIB = install -D -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME); \
/sbin/ldconfig -n $(LIBDIR)
UNINSTALL_LIB = rm -f $(LIBDIR)/$(PLUGIN_FULLNAME); \
/sbin/ldconfig -n $(LIBDIR)
ifdef OLSRD_PLUGIN
GENERATE_PIC = true
endif
ifdef GENERATE_PIC
CFLAGS += -fPIC
LDFLAGS += -fPIC
endif
NDK = /opt/android-ndk-r4b
NDK_ARCH = $(NDK)/build/platforms/android-3/arch-arm
ifneq ($(shell uname -m),armv6l)
# You are not compiling with Debian direct on the phone
CURRENT_SYSTEM = $(shell uname -s | tr A-Z a-z)
CROSS_COMPILE = $(NDK)/build/prebuilt/$(CURRENT_SYSTEM)-x86/arm-eabi-4.2.1/bin/arm-eabi-
CC = $(CROSS_COMPILE)gcc
ifeq ($(DEBUG),0)
STRIP = $(CROSS_COMPILE)strip
endif
endif
CFLAGS += -I$(NDK_ARCH)/usr/include
CFLAGS += -I$(TOPDIR)/android
LDFLAGS += -nostartfiles -nodefaultlibs -nostdlib -Bdynamic
LDFLAGS += -Wl,--dynamic-linker -Wl,/system/bin/linker
LDFLAGS += -L$(NDK_ARCH)/usr/lib
LDFLAGS += -Wl,-rpath-link -Wl,$(NDK_ARCH)/usr/lib
LDFLAGS += -llog
ifndef OLSRD_PLUGIN
LDFLAGS += $(NDK_ARCH)/usr/lib/crtbegin_dynamic.o
endif
LIBS += -Wl,-lc -Wl,-lm -Wl,-lgcc
ifndef OLSRD_PLUGIN
LIBS += $(NDK_ARCH)/usr/lib/crtend_android.o
endif
# Local Variables:
# mode: makefile
# End:
|