aboutsummaryrefslogtreecommitdiff
path: root/BUILD
blob: 6dcc133f222a78d50939c7248a379da4183d4877 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Description:
#   Brotli is a generic-purpose lossless compression algorithm.

package(
    default_visibility = ["//visibility:public"],
)

licenses(["notice"])  # MIT

STRICT_COMPILER_OPTIONS = [
    "--pedantic-errors",
    "-Wall",
    "-Wconversion",
    "-Werror",
    "-Wextra",
    "-Wlong-long",
    "-Wmissing-declarations",
    "-Wno-strict-aliasing",
    "-Wshadow",
    "-Wsign-compare",
]

STRICT_C_OPTIONS = STRICT_COMPILER_OPTIONS + [
    "-Wmissing-prototypes",
]

COMMON_HEADERS = [
    "common/constants.h",
    "common/dictionary.h",
    "common/port.h",
    "common/types.h",
]

COMMON_SOURCES = [
    "common/dictionary.c",
]

DEC_HEADERS = [
    "dec/bit_reader.h",
    "dec/context.h",
    "dec/decode.h",
    "dec/huffman.h",
    "dec/port.h",
    "dec/prefix.h",
    "dec/state.h",
    "dec/transform.h",
]

DEC_SOURCES = [
    "dec/bit_reader.c",
    "dec/decode.c",
    "dec/huffman.c",
    "dec/state.c",
]

ENC_HEADERS = [
    "enc/backward_references.h",
    "enc/backward_references_inc.h",
    "enc/bit_cost.h",
    "enc/bit_cost_inc.h",
    "enc/block_encoder_inc.h",
    "enc/block_splitter.h",
    "enc/block_splitter_inc.h",
    "enc/brotli_bit_stream.h",
    "enc/cluster.h",
    "enc/cluster_inc.h",
    "enc/command.h",
    "enc/compress_fragment.h",
    "enc/compress_fragment_two_pass.h",
    "enc/context.h",
    "enc/dictionary_hash.h",
    "enc/encode.h",
    "enc/entropy_encode.h",
    "enc/entropy_encode_static.h",
    "enc/fast_log.h",
    "enc/find_match_length.h",
    "enc/hash.h",
    "enc/hash_longest_match_inc.h",
    "enc/hash_longest_match_quickly_inc.h",
    "enc/histogram.h",
    "enc/histogram_inc.h",
    "enc/literal_cost.h",
    "enc/memory.h",
    "enc/metablock.h",
    "enc/metablock_inc.h",
    "enc/port.h",
    "enc/prefix.h",
    "enc/ringbuffer.h",
    "enc/static_dict.h",
    "enc/static_dict_lut.h",
    "enc/utf8_util.h",
    "enc/write_bits.h",
]

ENC_SOURCES = [
    "enc/backward_references.c",
    "enc/bit_cost.c",
    "enc/block_splitter.c",
    "enc/brotli_bit_stream.c",
    "enc/cluster.c",
    "enc/compress_fragment.c",
    "enc/compress_fragment_two_pass.c",
    "enc/encode.c",
    "enc/entropy_encode.c",
    "enc/histogram.c",
    "enc/literal_cost.c",
    "enc/memory.c",
    "enc/metablock.c",
    "enc/static_dict.c",
    "enc/utf8_util.c",
]

cc_library(
    name = "brotli_common",
    srcs = COMMON_SOURCES,
    hdrs = COMMON_HEADERS,
    copts = STRICT_C_OPTIONS,
)

cc_library(
    name = "brotli_dec",
    srcs = DEC_SOURCES,
    hdrs = DEC_HEADERS,
    copts = STRICT_C_OPTIONS,
    deps = [
        ":brotli_common",
    ],
)

cc_library(
    name = "brotli_enc",
    srcs = ENC_SOURCES,
    hdrs = ENC_HEADERS,
    copts = STRICT_C_OPTIONS,
    deps = [
        ":brotli_common",
    ],
)

cc_binary(
    name = "bro",
    srcs = ["tools/bro.cc"],
    copts = STRICT_COMPILER_OPTIONS,
    deps = [
        ":brotli_dec",
        ":brotli_enc",
    ],
)