Reconfig libc's Android.mk to build for multilib

1. Moved arch-specific setup to their own files:
    - <arch>/<arch>.mk, arch-specific configs. Variables in those config
      end with the arch name.
    - removed the extra complexity introduced by function libc-add-cpu-variant-src,
      which seems to be not very useful these days.
2. Separated out the crt object files generation rules and set up the
   rules for both TARGET_ARCH and TARGET_2ND_ARCH.
3. Build all the libraries for both TARGET_ARCH and TARGET_2ND_ARCH,
  with the arch-specific LOCAL_ variables.

Bug: 11654773
Change-Id: I9c2d85db0affa49199d182236d2210060a321421
diff --git a/libc/arch-arm64/arm64.mk b/libc/arch-arm64/arm64.mk
index 11894f1..4b47c6d 100644
--- a/libc/arch-arm64/arm64.mk
+++ b/libc/arch-arm64/arm64.mk
@@ -1,4 +1,45 @@
-_LIBC_ARCH_COMMON_SRC_FILES := \
+# arm64 specific configs
+
+libc_common_src_files_arm64 := \
+    bionic/memchr.c   \
+    bionic/memcmp.c   \
+    bionic/memcpy.c   \
+    bionic/memmove.c  \
+    bionic/memrchr.c  \
+    bionic/memset.c   \
+    bionic/strchr.cpp \
+    bionic/strnlen.c  \
+    string/bcopy.c    \
+    string/index.c    \
+    string/memcmp16.c \
+    string/strcat.c   \
+    string/strcmp.c   \
+    string/strcpy.c   \
+    string/strlcat.c  \
+    string/strlcpy.c  \
+    string/strlen.c   \
+    string/strncat.c  \
+    string/strncmp.c  \
+    string/strncpy.c  \
+    string/strrchr.c  \
+    upstream-freebsd/lib/libc/string/wcscat.c \
+    upstream-freebsd/lib/libc/string/wcschr.c \
+    upstream-freebsd/lib/libc/string/wcscmp.c \
+    upstream-freebsd/lib/libc/string/wcscpy.c \
+    upstream-freebsd/lib/libc/string/wcslen.c \
+    upstream-freebsd/lib/libc/string/wcsrchr.c \
+    upstream-freebsd/lib/libc/string/wmemcmp.c \
+
+# Fortify implementations of libc functions.
+libc_common_src_files_arm64 += \
+    bionic/__memcpy_chk.cpp \
+    bionic/__memset_chk.cpp \
+    bionic/__strcpy_chk.cpp \
+    bionic/__strcat_chk.cpp \
+
+##########################################
+### CPU specific source files
+libc_bionic_src_files_arm64 := \
     arch-arm64/bionic/__bionic_clone.S \
     arch-arm64/bionic/bzero_arm64.c \
     arch-arm64/bionic/_exit_with_stack_teardown.S \
@@ -11,3 +52,20 @@
     arch-arm64/bionic/sigsetjmp.S \
     arch-arm64/bionic/syscall.S \
     arch-arm64/bionic/vfork.S \
+
+# These are used by the static and dynamic versions of the libc
+# respectively.
+libc_arch_static_src_files_arm64 :=
+
+libc_arch_dynamic_src_files_arm64 :=
+
+##########################################
+# crt-related
+libc_crt_target_cflags_arm64 := \
+    -I$(LOCAL_PATH)/arch-arm64/include
+
+libc_crt_target_crtbegin_file_arm64 := \
+    $(LOCAL_PATH)/arch-arm64/bionic/crtbegin.c
+
+libc_crt_target_crtbegin_so_file_arm64 := \
+    $(LOCAL_PATH)/arch-common/bionic/crtbegin_so.c