• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package(
2    default_visibility = ["//visibility:public"],
3)
4
5cc_library(
6    name = "libdivsufsort",
7    srcs = [
8        "lib/divsufsort.c",
9        "lib/sssort.c",
10        "lib/trsort.c",
11        "lib/utils.c",
12    ],
13    hdrs = [
14        "include/config.h",
15        "include/divsufsort.h",
16        "include/divsufsort_private.h",
17    ],
18    copts = [
19        "-DHAVE_CONFIG_H=1",
20    ],
21    includes = ["include"],
22)
23
24commom_awk_replaces = (
25    "gsub(/#cmakedefine/, \"#define\"); " +
26    "gsub(/@DIVSUFSORT_EXPORT@/, \"\"); " +
27    "gsub(/@DIVSUFSORT_IMPORT@/, \"\"); " +
28    "gsub(/@INLINE@/, \"inline\"); " +
29    "gsub(/@INCFILE@/, \"#include <inttypes.h>\"); " +
30    "gsub(/@SAUCHAR_TYPE@/, \"uint8_t\"); " +
31    "gsub(/@SAINT32_TYPE@/, \"int32_t\"); " +
32    "gsub(/@SAINT_PRId@/, \"PRId32\"); "
33)
34
35genrule(
36    name = "config_h",
37    srcs = ["include/config.h.cmake"],
38    outs = ["include/config.h"],
39    cmd = ("awk '{ " +
40           "gsub(/@HAVE_IO_H 1@/, \"HAVE_IO_H 0\"); " +
41           commom_awk_replaces +
42           "print; }' $(<) > $(@)"),
43)
44
45genrule(
46    name = "divsufsort_h",
47    srcs = ["include/divsufsort.h.cmake"],
48    outs = ["include/divsufsort.h"],
49    cmd = ("awk '{ " +
50           "gsub(/@W64BIT@/, \"\"); " +
51           "gsub(/@SAINDEX_TYPE@/, \"int32_t\"); " +
52           "gsub(/@SAINDEX_PRId@/, \"PRId32\"); " +
53           commom_awk_replaces +
54           "print; }' $(<) > $(@)"),
55)
56