1LOCAL_PATH := $(call my-dir)
2
3include $(CLEAR_VARS)
4LOCAL_MODULE := foo
5LOCAL_SRC_FILES := foo.c foo2.c
6include $(BUILD_STATIC_LIBRARY)
7
8# The GNU linker will strip un-needed object files from executables even whe
9# --whole-archive is used. However, it won't do it for shared libraries, so
10# create an intermediate one, called 'bar' that includes 'foo' as a whole
11# static library.
12include $(CLEAR_VARS)
13LOCAL_MODULE := bar
14LOCAL_WHOLE_STATIC_LIBRARIES := foo
15include $(BUILD_SHARED_LIBRARY)
16
17include $(CLEAR_VARS)
18LOCAL_MODULE := test_whole_static_libs
19LOCAL_SRC_FILES := main.c
20LOCAL_LDLIBS := -ldl
21include $(BUILD_EXECUTABLE)
22