Serge Bazanski | 8ff4b7c | 2021-08-17 19:21:18 +0200 | [diff] [blame^] | 1 | load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") |
| 2 | load("@dev_source_monogon//build/utils:template_file.bzl", "template_file") |
| 3 | |
| 4 | template_file( |
| 5 | name = "config.h", |
| 6 | src = "@dev_source_monogon//third_party/chrony:config.h.in", |
| 7 | substitutions = { |
| 8 | # ONCHANGE(//third_party/chrony:external.bzl): version needs to be kept in sync |
| 9 | "%CHRONY_VERSION%": "4.1-monogon", |
| 10 | } |
| 11 | ) |
| 12 | |
| 13 | # Headers which couldn't be decoupled into sub-libraries. |
| 14 | cc_library( |
| 15 | name = "common_hdrs", |
| 16 | srcs = [ |
| 17 | ":config.h", |
| 18 | |
| 19 | # Headers corresponding to .c files in :common. |
| 20 | "addrfilt.h", |
| 21 | "array.h", |
| 22 | "clientlog.h", |
| 23 | "cmdparse.h", |
| 24 | "conf.h", |
| 25 | "keys.h", |
| 26 | "local.h", |
| 27 | "logging.h", |
| 28 | "memory.h", |
| 29 | "nameserv.h", |
| 30 | "reference.h", |
| 31 | "regress.h", |
| 32 | "samplefilt.h", |
| 33 | "sched.h", |
| 34 | "smooth.h", |
| 35 | "socket.h", |
| 36 | "sources.h", |
| 37 | "sourcestats.h", |
| 38 | "util.h", |
| 39 | |
| 40 | # Corresponding to .c files in :ntp. |
| 41 | "ntp_core.h", |
| 42 | "ntp_sources.h", |
| 43 | "nts_ke.h", |
| 44 | |
| 45 | # Other headers. |
| 46 | "addressing.h", |
| 47 | "candm.h", |
| 48 | "cmdmon.h", |
| 49 | "cmac.h", |
| 50 | "hash.h", |
| 51 | "localp.h", |
| 52 | "manual.h", |
| 53 | "ntp.h", |
| 54 | "privops.h", |
| 55 | "refclock.h", |
| 56 | "reports.h", |
| 57 | "siv.h", |
| 58 | "srcparams.h", |
| 59 | "sysincl.h", |
| 60 | ], |
| 61 | ) |
| 62 | |
| 63 | # Sources which couldn't be decoupled into sub-libraries. |
| 64 | cc_library( |
| 65 | name = "common", |
| 66 | srcs = [ |
| 67 | "addrfilt.c", |
| 68 | "array.c", |
| 69 | "clientlog.c", |
| 70 | "cmdparse.c", |
| 71 | "conf.c", |
| 72 | "keys.c", |
| 73 | "local.c", |
| 74 | "logging.c", |
| 75 | "memory.c", |
| 76 | "reference.c", |
| 77 | "regress.c", |
| 78 | "samplefilt.c", |
| 79 | "sched.c", |
| 80 | "smooth.c", |
| 81 | "socket.c", |
| 82 | "sources.c", |
| 83 | "sourcestats.c", |
| 84 | "util.c", |
| 85 | ], |
| 86 | deps = [ |
| 87 | ":common_hdrs", |
| 88 | ], |
| 89 | ) |
| 90 | |
| 91 | |
| 92 | # MD5 library used by keys.c, which does #include "md5.c". |
| 93 | cc_library( |
| 94 | name = "md5", |
| 95 | textual_hdrs = [ |
| 96 | "md5.h", |
| 97 | "md5.c", |
| 98 | ], |
| 99 | ) |
| 100 | |
| 101 | cc_library( |
| 102 | name = "nameserv", |
| 103 | srcs = [ |
| 104 | "nameserv.c", |
| 105 | "nameserv_async.h", |
| 106 | "nameserv_async.c", |
| 107 | ], |
| 108 | deps = [ |
| 109 | ":common", |
| 110 | ], |
| 111 | ) |
| 112 | |
| 113 | cc_library( |
| 114 | name = "ntp", |
| 115 | srcs = [ |
| 116 | "nts_ke_client.h", |
| 117 | "nts_ke_server.h", |
| 118 | "nts_ke_session.h", |
| 119 | "nts_ntp_client.h", |
| 120 | "nts_ntp_auth.h", |
| 121 | "nts_ntp_server.h", |
| 122 | "nts_ntp.h", |
| 123 | |
| 124 | "ntp_auth.h", |
| 125 | "ntp_auth.c", |
| 126 | "ntp_core.c", |
| 127 | "ntp_ext.h", |
| 128 | "ntp_ext.c", |
| 129 | "ntp_io.h", |
| 130 | "ntp_io.c", |
| 131 | "ntp_signd.h", |
| 132 | "ntp_sources.c", |
| 133 | ], |
| 134 | deps = [ |
| 135 | ":common", |
| 136 | ":nameserv", |
| 137 | ], |
| 138 | ) |
| 139 | |
| 140 | cc_library( |
| 141 | name = "sys", |
| 142 | srcs = [ |
| 143 | "sys.h", |
| 144 | "sys.c", |
| 145 | "sys_generic.h", |
| 146 | "sys_generic.c", |
| 147 | "sys_linux.h", |
| 148 | "sys_linux.c", |
| 149 | "sys_timex.h", |
| 150 | "sys_timex.c", |
| 151 | "sys_posix.h", |
| 152 | "sys_null.h", |
| 153 | "sys_null.c", |
| 154 | ], |
| 155 | deps = [ |
| 156 | ":common", |
| 157 | "@seccomp//:seccomp", |
| 158 | ], |
| 159 | ) |
| 160 | |
| 161 | cc_library( |
| 162 | name = "rtc", |
| 163 | srcs = [ |
| 164 | "rtc.h", |
| 165 | "rtc.c", |
| 166 | "rtc_linux.h", |
| 167 | "rtc_linux.c", |
| 168 | ], |
| 169 | deps = [ |
| 170 | ":common", |
| 171 | ":sys", |
| 172 | ], |
| 173 | ) |
| 174 | |
| 175 | cc_library( |
| 176 | name = "tempcomp", |
| 177 | srcs = [ |
| 178 | "tempcomp.h", |
| 179 | "tempcomp.c", |
| 180 | ], |
| 181 | deps = [ |
| 182 | ":common", |
| 183 | ], |
| 184 | ) |
| 185 | |
| 186 | cc_binary( |
| 187 | name = "chrony", |
| 188 | srcs = [ |
| 189 | "hash_intmd5.c", |
| 190 | "main.h", |
| 191 | "main.c", |
| 192 | "stubs.c", |
| 193 | |
| 194 | ], |
| 195 | deps = [ |
| 196 | ":common", |
| 197 | ":md5", |
| 198 | ":ntp", |
| 199 | ":rtc", |
| 200 | ":tempcomp", |
| 201 | ], |
| 202 | visibility = ["//visibility:public"], |
| 203 | ) |