Only include C files that start with the plugin name when building for Android.
[strongswan.git] / Android.mk.in
1 LOCAL_PATH := $(call my-dir)
2 include $(CLEAR_VARS)
3
4 # this is the list of plugins that are built into libstrongswan and charon
5 # also these plugins are loaded by default (if not changed in strongswan.conf)
6 strongswan_PLUGINS := openssl fips-prf random x509 pubkey pkcs1 \
7 pem xcbc hmac kernel-netlink socket-default android
8
9 # helper macros to only add source files for plugins included in the list above
10 # source files are relative to the android.mk that called the macro
11 plugin_enabled = $(findstring $(1), $(strongswan_PLUGINS))
12 add_plugin = $(if $(call plugin_enabled,$(1)), \
13 $(patsubst $(LOCAL_PATH)/%,%, \
14 $(wildcard \
15 $(subst %,$(subst -,_,$(strip $(1))), \
16 $(LOCAL_PATH)/plugins/%/%*.c \
17 ) \
18 ) \
19 ) \
20 )
21
22 # includes
23 strongswan_PATH := $(LOCAL_PATH)
24 libvstr_PATH := external/strongswan-support/vstr/include
25 libgmp_PATH := external/strongswan-support/gmp
26
27 # CFLAGS (partially from a configure run using droid-gcc)
28 strongswan_CFLAGS := \
29 -Wno-format \
30 -Wno-pointer-sign \
31 -Wno-pointer-arith \
32 -Wno-sign-compare \
33 -Wno-strict-aliasing \
34 -DHAVE___BOOL \
35 -DHAVE_STDBOOL_H \
36 -DHAVE_ALLOCA_H \
37 -DHAVE_ALLOCA \
38 -DHAVE_CLOCK_GETTIME \
39 -DHAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC \
40 -DHAVE_PRCTL \
41 -DHAVE_LINUX_UDP_H \
42 -DHAVE_STRUCT_SADB_X_POLICY_SADB_X_POLICY_PRIORITY \
43 -DHAVE_IPSEC_MODE_BEET \
44 -DHAVE_IPSEC_DIR_FWD \
45 -DMONOLITHIC \
46 -DUSE_VSTR \
47 -DROUTING_TABLE=0 \
48 -DROUTING_TABLE_PRIO=220 \
49 -DVERSION=\"@PACKAGE_VERSION@\" \
50 -DPLUGINS='"$(strongswan_PLUGINS)"' \
51 -DIPSEC_DIR=\"/system/bin\" \
52 -DIPSEC_PIDDIR=\"/data/misc/vpn\" \
53 -DSTRONGSWAN_CONF=\"/system/etc/strongswan.conf\" \
54 -DDEV_RANDOM=\"/dev/random\" \
55 -DDEV_URANDOM=\"/dev/urandom\"
56
57 # only for Android 2.0+
58 strongswan_CFLAGS += \
59 -DHAVE_IN6ADDR_ANY
60
61 include $(addprefix $(LOCAL_PATH)/src/,$(addsuffix /Android.mk, \
62 charon \
63 libcharon \
64 libhydra \
65 libstrongswan \
66 ))