blob: fd5c7e961b75b7d9db618d0f6a38d660c23d846f [file] [log] [blame]
Serge Bazanski8ff4b7c2021-08-17 19:21:18 +02001load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
2load("@dev_source_monogon//build/utils:template_file.bzl", "template_file")
3
4template_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",
Lorenz Brun68dcee12021-08-31 13:12:07 +020010 },
Serge Bazanski8ff4b7c2021-08-17 19:21:18 +020011)
12
13# Headers which couldn't be decoupled into sub-libraries.
14cc_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.
64cc_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
Serge Bazanski8ff4b7c2021-08-17 19:21:18 +020091# MD5 library used by keys.c, which does #include "md5.c".
92cc_library(
93 name = "md5",
94 textual_hdrs = [
95 "md5.h",
96 "md5.c",
97 ],
98)
99
100cc_library(
101 name = "nameserv",
102 srcs = [
103 "nameserv.c",
104 "nameserv_async.h",
105 "nameserv_async.c",
106 ],
107 deps = [
108 ":common",
109 ],
110)
111
112cc_library(
113 name = "ntp",
114 srcs = [
115 "nts_ke_client.h",
116 "nts_ke_server.h",
117 "nts_ke_session.h",
118 "nts_ntp_client.h",
119 "nts_ntp_auth.h",
120 "nts_ntp_server.h",
121 "nts_ntp.h",
Serge Bazanski8ff4b7c2021-08-17 19:21:18 +0200122 "ntp_auth.h",
123 "ntp_auth.c",
124 "ntp_core.c",
125 "ntp_ext.h",
126 "ntp_ext.c",
127 "ntp_io.h",
128 "ntp_io.c",
129 "ntp_signd.h",
130 "ntp_sources.c",
131 ],
132 deps = [
133 ":common",
134 ":nameserv",
135 ],
136)
137
138cc_library(
139 name = "sys",
140 srcs = [
141 "sys.h",
142 "sys.c",
143 "sys_generic.h",
144 "sys_generic.c",
145 "sys_linux.h",
146 "sys_linux.c",
147 "sys_timex.h",
148 "sys_timex.c",
149 "sys_posix.h",
150 "sys_null.h",
151 "sys_null.c",
152 ],
153 deps = [
154 ":common",
155 "@seccomp//:seccomp",
Lorenz Brun68dcee12021-08-31 13:12:07 +0200156 "@cap//:cap",
Serge Bazanski8ff4b7c2021-08-17 19:21:18 +0200157 ],
158)
159
160cc_library(
161 name = "rtc",
162 srcs = [
163 "rtc.h",
164 "rtc.c",
165 "rtc_linux.h",
166 "rtc_linux.c",
167 ],
168 deps = [
169 ":common",
170 ":sys",
171 ],
172)
173
174cc_library(
175 name = "tempcomp",
176 srcs = [
177 "tempcomp.h",
178 "tempcomp.c",
179 ],
180 deps = [
181 ":common",
182 ],
183)
184
185cc_binary(
186 name = "chrony",
187 srcs = [
188 "hash_intmd5.c",
189 "main.h",
190 "main.c",
191 "stubs.c",
Serge Bazanski8ff4b7c2021-08-17 19:21:18 +0200192 ],
193 deps = [
194 ":common",
195 ":md5",
196 ":ntp",
197 ":rtc",
198 ":tempcomp",
199 ],
200 visibility = ["//visibility:public"],
201)