Greg Hartman | 3c95aac | 2017-06-14 18:24:26 -0700 | [diff] [blame] | 1 | cc_library( |
| 2 | name = "gflags", |
| 3 | srcs = [ |
| 4 | ":generate_config_h", |
| 5 | ":generate_gflags_h", |
| 6 | ":generate_gflags_declare_h", |
| 7 | ":generate_gflags_completions_h", |
| 8 | "src/gflags.cc", |
| 9 | "src/gflags_completions.cc", |
| 10 | "src/gflags_reporting.cc", |
| 11 | "src/mutex.h", |
| 12 | "src/util.h", |
| 13 | ], |
| 14 | hdrs = [ |
| 15 | "gflags/gflags.h", |
| 16 | "gflags/gflags_completions.h", |
| 17 | "gflags/gflags_declare.h", |
| 18 | ], |
| 19 | copts = [ |
| 20 | "-I$(GENDIR)/external/gflags_repo/gflags", |
| 21 | "-Wno-sign-compare", |
| 22 | "-Wno-unused-local-typedefs", |
| 23 | ], |
| 24 | linkopts = ["-lpthread"], |
| 25 | visibility = ["//visibility:public"], |
| 26 | ) |
| 27 | |
| 28 | genrule( |
| 29 | name = "generate_config_h", |
| 30 | srcs = ["src/config.h.in"], |
| 31 | outs = ["gflags/config.h"], |
| 32 | cmd = ("sed -e 's/#cmakedefine OS_WINDOWS//'" + |
| 33 | " -e 's/#cmakedefine HAVE_SHLWAPI_H//'" + |
| 34 | " -e 's/#cmakedefine HAVE_STRTOQ//'" + |
| 35 | " -e 's/#cmakedefine/#define/'" + |
| 36 | " -e 's/@PROJECT_NAME@/gflags/g'" + |
| 37 | " -e 's/@PACKAGE_NAME@/gflags/g'" + |
| 38 | " -e 's/@PACKAGE_STRING@/gflags 2.1.2/g'" + |
| 39 | " -e 's/@PACKAGE_TARNAME@/gflags-2.1.2/g'" + |
| 40 | " -e 's/@PACKAGE_VERSION@/2.1.2/g'" + |
| 41 | " -e 's/@PACKAGE_BUGREPORT@//g'" + |
| 42 | " $< > $@"), |
| 43 | ) |
| 44 | |
| 45 | genrule( |
| 46 | name = "generate_gflags_h", |
| 47 | srcs = ["src/gflags.h.in"], |
| 48 | outs = ["gflags/gflags.h"], |
| 49 | cmd = ("sed -e 's/@GFLAGS_ATTRIBUTE_UNUSED@/__attribute((unused))/g'" + |
| 50 | " -e 's/@INCLUDE_GFLAGS_NS_H@//g'" + |
| 51 | " $< > $@"), |
| 52 | ) |
| 53 | |
| 54 | genrule( |
| 55 | name = "generate_gflags_completions_h", |
| 56 | srcs = ["src/gflags_completions.h.in"], |
| 57 | outs = ["gflags/gflags_completions.h"], |
| 58 | cmd = ("sed -e 's/@GFLAGS_NAMESPACE@/google/g'" + |
| 59 | " $< > $@"), |
| 60 | ) |
| 61 | |
| 62 | genrule( |
| 63 | name = "generate_gflags_declare_h", |
| 64 | srcs = ["src/gflags_declare.h.in"], |
| 65 | outs = ["gflags/gflags_declare.h"], |
| 66 | cmd = ("sed -e 's/@GFLAGS_NAMESPACE@/google/g'" + |
| 67 | " -e 's/@GFLAGS_IS_A_DLL@/0/g'" + |
| 68 | " -e 's/@HAVE_STDINT_H@/1/g'" + |
| 69 | " -e 's/@HAVE_SYS_TYPES_H@/1/g'" + |
| 70 | " -e 's/@HAVE_INTTYPES_H@/1/g'" + |
| 71 | " -e 's/@GFLAGS_INTTYPES_FORMAT_C99@/1/g'" + |
| 72 | " -e 's/@GFLAGS_INTTYPES_FORMAT_BSD@/0/g'" + |
| 73 | " -e 's/@GFLAGS_INTTYPES_FORMAT_VC7@/0/g'" + |
| 74 | " $< > $@"), |
| 75 | ) |
| 76 | |