Eugene Kliuchnikov | 378485b | 2016-06-16 10:52:57 +0200 | [diff] [blame^] | 1 | # Description: |
| 2 | # Brotli is a generic-purpose lossless compression algorithm. |
| 3 | |
| 4 | package( |
| 5 | default_visibility = ["//visibility:public"], |
| 6 | ) |
| 7 | |
| 8 | licenses(["notice"]) # MIT |
| 9 | |
| 10 | STRICT_COMPILER_OPTIONS = [ |
| 11 | "--pedantic-errors", |
| 12 | "-Wall", |
| 13 | "-Wconversion", |
| 14 | "-Werror", |
| 15 | "-Wextra", |
| 16 | "-Wlong-long", |
| 17 | "-Wmissing-declarations", |
| 18 | "-Wno-strict-aliasing", |
| 19 | "-Wshadow", |
| 20 | "-Wsign-compare", |
| 21 | ] |
| 22 | |
| 23 | STRICT_C_OPTIONS = STRICT_COMPILER_OPTIONS + [ |
| 24 | "-Wmissing-prototypes", |
| 25 | ] |
| 26 | |
| 27 | COMMON_HEADERS = [ |
| 28 | "common/constants.h", |
| 29 | "common/dictionary.h", |
| 30 | "common/port.h", |
| 31 | "common/types.h", |
| 32 | ] |
| 33 | |
| 34 | COMMON_SOURCES = [ |
| 35 | "common/dictionary.c", |
| 36 | ] |
| 37 | |
| 38 | DEC_HEADERS = [ |
| 39 | "dec/bit_reader.h", |
| 40 | "dec/context.h", |
| 41 | "dec/decode.h", |
| 42 | "dec/huffman.h", |
| 43 | "dec/port.h", |
| 44 | "dec/prefix.h", |
| 45 | "dec/state.h", |
| 46 | "dec/transform.h", |
| 47 | ] |
| 48 | |
| 49 | DEC_SOURCES = [ |
| 50 | "dec/bit_reader.c", |
| 51 | "dec/decode.c", |
| 52 | "dec/huffman.c", |
| 53 | "dec/state.c", |
| 54 | ] |
| 55 | |
| 56 | ENC_HEADERS = [ |
| 57 | "enc/backward_references.h", |
| 58 | "enc/backward_references_inc.h", |
| 59 | "enc/bit_cost.h", |
| 60 | "enc/bit_cost_inc.h", |
| 61 | "enc/block_encoder_inc.h", |
| 62 | "enc/block_splitter.h", |
| 63 | "enc/block_splitter_inc.h", |
| 64 | "enc/brotli_bit_stream.h", |
| 65 | "enc/cluster.h", |
| 66 | "enc/cluster_inc.h", |
| 67 | "enc/command.h", |
| 68 | "enc/compress_fragment.h", |
| 69 | "enc/compress_fragment_two_pass.h", |
| 70 | "enc/context.h", |
| 71 | "enc/dictionary_hash.h", |
| 72 | "enc/encode.h", |
| 73 | "enc/entropy_encode.h", |
| 74 | "enc/entropy_encode_static.h", |
| 75 | "enc/fast_log.h", |
| 76 | "enc/find_match_length.h", |
| 77 | "enc/hash.h", |
| 78 | "enc/hash_longest_match_inc.h", |
| 79 | "enc/hash_longest_match_quickly_inc.h", |
| 80 | "enc/histogram.h", |
| 81 | "enc/histogram_inc.h", |
| 82 | "enc/literal_cost.h", |
| 83 | "enc/memory.h", |
| 84 | "enc/metablock.h", |
| 85 | "enc/metablock_inc.h", |
| 86 | "enc/port.h", |
| 87 | "enc/prefix.h", |
| 88 | "enc/ringbuffer.h", |
| 89 | "enc/static_dict.h", |
| 90 | "enc/static_dict_lut.h", |
| 91 | "enc/utf8_util.h", |
| 92 | "enc/write_bits.h", |
| 93 | ] |
| 94 | |
| 95 | ENC_SOURCES = [ |
| 96 | "enc/backward_references.c", |
| 97 | "enc/bit_cost.c", |
| 98 | "enc/block_splitter.c", |
| 99 | "enc/brotli_bit_stream.c", |
| 100 | "enc/cluster.c", |
| 101 | "enc/compress_fragment.c", |
| 102 | "enc/compress_fragment_two_pass.c", |
| 103 | "enc/encode.c", |
| 104 | "enc/entropy_encode.c", |
| 105 | "enc/histogram.c", |
| 106 | "enc/literal_cost.c", |
| 107 | "enc/memory.c", |
| 108 | "enc/metablock.c", |
| 109 | "enc/static_dict.c", |
| 110 | "enc/utf8_util.c", |
| 111 | ] |
| 112 | |
| 113 | cc_library( |
| 114 | name = "brotli_common", |
| 115 | srcs = COMMON_SOURCES, |
| 116 | hdrs = COMMON_HEADERS, |
| 117 | copts = STRICT_C_OPTIONS, |
| 118 | ) |
| 119 | |
| 120 | cc_library( |
| 121 | name = "brotli_dec", |
| 122 | srcs = DEC_SOURCES, |
| 123 | hdrs = DEC_HEADERS, |
| 124 | copts = STRICT_C_OPTIONS, |
| 125 | deps = [ |
| 126 | ":brotli_common", |
| 127 | ], |
| 128 | ) |
| 129 | |
| 130 | cc_library( |
| 131 | name = "brotli_enc", |
| 132 | srcs = ENC_SOURCES, |
| 133 | hdrs = ENC_HEADERS, |
| 134 | copts = STRICT_C_OPTIONS, |
| 135 | deps = [ |
| 136 | ":brotli_common", |
| 137 | ], |
| 138 | ) |
| 139 | |
| 140 | cc_binary( |
| 141 | name = "bro", |
| 142 | srcs = ["tools/bro.cc"], |
| 143 | copts = STRICT_COMPILER_OPTIONS, |
| 144 | deps = [ |
| 145 | ":brotli_dec", |
| 146 | ":brotli_enc", |
| 147 | ], |
| 148 | ) |