1LOCAL_PATH := $(call my-dir)
2
3include $(CLEAR_VARS)
4
5LOCAL_SRC_FILES:= \
6    debugger.cpp \
7    dlfcn.cpp \
8    linker.cpp \
9    linker_allocator.cpp \
10    linker_environ.cpp \
11    linker_phdr.cpp \
12    rt.cpp \
13
14LOCAL_SRC_FILES_arm     := arch/arm/begin.S
15LOCAL_SRC_FILES_arm64   := arch/arm64/begin.S
16LOCAL_SRC_FILES_x86     := arch/x86/begin.c
17LOCAL_SRC_FILES_x86_64  := arch/x86_64/begin.S
18LOCAL_SRC_FILES_mips    := arch/mips/begin.S
19LOCAL_SRC_FILES_mips64  := arch/mips64/begin.S
20
21LOCAL_LDFLAGS := \
22    -shared \
23    -Wl,-Bsymbolic \
24    -Wl,--exclude-libs,ALL \
25
26LOCAL_CFLAGS += \
27    -fno-stack-protector \
28    -Wstrict-overflow=5 \
29    -fvisibility=hidden \
30    -Wall -Wextra -Wunused -Werror \
31
32LOCAL_CONLYFLAGS += \
33    -std=gnu99 \
34
35LOCAL_CPPFLAGS += \
36    -std=gnu++11 \
37
38# We need to access Bionic private headers in the linker.
39LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/
40
41# we don't want crtbegin.o (because we have begin.o), so unset it
42# just for this module
43LOCAL_NO_CRT := true
44# TODO: split out the asflags.
45LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
46
47LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/linker_executable.mk
48
49LOCAL_STATIC_LIBRARIES := libc_nomalloc
50
51LOCAL_FORCE_STATIC_EXECUTABLE := true # not necessary when not including BUILD_EXECUTABLE
52
53LOCAL_2ND_ARCH_VAR_PREFIX := $(linker_2nd_arch_var_prefix)
54
55LOCAL_MODULE := linker
56LOCAL_MODULE_STEM_32 := linker
57LOCAL_MODULE_STEM_64 := linker64
58LOCAL_MULTILIB := both
59
60# Leave the symbols in the shared library so that stack unwinders can produce
61# meaningful name resolution.
62LOCAL_STRIP_MODULE := keep_symbols
63
64include $(LOCAL_PATH)/linker_executable.mk
65ifdef TARGET_2ND_ARCH
66LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
67OVERRIDE_BUILT_MODULE_PATH :=
68LOCAL_BUILT_MODULE :=
69LOCAL_INSTALLED_MODULE :=
70LOCAL_MODULE_STEM :=
71LOCAL_BUILT_MODULE_STEM :=
72LOCAL_INSTALLED_MODULE_STEM :=
73LOCAL_INTERMEDIATE_TARGETS :=
74include $(LOCAL_PATH)/linker_executable.mk
75endif
76
77include $(call first-makefiles-under,$(LOCAL_PATH))
78