diff options
author | Dan Willemsen <dwillemsen@google.com> | 2018-05-22 15:49:53 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2018-05-22 16:40:06 -0700 |
commit | f7ef90467cb960cee378cce41238418809c86329 (patch) | |
tree | dd27a40e069b5f5c781112702b4d4c9ca69f8f2a | |
parent | 144b09c2e779ebe798042d09bb0a82331f4b8ed1 (diff) | |
download | flex-f7ef90467cb960cee378cce41238418809c86329.tar.gz |
Add an Android.bp to build flex
Test: prebuilts/build-tools/build-prebuilts.sh (on linux and mac)
Test: build flex with old and new binaries, outputs identical
Change-Id: I57407874f40bd08e828d9a5c03a1093d2640ae62
-rw-r--r-- | Android.bp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..5c3a879 --- /dev/null +++ b/Android.bp @@ -0,0 +1,70 @@ +cc_binary_host { + name: "flex", + + stl: "none", + srcs: [ + "ccl.c", + "dfa.c", + "ecs.c", + "scanflags.c", + "gen.c", + "main.c", + "misc.c", + "nfa.c", + "parse.y", + "scan.l", + "sym.c", + "tblcmp.c", + "yylex.c", + "options.c", + "scanopt.c", + "buf.c", + "tables.c", + "tables_shared.c", + "filter.c", + "regex.c", + + ":flex_skel.c", + ], + + cflags: [ + "-DHAVE_ALLOCA=1", + "-DHAVE_LIMITS_H=1", + "-DHAVE_UNISTD_H=1", + "-DHAVE_NETINET_IN_H=1", + "-DHAVE_SYS_WAIT_H=1", + "-DHAVE_STDBOOL_H=1", + "-DHAVE_REGEX_H=1", + "-DSTDC_HEADERS=1", + "-DVERSION=\"2.5.39\"", + + // TODO: This should use a hermetic m4 -- this is a default that can be overwritten + // overwritten with the M4 environment variable, which may be simpler within the build. + "-DM4=\"m4\"", + + "-Wno-unused-parameter", + "-Wno-unused-variable", + "-Wno-unused-label", + + "-Wno-error=dangling-else", + "-Wno-error=incompatible-pointer-types-discards-qualifiers", + "-Wno-error=int-conversion", + ], +} + +genrule { + name: "flex_skel.c", + // This is lightly modified from Makefile.am + cmd: "sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' $(in) | m4 -P -I $$(dirname $(in)) -DFLEX_MAJOR_VERSION=2 -DFLEX_MINOR_VERSION=5 -DFLEX_SUBMINOR_VERSION=39 | sed 's/m4postproc_/m4_/g' | /bin/bash $(location mkskel.sh) >$(out)", + tool_files: [ + "mkskel.sh", + "flexint.h", + "tables_shared.h", + ], + srcs: [ + "flex.skl", + ], + out: [ + "skel.c", + ], +} |