1NULL =
2BUILT_SOURCES =
3CLEANFILES =
4DISTCLEANFILES =
5
6std_unity_list =                                                                \
7          $(abs_top_srcdir)/sntp/unity/auto/generate_test_runner.rb   \
8          $(abs_srcdir)/testconf.yml                                            \
9          $(NULL)
10
11#
12# Note: the rules to generate run-c_filename.c from c_filename.c below
13#         use the gmake $< construct for the first prerequisite, which
14#         does not work on FreeBSD make.  Use gmake when adding a new
15#         test source file, and check in the resulting run-*.c.
16#
17
18run_unity =         ruby $(std_unity_list)
19
20EXTRA_DIST =                                      \
21          testconf.yml                            \
22          data/ntp.keys                           \
23          data/mills,david-03.jpg                 \
24          $(NULL)
25
26check_PROGRAMS =              \
27          test-a_md5encrypt   \
28          test-atoint                   \
29          test-atouint                  \
30          test-authkeys                 \
31          test-buftvtots                \
32          test-calendar                 \
33          test-caljulian                \
34          test-caltontp                 \
35          test-calyearstart   \
36          test-clocktime                \
37          test-decodenetnum   \
38          test-digests                  \
39          test-hextoint                 \
40          test-hextolfp                 \
41          test-humandate                \
42          test-lfpfunc                  \
43          test-lfptostr                 \
44          test-modetoa                  \
45          test-msyslog                  \
46          test-netof                    \
47          test-numtoa                   \
48          test-octtoint                 \
49          test-prettydate               \
50          test-realpath                 \
51          test-recvbuff                 \
52          test-refidsmear               \
53          test-refnumtoa                \
54          test-sbprintf                 \
55          test-sfptostr                 \
56          test-socktoa                  \
57          test-ssl_init                 \
58          test-statestr                 \
59          test-strtolfp                 \
60          test-timespecops    \
61          test-timevalops               \
62          test-tsafememcmp    \
63          test-tstotv                   \
64          test-tvtots                   \
65          test-uglydate                 \
66          test-vi64ops                  \
67          test-ymd2yd                   \
68          $(NULL)
69
70LDADD =                                                     \
71          $(top_builddir)/sntp/unity/libunity.a   \
72          $(top_builddir)/libntp/libntp.a                   \
73          $(LDADD_LIBNTP)                                   \
74          $(PTHREAD_LIBS)                                   \
75          $(LDADD_NTP)                                      \
76          $(LIBM)                                           \
77          $(NULL)
78
79AM_CFLAGS  = $(CFLAGS_NTP)
80AM_CFLAGS += $(NTP_HARD_CFLAGS)
81
82AM_CPPFLAGS  = $(NTP_INCS)
83AM_CPPFLAGS += -I$(top_srcdir)/sntp
84AM_CPPFLAGS += $(CPPFLAGS_NTP)
85AM_CPPFLAGS += -DUNITY_INCLUDE_CONFIG_H
86AM_CPPFLAGS += -I$(top_srcdir)/sntp/unity
87AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
88
89AM_LDFLAGS  = $(LDFLAGS_NTP)
90AM_LDFLAGS += $(NTP_HARD_LDFLAGS)
91
92BUILT_SOURCES +=                        \
93          $(srcdir)/run-a_md5encrypt.c  \
94          $(srcdir)/run-atoint.c                  \
95          $(srcdir)/run-atouint.c                 \
96          $(srcdir)/run-authkeys.c      \
97          $(srcdir)/run-buftvtots.c     \
98          $(srcdir)/run-calendar.c      \
99          $(srcdir)/run-caljulian.c     \
100          $(srcdir)/run-caltontp.c      \
101          $(srcdir)/run-calyearstart.c  \
102          $(srcdir)/run-clocktime.c     \
103          $(srcdir)/run-decodenetnum.c  \
104          $(srcdir)/run-digests.c                 \
105          $(srcdir)/run-hextoint.c      \
106          $(srcdir)/run-hextolfp.c      \
107          $(srcdir)/run-humandate.c     \
108          $(srcdir)/run-lfpfunc.c                 \
109          $(srcdir)/run-lfptostr.c      \
110          $(srcdir)/run-modetoa.c                 \
111          $(srcdir)/run-msyslog.c                 \
112          $(srcdir)/run-netof.c                   \
113          $(srcdir)/run-numtoa.c                  \
114          $(srcdir)/run-octtoint.c      \
115          $(srcdir)/run-prettydate.c    \
116          $(srcdir)/run-realpath.c      \
117          $(srcdir)/run-recvbuff.c      \
118          $(srcdir)/run-refidsmear.c    \
119          $(srcdir)/run-refnumtoa.c     \
120          $(srcdir)/run-sbprintf.c      \
121          $(srcdir)/run-sfptostr.c      \
122          $(srcdir)/run-socktoa.c                 \
123          $(srcdir)/run-ssl_init.c      \
124          $(srcdir)/run-statestr.c      \
125          $(srcdir)/run-strtolfp.c      \
126          $(srcdir)/run-timevalops.c    \
127          $(srcdir)/run-timespecops.c   \
128          $(srcdir)/run-tsafememcmp.c   \
129          $(srcdir)/run-tstotv.c                  \
130          $(srcdir)/run-tvtots.c                  \
131          $(srcdir)/run-uglydate.c      \
132          $(srcdir)/run-vi64ops.c                 \
133          $(srcdir)/run-ymd2yd.c                  \
134          $(NULL)
135
136noinst_HEADERS =    \
137          lfptest.h \
138          sockaddrtest.h      \
139          test-libntp.h       \
140          $(NULL)
141
142###
143
144test_a_md5encrypt_SOURCES =   \
145          a_md5encrypt.c                \
146          run-a_md5encrypt.c  \
147          $(NULL)
148
149$(srcdir)/run-a_md5encrypt.c: $(srcdir)/a_md5encrypt.c $(std_unity_list)
150          $(run_unity) $< $@
151
152###
153
154test_atoint_SOURCES =                   \
155          atoint.c            \
156          run-atoint.c                  \
157          $(NULL)
158
159$(srcdir)/run-atoint.c: $(srcdir)/atoint.c $(std_unity_list)
160          $(run_unity) $< $@
161
162###
163
164test_atouint_SOURCES =                  \
165          atouint.c           \
166          run-atouint.c                 \
167          $(NULL)
168
169$(srcdir)/run-atouint.c: $(srcdir)/atouint.c $(std_unity_list)
170          $(run_unity) $< $@
171
172###
173
174test_authkeys_SOURCES =                 \
175          authkeys.c                    \
176          run-authkeys.c                \
177          $(NULL)
178
179$(srcdir)/run-authkeys.c: $(srcdir)/authkeys.c $(std_unity_list)
180          $(run_unity) $< $@
181
182###
183
184test_buftvtots_SOURCES =      \
185          buftvtots.c                   \
186          run-buftvtots.c               \
187          lfptest.c           \
188          $(NULL)
189
190$(srcdir)/run-buftvtots.c: $(srcdir)/buftvtots.c $(std_unity_list)
191          $(run_unity) $< $@
192
193###
194
195test_calendar_SOURCES =                 \
196          calendar.c                    \
197          run-calendar.c                \
198          test-libntp.c                 \
199          $(NULL)
200
201$(srcdir)/run-calendar.c: $(srcdir)/calendar.c $(std_unity_list)
202          $(run_unity) $< $@
203
204###
205
206test_caltontp_CFLAGS =                  \
207          $(CFLAGS_LIBEVENT)  \
208          $(AM_CFLAGS)                  \
209          $(NULL)
210
211test_caltontp_SOURCES =                 \
212          caltontp.c                    \
213          run-caltontp.c                \
214          $(NULL)
215
216$(srcdir)/run-caltontp.c: $(srcdir)/caltontp.c $(std_unity_list)
217          $(run_unity) $< $@
218
219###
220
221test_caljulian_CFLAGS =                 \
222          $(CFLAGS_LIBEVENT)  \
223          $(AM_CFLAGS)                  \
224          $(NULL)
225
226test_caljulian_SOURCES =      \
227          caljulian.c                   \
228          run-caljulian.c               \
229          test-libntp.c                 \
230          $(NULL)
231
232$(srcdir)/run-caljulian.c: $(srcdir)/caljulian.c $(std_unity_list)
233          $(run_unity) $< $@
234
235###
236
237test_calyearstart_SOURCES =   \
238          calyearstart.c                \
239          run-calyearstart.c  \
240          test-libntp.c                 \
241          $(NULL)
242
243$(srcdir)/run-calyearstart.c: $(srcdir)/calyearstart.c $(std_unity_list)
244          $(run_unity) $< $@
245
246###
247
248test_clocktime_SOURCES =      \
249          clocktime.c                   \
250          run-clocktime.c               \
251          test-libntp.c                 \
252          $(NULL)
253
254$(srcdir)/run-clocktime.c: $(srcdir)/clocktime.c $(std_unity_list)
255          $(run_unity) $< $@
256
257###
258
259test_decodenetnum_CFLAGS =    \
260          $(CFLAGS_LIBEVENT)  \
261          $(AM_CFLAGS)                  \
262          $(NULL)
263
264test_decodenetnum_SOURCES =   \
265          decodenetnum.c                \
266          run-decodenetnum.c  \
267          sockaddrtest.c                \
268          $(NULL)
269
270$(srcdir)/run-decodenetnum.c: $(srcdir)/decodenetnum.c $(std_unity_list)
271          $(run_unity) $< $@
272
273###
274
275test_digests_SOURCES =                  \
276          digests.c           \
277          run-digests.c                 \
278          $(NULL)
279
280$(srcdir)/run-digests.c: $(srcdir)/digests.c $(std_unity_list)
281          $(run_unity) $< $@
282
283nodist_test_digests_SOURCES = srcdir.c
284CLEANFILES += srcdir.c
285
286srcdir.c: Makefile
287          $(AM_V_GEN)echo 'const char srcdir[] = "$(srcdir)";' >$@
288
289###
290
291test_hextoint_SOURCES =                 \
292          hextoint.c                    \
293          run-hextoint.c                \
294          $(NULL)
295
296$(srcdir)/run-hextoint.c: $(srcdir)/hextoint.c $(std_unity_list)
297          $(run_unity) $< $@
298
299###
300
301test_hextolfp_SOURCES =                 \
302          hextolfp.c                    \
303          run-hextolfp.c                \
304          lfptest.c           \
305          $(NULL)
306
307$(srcdir)/run-hextolfp.c: $(srcdir)/hextolfp.c $(std_unity_list)
308          $(run_unity) $< $@
309
310###
311
312test_humandate_SOURCES =      \
313          humandate.c                   \
314          run-humandate.c               \
315          $(NULL)
316
317$(srcdir)/run-humandate.c: $(srcdir)/humandate.c $(std_unity_list)
318          $(run_unity) $< $@
319
320###
321
322test_lfpfunc_SOURCES =                  \
323          lfpfunc.c           \
324          run-lfpfunc.c                 \
325          $(NULL)
326
327$(srcdir)/run-lfpfunc.c: $(srcdir)/lfpfunc.c $(std_unity_list)
328          $(run_unity) $< $@
329
330###
331
332test_lfptostr_SOURCES =                 \
333          lfptostr.c                    \
334          run-lfptostr.c                \
335          $(NULL)
336
337$(srcdir)/run-lfptostr.c: $(srcdir)/lfptostr.c $(std_unity_list)
338          $(run_unity) $< $@
339
340###
341
342test_modetoa_SOURCES =                  \
343          modetoa.c           \
344          run-modetoa.c                 \
345          $(NULL)
346
347$(srcdir)/run-modetoa.c: $(srcdir)/modetoa.c $(std_unity_list)
348          $(run_unity) $< $@
349
350###
351
352test_msyslog_SOURCES =                  \
353          msyslog.c           \
354          run-msyslog.c                 \
355          $(NULL)
356
357$(srcdir)/run-msyslog.c: $(srcdir)/msyslog.c $(std_unity_list)
358          $(run_unity) $< $@
359
360###
361
362test_netof_SOURCES =                    \
363          netof.c                       \
364          run-netof.c                   \
365          sockaddrtest.c                \
366          $(NULL)
367
368$(srcdir)/run-netof.c: $(srcdir)/netof.c $(std_unity_list)
369          $(run_unity) $< $@
370
371###
372
373test_numtoa_SOURCES =                   \
374          numtoa.c            \
375          run-numtoa.c                  \
376          $(NULL)
377
378$(srcdir)/run-numtoa.c: $(srcdir)/numtoa.c $(std_unity_list)
379          $(run_unity) $< $@
380
381###
382
383test_octtoint_SOURCES =                 \
384          octtoint.c                    \
385          run-octtoint.c                \
386          $(NULL)
387
388$(srcdir)/run-octtoint.c: $(srcdir)/octtoint.c $(std_unity_list)
389          $(run_unity) $< $@
390
391###
392
393test_prettydate_SOURCES =     \
394          prettydate.c                  \
395          run-prettydate.c    \
396          $(NULL)
397
398$(srcdir)/run-prettydate.c: $(srcdir)/prettydate.c $(std_unity_list)
399          $(run_unity) $< $@
400
401###
402
403test_realpath_SOURCES =                 \
404          realpath.c                    \
405          run-realpath.c                \
406          $(NULL)
407
408$(srcdir)/run-realpath.c: $(srcdir)/realpath.c $(std_unity_list)
409          $(run_unity) $< $@
410
411###
412
413test_recvbuff_SOURCES =                 \
414          recvbuff.c                    \
415          run-recvbuff.c                \
416          $(NULL)
417
418$(srcdir)/run-recvbuff.c: $(srcdir)/recvbuff.c $(std_unity_list)
419          $(run_unity) $< $@
420
421###
422
423test_refidsmear_SOURCES =     \
424          refidsmear.c                  \
425          run-refidsmear.c    \
426          $(NULL)
427
428$(srcdir)/run-refidsmear.c: $(srcdir)/refidsmear.c $(std_unity_list)
429          $(run_unity) $< $@
430
431###
432
433test_refnumtoa_SOURCES =      \
434          refnumtoa.c                   \
435          run-refnumtoa.c               \
436          $(NULL)
437
438$(srcdir)/run-refnumtoa.c: $(srcdir)/refnumtoa.c $(std_unity_list)
439          $(run_unity) $< $@
440
441###
442
443test_sbprintf_SOURCES =                 \
444          sbprintf.c                    \
445          run-sbprintf.c                \
446          $(NULL)
447
448$(srcdir)/run-sbprintf.c: $(srcdir)/sbprintf.c $(std_unity_list)
449          $(run_unity) $< $@
450
451###
452
453test_sfptostr_SOURCES =                 \
454          sfptostr.c                    \
455          run-sfptostr.c                \
456          $(NULL)
457
458$(srcdir)/run-sfptostr.c: $(srcdir)/sfptostr.c $(std_unity_list)
459          $(run_unity) $< $@
460
461###
462
463test_socktoa_SOURCES =                  \
464          socktoa.c           \
465          run-socktoa.c                 \
466          sockaddrtest.c                \
467          $(NULL)
468
469$(srcdir)/run-socktoa.c: $(srcdir)/socktoa.c $(std_unity_list)
470          $(run_unity) $< $@
471
472###
473
474test_ssl_init_SOURCES =                 \
475          ssl_init.c                    \
476          run-ssl_init.c                \
477          $(NULL)
478
479$(srcdir)/run-ssl_init.c: $(srcdir)/ssl_init.c $(std_unity_list)
480          $(run_unity) $< $@
481
482###
483
484test_statestr_SOURCES =                 \
485          statestr.c                    \
486          run-statestr.c                \
487          $(NULL)
488
489$(srcdir)/run-statestr.c: $(srcdir)/statestr.c $(std_unity_list)
490          $(run_unity) $< $@
491
492###
493
494test_strtolfp_CFLAGS =                  \
495          $(CFLAGS_LIBEVENT)  \
496          $(AM_CFLAGS)                  \
497          $(NULL)
498
499test_strtolfp_SOURCES =                 \
500          strtolfp.c                    \
501          run-strtolfp.c                \
502          lfptest.c           \
503          $(NULL)
504
505$(srcdir)/run-strtolfp.c: $(srcdir)/strtolfp.c $(std_unity_list)
506          $(run_unity) $< $@
507
508###
509
510test_timespecops_SOURCES =    \
511          timespecops.c                 \
512          run-timespecops.c   \
513          $(NULL)
514
515$(srcdir)/run-timespecops.c: $(srcdir)/timespecops.c $(std_unity_list)
516          $(run_unity) $< $@
517
518###
519
520test_timevalops_SOURCES =     \
521          timevalops.c                  \
522          run-timevalops.c    \
523          $(NULL)
524
525$(srcdir)/run-timevalops.c: $(srcdir)/timevalops.c $(std_unity_list)
526          $(run_unity) $< $@
527
528###
529
530test_tsafememcmp_SOURCES =    \
531          tsafememcmp.c                 \
532          run-tsafememcmp.c   \
533          $(NULL)
534
535$(srcdir)/run-tsafememcmp.c: $(srcdir)/tsafememcmp.c $(std_unity_list)
536          $(run_unity) $< $@
537
538###
539
540test_tstotv_SOURCES =                   \
541          tstotv.c            \
542          run-tstotv.c                  \
543          $(NULL)
544
545$(srcdir)/run-tstotv.c: $(srcdir)/tstotv.c $(std_unity_list)
546          $(run_unity) $< $@
547
548###
549
550test_tvtots_SOURCES =                   \
551          tvtots.c            \
552          run-tvtots.c                  \
553          lfptest.c           \
554          $(NULL)
555
556$(srcdir)/run-tvtots.c: $(srcdir)/tvtots.c $(std_unity_list)
557          $(run_unity) $< $@
558
559###
560
561test_uglydate_SOURCES =                 \
562          uglydate.c                    \
563          run-uglydate.c                \
564          $(NULL)
565
566$(srcdir)/run-uglydate.c: $(srcdir)/uglydate.c $(std_unity_list)
567          $(run_unity) $< $@
568
569###
570
571test_vi64ops_SOURCES =                  \
572          vi64ops.c           \
573          run-vi64ops.c                 \
574          $(NULL)
575
576$(srcdir)/run-vi64ops.c: $(srcdir)/vi64ops.c $(std_unity_list)
577          $(run_unity) $< $@
578
579###
580
581test_ymd2yd_SOURCES =                   \
582          ymd2yd.c            \
583          run-ymd2yd.c                  \
584          $(NULL)
585
586$(srcdir)/run-ymd2yd.c: $(srcdir)/ymd2yd.c $(std_unity_list)
587          $(run_unity) $< $@
588
589###
590
591TESTS =
592
593if !NTP_CROSSCOMPILE
594TESTS += $(check_PROGRAMS)
595endif
596
597include $(top_srcdir)/check-libntp.mf
598include $(top_srcdir)/check-libunity.mf
599include $(top_srcdir)/depsver.mf
600include $(top_srcdir)/includes.mf
601