OSDN Git Service

am 948ca12d: Merge "Set to /data/local/tmp, and use `id -un` to get the user\'s...
[android-x86/external-mksh.git] / mkmf.sh
diff --git a/mkmf.sh b/mkmf.sh
index 84e9845..fafa34b 100644 (file)
--- a/mkmf.sh
+++ b/mkmf.sh
@@ -49,41 +49,27 @@ LIBS=
 # possible to the values used later. (You also must example the
 # results gathered from Makefrag.inc to see they are the same
 # across all Android platforms, or add appropriate ifdefs.)
-# Since we no longer use the NDK, the AOSP has to have been
-# built before using this script (targetting generic/emulator).
+# Since we no longer use the NDK, AOSP has to have been
+# built before using this script.
+
+CC=$ANDROID_TOOLCHAIN/*-gcc
+
+target_arch=$(cd $ANDROID_BUILD_TOP; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core make --no-print-directory -f build/core/config.mk dumpvar-TARGET_ARCH)
 
-CC=$aospdir/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc
 addvar CPPFLAGS \
-    -I$aospdir/libnativehelper/include/nativehelper \
-    -isystem $aospdir/system/core/include \
-    -isystem $aospdir/hardware/libhardware/include \
-    -isystem $aospdir/hardware/libhardware_legacy/include \
-    -isystem $aospdir/hardware/ril/include \
-    -isystem $aospdir/libnativehelper/include \
-    -isystem $aospdir/frameworks/native/include \
-    -isystem $aospdir/frameworks/native/opengl/include \
-    -isystem $aospdir/frameworks/av/include \
-    -isystem $aospdir/frameworks/base/include \
-    -isystem $aospdir/frameworks/base/opengl/include \
-    -isystem $aospdir/external/skia/include \
-    -isystem $aospdir/out/target/product/generic/obj/include \
-    -isystem $aospdir/bionic/libc/arch-arm/include \
+    -isystem $aospdir/bionic/libc/arch-$target_arch/include \
     -isystem $aospdir/bionic/libc/include \
-    -isystem $aospdir/bionic/libstdc++/include \
-    -isystem $aospdir/bionic/libc/kernel/common \
-    -isystem $aospdir/bionic/libc/kernel/arch-arm \
+    -isystem $aospdir/bionic/libc/kernel/uapi \
+    -isystem $aospdir/bionic/libc/kernel/uapi/asm-$target_arch \
     -isystem $aospdir/bionic/libm/include \
-    -isystem $aospdir/bionic/libm/include/arm \
-    -isystem $aospdir/bionic/libthread_db/include \
-    -D_FORTIFY_SOURCE=1 \
-    -include $aospdir/build/core/combo/include/arch/linux-arm/AndroidConfig.h \
-    -I$aospdir/build/core/combo/include/arch/linux-arm/ \
+    -isystem $aospdir/bionic/libm/include/$target_arch \
+    -D_FORTIFY_SOURCE=2 \
+    -include $aospdir/build/core/combo/include/arch/linux-$target_arch/AndroidConfig.h \
+    -I$aospdir/build/core/combo/include/arch/linux-$target_arch/ \
     -DANDROID -DNDEBUG -UDEBUG
-# who would have thought the AOSP devs are funny? -fno-builtin-sin
 addvar CFLAGS \
     -fno-exceptions \
     -Wno-multichar \
-    -msoft-float \
     -fpic \
     -fPIE \
     -ffunction-sections \
@@ -93,14 +79,10 @@ addvar CFLAGS \
     -Wa,--noexecstack \
     -Werror=format-security \
     -fno-short-enums \
-    -march=armv7-a \
-    -mfloat-abi=softfp \
-    -mfpu=vfpv3-d16 \
     -Wno-unused-but-set-variable \
     -fno-builtin-sin \
     -fno-strict-volatile-bitfields \
     -Wno-psabi \
-    -mthumb-interwork \
     -fmessage-length=0 \
     -W \
     -Wall \
@@ -116,13 +98,13 @@ addvar CFLAGS \
     -fgcse-after-reload \
     -frerun-cse-after-loop \
     -frename-registers \
-    -mthumb \
     -Os \
     -fomit-frame-pointer \
     -fno-strict-aliasing
 addvar LDFLAGS \
     -nostdlib \
     -Bdynamic \
+    -fPIE \
     -pie \
     -Wl,-dynamic-linker,/system/bin/linker \
     -Wl,--gc-sections \
@@ -131,25 +113,23 @@ addvar LDFLAGS \
     -Wl,-z,relro \
     -Wl,-z,now \
     -Wl,--warn-shared-textrel \
-    -Wl,--icf=safe \
-    -Wl,--fix-cortex-a8 \
+    -Wl,--fatal-warnings \
     -Wl,--no-undefined \
-    $aospdir/out/target/product/generic/obj/lib/crtbegin_dynamic.o
+    $ANDROID_PRODUCT_OUT/obj/lib/crtbegin_dynamic.o
 addvar LIBS \
-    -L$aospdir/out/target/product/generic/obj/lib \
-    -Wl,-rpath-link=$aospdir/out/target/product/generic/obj/lib \
-    -lc \
+    -L$ANDROID_PRODUCT_OUT/obj/lib \
+    -Wl,-rpath-link=$ANDROID_PRODUCT_OUT/obj/lib \
     -Wl,--no-whole-archive \
-    $aospdir/out/target/product/generic/obj/STATIC_LIBRARIES/libcompiler-rt-extras_intermediates/libcompiler-rt-extras.a \
-    $aospdir/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/armv7-a/libgcc.a \
-    $aospdir/out/target/product/generic/obj/lib/crtend_android.o
+    $ANDROID_PRODUCT_OUT/obj/STATIC_LIBRARIES/libcompiler_rt-extras_intermediates/libcompiler_rt-extras.a \
+    -lc \
+    $ANDROID_PRODUCT_OUT/obj/lib/crtend_android.o
 
 
 ### Flags used by test builds
 if test $mkmfmode = 1; then
        addvar CPPFLAGS '-DMKSHRC_PATH=\"/system/etc/mkshrc\"'
        addvar CPPFLAGS '-DMKSH_DEFAULT_EXECSHELL=\"/system/bin/sh\"'
-       addvar CPPFLAGS '-DMKSH_DEFAULT_TMPDIR=\"/data/local/tmp\"'
+       addvar CPPFLAGS '-DMKSH_DEFAULT_TMPDIR=\"/data/local\"'
 fi
 
 ### Override flags
@@ -181,11 +161,6 @@ export HAVE_CAN_FNOSTRICTALIASING HAVE_CAN_FSTACKPROTECTORALL HAVE_CAN_WALL
 # even the idea of persistent history on a phone is funny
 HAVE_PERSISTENT_HISTORY=0; export HAVE_PERSISTENT_HISTORY
 
-# this is a run-time check and dependent on the target CPU
-# architecture (at _least_!) and cannot be auto-detected,
-# so always include the safety check even if unnecessary
-HAVE_SILENT_IDIVWRAPV=0; export HAVE_SILENT_IDIVWRAPV
-
 # ... and run it!
 export CC CPPFLAGS CFLAGS LDFLAGS LIBS TARGET_OS
 sh ../src/Build.sh $args