Change Android.mk to only compile a single .a file

This will require any android application to include their own shared library rules similar to the following;

include $(CLEAR_VARS)
LOCAL_STATIC_LIBRARIES := servaldstatic
LOCAL_C_INCLUDES += $(LOCAL_PATH)/serval-dna
LOCAL_SRC_FILES := $(LOCAL_PATH)/features.c
LOCAL_MODULE := servaldaemon
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
include $(BUILD_SHARED_LIBRARY)

Allowing just the set of required features to be linked into the final binary
This commit is contained in:
Jeremy Lakeman 2018-04-03 15:37:14 +09:30
parent 4809d7d585
commit 5c2f553ed2

View File

@ -56,36 +56,11 @@ SERVALD_LOCAL_CFLAGS = \
SERVALD_LOCAL_LDLIBS = -L$(SYSROOT)/usr/lib -llog
SERVALD_LOCAL_STATIC_LIBRARIES += sodium
# Build libservald.so
# Build libservaldtatic.a
include $(CLEAR_VARS)
LOCAL_STATIC_LIBRARIES := $(SERVALD_LOCAL_STATIC_LIBRARIES)
LOCAL_SRC_FILES := $(SERVALD_SRC_FILES) version_servald.c
LOCAL_CFLAGS += $(SERVALD_LOCAL_CFLAGS)
LOCAL_C_INCLUDES += $(SODIUM_INCLUDE)
LOCAL_LDLIBS := $(SERVALD_LOCAL_LDLIBS)
LOCAL_MODULE := servaldaemon
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
LOCAL_MODULE := servaldstatic
include $(BUILD_STATIC_LIBRARY)