diff options
author | Dan Willemsen <dwillemsen@google.com> | 2017-09-14 17:28:36 -0700 |
---|---|---|
committer | Treehugger Robot <treehugger-gerrit@google.com> | 2017-10-03 21:40:46 +0000 |
commit | 2acbec5a9a8b8c3c9d0eee268af7121e31d0cb63 (patch) | |
tree | 583fcee9e75910d6d4e0c80446860f2acfd75033 /gen_syscalls.sh | |
parent | 780aef7ec4b725fdffa634dd58773982bbd9b142 (diff) | |
download | minijail-2acbec5a9a8b8c3c9d0eee268af7121e31d0cb63.tar.gz |
Convert to Android.bp
See build/soong/README.md for more information.
gen.mk is currently using build system internals in order to tell the
gen_*.sh scripts how to call the compiler. Soong genrules do not provide
the required information to call a compiler, so use a `cc_object {}` to
do the preprocessing steps, and pass the output from that into the
gen_*.sh scripts (cc_genrule).
It fixes the missing dependencies for the 2nd arch, and uses the correct
libc headers for the _vendor variant.
Bug: 66914194
Test: mmma external/minijail
Test: cd external/minijail; make all tests
Test: out/host/linux-x86/nativetest/system_unittest_gtest/system_unittest_gtest
Test: out/host/linux-x86/nativetest64/system_unittest_gtest/system_unittest_gtest
Test: cd external/minijail; ../../out/host/linux-x86/nativetest/syscall_filter_unittest_gtest/syscall_filter_unittest_gtest
Test: cd external/minijail; ../../out/host/linux-x86/nativetest64/syscall_filter_unittest_gtest/syscall_filter_unittest_gtest
Change-Id: Id116afb24677ea386f1b043c71c59d3b7ffd8696
Diffstat (limited to 'gen_syscalls.sh')
-rwxr-xr-x | gen_syscalls.sh | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/gen_syscalls.sh b/gen_syscalls.sh index f31031b..69f8a46 100755 --- a/gen_syscalls.sh +++ b/gen_syscalls.sh @@ -14,23 +14,25 @@ set -e if [ $# -ne 1 ] && [ $# -ne 2 ]; then echo "Usage: $(basename "$0") OUTFILE" - echo "Usage: $(basename "$0") CC OUTFILE" + echo "Usage: $(basename "$0") INFILE OUTFILE" exit 1 fi +BUILD="${CC} -dD gen_syscalls.c -E" +GEN_DEPS=1 + if [ $# -eq 2 ]; then - CC="$1" + BUILD="cat $1" + GEN_DEPS=0 shift fi OUTFILE="$1" -# Generate a dependency file which helps the build tool to see when it -# should regenerate ${OUTFILE}. -echo '#include <asm/unistd.h>' | ${CC} - -E -M -MF "${OUTFILE}.d.tmp" -# Correct the output filename. -(echo "${OUTFILE}: \\" ; sed -e 's/^-\.o://' -e 's/^-://' "${OUTFILE}.d.tmp") \ - > "${OUTFILE}.d" -rm "${OUTFILE}.d.tmp" +if [ ${GEN_DEPS} -eq 1 ]; then + # Generate a dependency file which helps the build tool to see when it + # should regenerate ${OUTFILE}. + ${BUILD} -M -MF "${OUTFILE}.d" +fi # sed expression which extracts system calls that are # defined via asm/unistd.h. It converts them from: @@ -49,8 +51,7 @@ cat <<-EOF > "${OUTFILE}" #include <asm/unistd.h> #include "libsyscalls.h" const struct syscall_entry syscall_table[] = { -$(echo '#include <asm/unistd.h>' | \ - ${CC} -dD - -E | sed -Ene "${SED_MULTILINE}") +$(${BUILD} | sed -Ene "${SED_MULTILINE}") { NULL, -1 }, }; EOF |