1 # Copyright the NTPsec project contributors
3 # SPDX-License-Identifier: BSD-2-Clause
5 from waflib
.Configure
import conf
6 from waflib
.Logs
import pprint
8 # Note: When you change this list. also check the following files:
10 # include/ntp_refclock.h
11 # ntpd/refclock_conf.c
16 "descr": "Undisciplined Local Clock",
17 "define": "CLOCK_LOCAL",
22 "descr": "Spectracom GPS Receivers",
23 "define": "CLOCK_SPECTRACOM",
28 "descr": "TrueTime GPS/GOES/OMEGA Receivers",
29 "define": "CLOCK_TRUETIME",
34 "descr": "Generic Reference Driver (Parse)",
35 "define": "CLOCK_GENERIC",
41 "descr": "Arbiter 1088A/B GPS Receiver",
42 "define": "CLOCK_ARBITER",
47 "descr": "NIST/USNO/PTB Modem Time Services",
48 "define": "CLOCK_MODEM",
53 "descr": "Generic NMEA GPS Receiver",
54 "define": "CLOCK_NMEA",
59 "descr": "PPS Clock Discipline",
60 "define": "CLOCK_PPS",
61 "require": ["ppsapi"],
66 "descr": "Hewlett Packard 58503A GPS Receiver",
67 "define": "CLOCK_HPGPS",
72 "descr": "Shared Memory Driver",
73 "define": "CLOCK_SHM",
78 "descr": "Trimble Navigation GPSes",
79 "define": "CLOCK_TRIMBLE",
84 "descr": "Motorola UT Oncore GPS",
85 "define": "CLOCK_ONCORE",
86 "require": ["ppsapi"],
91 "descr": "JJY Receivers",
92 "define": "CLOCK_JJY",
97 "descr": "Zyfer GPStarplus Receiver",
98 "define": "CLOCK_ZYFER",
103 "descr": "GPSD NG client protocol",
104 "define": "CLOCK_GPSDJSON",
111 def refclock_config(ctx
):
112 if ctx
.options
.refclocks
== "all":
113 ids
= refclock_map
.keys()
115 # XXX: better error checking
116 ids
= ctx
.options
.refclocks
.split(",")
118 ctx
.env
.REFCLOCK_SOURCE
= []
120 # Remove duplicate IDs while preserving order.
122 [unique_id
.append(x
) for x
in ids
if x
not in unique_id
]
126 if id not in refclock_map
:
127 ctx
.fatal("'%s' is not a valid Refclock ID" % id)
129 rc
= refclock_map
[id]
131 if rc
['define'] == "CLOCK_GENERIC":
144 "CLOCK_WHARTON_400A",
146 for subtype
in parse_clocks
:
147 ctx
.define(subtype
, 1, comment
="Enable individual parse clock")
149 ctx
.start_msg("Enabling Refclock %s (%s):" % (rc
["descr"], id))
152 if "ppsapi" in rc
["require"]:
153 if not ctx
.get_define("HAVE_PPSAPI"):
156 "Refclock \"%s\" disabled, PPS API has not "
157 "been detected as working." % rc
["descr"])
160 ctx
.env
.REFCLOCK_SOURCE
.append((rc
["file"], rc
["define"]))
161 ctx
.env
["REFCLOCK_%s" % rc
["file"].upper()] = True
162 ctx
.define(rc
["define"], 1,
163 comment
="Enable '%s' refclock" % rc
["descr"])
164 ctx
.env
.REFCLOCK_LIST
+= [str(id)]
171 ctx
.env
.REFCLOCK_ENABLE
= True
172 ctx
.define("REFCLOCK", 1, comment
="Enable refclock support")