serval-dna/Android.mk
Andrew Bettison 29a771e315 Overhaul Makefile.in
Changed the built libraries and updated INSTALL.md accordingly:
- the 'servaldwrap' executable is now built
- libservald.[a,so] now contains the full daemon executable
- libservalclient.[a,so] contains the client library
- libserval.a is no longer built

Building the 'servaldwrap' executable is a step towards ensuring that
the libservald.so library can be linked and executed, without requiring
an Android build to reveal any failure.

Added the SOURCE_PREFIX variable that allows the make to be invoked from
within any current working directory, not just the serval-dna
repository's root directory.

Fixed the serval_version.o target to invoke the version_string.sh
script with the --repository=DIR option, so that the build will work
even if the current working directory is not within the serval-dna
repository.

Re-ordered and added some comments for clarity, and added some missing
.PHONY declarations.
2016-10-13 16:23:09 +10:30

83 lines
3.3 KiB
Makefile

# Included by top-level Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
SQLITE3_AMALGAMATION = sqlite-amalgamation-3140200
include $(LOCAL_PATH)/sourcefiles.mk
SERVALD_SRC_FILES = \
$(SQLITE3_SOURCES) \
$(SERVAL_CLIENT_SOURCES) \
$(MDP_CLIENT_SOURCES) \
$(SERVAL_DAEMON_SOURCES) \
$(ANDROIDONLY_SOURCES)
SQLITE3_INC := $(LOCAL_PATH)/$(SQLITE3_AMALGAMATION)
SERVALD_LOCAL_CFLAGS = \
-g \
-Wall -Wno-unused-variable \
-Wno-unused-but-set-variable \
-Wno-unused-value \
-Wno-unused-function \
-Werror \
-DSERVALD_VERSION="\"Android\"" -DSERVALD_COPYRIGHT="\"Android\"" \
-DINSTANCE_PATH="\"/data/data/org.servalproject/var/serval-node\"" \
-DSHELL -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" \
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" \
-DHAVE_FUNC_ATTRIBUTE_ERROR=1 \
-DHAVE_FUNC_ATTRIBUTE_ALIGNED=1 -DHAVE_VAR_ATTRIBUTE_SECTION=1 -DHAVE_FUNC_ATTRIBUTE_USED=1 \
-DHAVE_FUNC_ATTRIBUTE_ALLOC_SIZE=1 -DHAVE_FUNC_ATTRIBUTE_MALLOC=1 \
-DHAVE_FUNC_ATTRIBUTE_FORMAT=1 \
-DHAVE_FUNC_ATTRIBUTE_USED=1 -DHAVE_FUNC_ATTRIBUTE_UNUSED=1 \
-DHAVE_LIBC=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \
-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 \
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDIO_H=1 \
-DHAVE_ERRNO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRINGS_H=1 -DHAVE_UNISTD_H=1 \
-DHAVE_STRING_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_SOCKET_H=1 \
-DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_POLL_H=1 -DHAVE_NETDB_H=1 \
-DHAVE_JNI_H=1 -DHAVE_STRUCT_UCRED=1 -DHAVE_CRYPTO_SIGN_NACL_GE25519_H=1 \
-DBYTE_ORDER=_BYTE_ORDER -DHAVE_LINUX_STRUCT_UCRED -DUSE_ABSTRACT_NAMESPACE \
-DHAVE_BCOPY -DHAVE_BZERO -DHAVE_NETINET_IN_H -DHAVE_LSEEK64 -DSIZEOF_OFF_T=4 \
-DHAVE_LINUX_IF_H -DHAVE_SYS_STAT_H -DHAVE_SYS_VFS_H -DHAVE_LINUX_NETLINK_H -DHAVE_LINUX_RTNETLINK_H \
-DSQLITE_OMIT_DATETIME_FUNCS -DSQLITE_OMIT_COMPILEOPTION_DIAGS -DSQLITE_OMIT_DEPRECATED \
-DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_VIRTUALTABLE -DSQLITE_OMIT_AUTHORIZATION \
-I$(SQLITE3_INC)
SERVALD_LOCAL_LDLIBS = -L$(SYSROOT)/usr/lib -llog
SERVALD_LOCAL_STATIC_LIBRARIES += sodium
# Build libservald.so
include $(CLEAR_VARS)
LOCAL_STATIC_LIBRARIES := $(SERVALD_LOCAL_STATIC_LIBRARIES)
LOCAL_SRC_FILES := $(SERVALD_SRC_FILES) version_servald.c android.c
LOCAL_CFLAGS += $(SERVALD_LOCAL_CFLAGS)
LOCAL_C_INCLUDES += $(SODIUM_INCLUDE)
LOCAL_LDLIBS := $(SERVALD_LOCAL_LDLIBS)
LOCAL_MODULE := servald
include $(BUILD_SHARED_LIBRARY)
# Build servald executable, a wrapper around libservald.so
ifdef SERVALD_WRAP
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= servalwrap.c
LOCAL_MODULE:= servald
LOCAL_CFLAGS += -fPIE
LOCAL_LDFLAGS += -fPIE -pie
include $(BUILD_EXECUTABLE)
endif
# Build servald executable for use with gdb
ifdef SERVALD_SIMPLE
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= $(SERVALD_SRC_FILES) version_servald.c
LOCAL_CFLAGS += $(SERVALD_LOCAL_CFLAGS)
LOCAL_LDLIBS := $(SERVALD_LOCAL_LDLIBS)
LOCAL_C_INCLUDES += $(SODIUM_INCLUDE)
LOCAL_STATIC_LIBRARIES := $(SERVALD_LOCAL_STATIC_LIBRARIES)
LOCAL_MODULE:= servaldsimple
LOCAL_CFLAGS += -fPIE
LOCAL_LDFLAGS += -fPIE -pie
include $(BUILD_EXECUTABLE)
endif