Enable socket-raw on Android if pluto is enabled.
[strongswan.git] / Android.mk.in
1 LOCAL_PATH := $(call my-dir)
2 include $(CLEAR_VARS)
3
4 # whether pluto (IKEv1 daemon) is built. charon (IKEv2) is always enabled
5 strongswan_BUILD_PLUTO := true
6
7 # this is the list of plugins that are built into libstrongswan and charon
8 # also these plugins are loaded by default (if not changed in strongswan.conf)
9 strongswan_CHARON_PLUGINS := openssl fips-prf random pubkey pkcs1 \
10 pem xcbc hmac kernel-netlink socket-default android \
11 stroke eap-identity eap-mschapv2 eap-md5
12
13 ifneq ($(strongswan_BUILD_PLUTO),)
14 # if both daemons are enabled we use raw sockets in charon
15 strongswan_CHARON_PLUGINS := $(subst socket-default,socket-raw, \
16 $(strongswan_CHARON_PLUGINS))
17 # plugins loaded by pluto
18 strongswan_PLUTO_PLUGINS := openssl fips-prf random pubkey pkcs1 \
19 pem xcbc hmac kernel-netlink xauth
20 endif
21
22 # list of all plugins - used to enable them with the function below
23 strongswan_PLUGINS := $(sort $(strongswan_CHARON_PLUGINS) \
24 $(strongswan_PLUTO_PLUGINS))
25
26 # helper macros to only add source files for plugins included in the list above
27 # source files are relative to the android.mk that called the macro
28 plugin_enabled = $(findstring $(1), $(strongswan_PLUGINS))
29 add_plugin = $(if $(call plugin_enabled,$(1)), \
30 $(patsubst $(LOCAL_PATH)/%,%, \
31 $(wildcard \
32 $(subst %,$(subst -,_,$(strip $(1))), \
33 $(LOCAL_PATH)/plugins/%/%*.c \
34 ) \
35 ) \
36 ) \
37 )
38
39 # includes
40 strongswan_PATH := $(LOCAL_PATH)
41 libvstr_PATH := external/strongswan-support/vstr/include
42 libgmp_PATH := external/strongswan-support/gmp
43
44 # some definitions
45 strongswan_VERSION := "@PACKAGE_VERSION@"
46 strongswan_DIR := "/system/bin"
47 strongswan_SBINDIR := "/system/bin"
48 strongswan_PIDDIR := "/data/misc/vpn"
49 strongswan_PLUGINDIR := "$(strongswan_IPSEC_DIR)/ipsec"
50 strongswan_CONFDIR := "/system/etc"
51 strongswan_STRONGSWAN_CONF := "$(strongswan_CONFDIR)/strongswan.conf"
52
53 # CFLAGS (partially from a configure run using droid-gcc)
54 strongswan_CFLAGS := \
55 -Wno-format \
56 -Wno-pointer-sign \
57 -Wno-pointer-arith \
58 -Wno-sign-compare \
59 -Wno-strict-aliasing \
60 -DHAVE___BOOL \
61 -DHAVE_STDBOOL_H \
62 -DHAVE_ALLOCA_H \
63 -DHAVE_ALLOCA \
64 -DHAVE_CLOCK_GETTIME \
65 -DHAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC \
66 -DHAVE_PRCTL \
67 -DHAVE_LINUX_UDP_H \
68 -DHAVE_STRUCT_SADB_X_POLICY_SADB_X_POLICY_PRIORITY \
69 -DHAVE_IPSEC_MODE_BEET \
70 -DHAVE_IPSEC_DIR_FWD \
71 -DOPENSSL_NO_EC \
72 -DOPENSSL_NO_ECDSA \
73 -DOPENSSL_NO_ECDH \
74 -DOPENSSL_NO_ENGINE \
75 -DCAPABILITIES \
76 -DCAPABILITIES_NATIVE \
77 -DMONOLITHIC \
78 -DUSE_VSTR \
79 -DDEBUG \
80 -DROUTING_TABLE=0 \
81 -DROUTING_TABLE_PRIO=220 \
82 -DVERSION=\"$(strongswan_VERSION)\" \
83 -DPLUGINDIR=\"$(strongswan_PLUGINDIR)\" \
84 -DIPSEC_DIR=\"$(strongswan_DIR)\" \
85 -DIPSEC_PIDDIR=\"$(strongswan_PIDDIR)\" \
86 -DIPSEC_CONFDIR=\"$(strongswan_CONFDIR)\" \
87 -DSTRONGSWAN_CONF=\"$(strongswan_STRONGSWAN_CONF)\" \
88 -DDEV_RANDOM=\"/dev/random\" \
89 -DDEV_URANDOM=\"/dev/urandom\"
90
91 # only for Android 2.0+
92 strongswan_CFLAGS += \
93 -DHAVE_IN6ADDR_ANY
94
95 include $(addprefix $(LOCAL_PATH)/src/,$(addsuffix /Android.mk, \
96 charon \
97 libcharon \
98 libhydra \
99 libstrongswan \
100 libtncif \
101 libfreeswan \
102 pluto \
103 stroke \
104 whack \
105 starter \
106 ipsec \
107 ))