aboutsummaryrefslogtreecommitdiff
path: root/Android.bp
blob: 5c3a87986735c33cb656ec07052a9e6e5e5154ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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",
    ],
}