-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile.analyzers
892 lines (783 loc) · 75.4 KB
/
Makefile.analyzers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
# Makefile.analyzers
#
# Copyright (C) 2021-2025 wolfSSL Inc.
#
# This file is part of wolfSentry.
#
# wolfSentry is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# wolfSentry is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
ifeq "$(V)" "1"
QUIET_FLAG:=
else
QUIET_FLAG:=--quiet
endif
ifeq "$(TMPDIR)" ""
BUILD_PARENT := "."
else
BUILD_PARENT := $(TMPDIR)
endif
# lock in the expected major versions of LLVM/clang/compiler-rt-sanitizers, in
# order of preference:
ifndef CLANG_PATH
CLANG_PATH:=/usr/lib/llvm/20/bin:/usr/lib/llvm/19/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm-18:/usr/lib/llvm/17/bin:/usr/lib/llvm-17:/usr/lib/llvm/16/bin:/usr/lib/llvm-16:/usr/lib/llvm/15/bin:/usr/lib/llvm-15:/usr/lib/llvm/14/bin:/usr/lib/llvm-14:/opt/homebrew/opt/llvm/bin
endif
valgrind-all-clang: PATH:=$(CLANG_PATH):$(PATH)
sanitize-all-clang: PATH:=$(CLANG_PATH):$(PATH)
sanitize-all-clang-macosx: PATH:=$(CLANG_PATH):$(PATH)
c99-test-clang: PATH:=$(CLANG_PATH):$(PATH)
.PHONY: clang-version-test
clang-version-test:
@PATH=$(CLANG_PATH) clang --version >/dev/null || { echo 'CLANG_PATH $(CLANG_PATH) is invalid.' >&2; exit 1; }
.PHONY: valgrind
valgrind: CFLAGS+=-fno-omit-frame-pointer
valgrind: LDFLAGS+=-fno-omit-frame-pointer
valgrind: EXE_LAUNCHER=valgrind --tool=memcheck --leak-check=full --error-exitcode=10 $(VALGRIND_ARGS)
valgrind: test
.PHONY: valgrind-drd
valgrind-drd: CFLAGS+=-fno-omit-frame-pointer
valgrind-drd: LDFLAGS+=-fno-omit-frame-pointer
valgrind-drd: EXE_LAUNCHER=valgrind --tool=drd --error-exitcode=10 $(VALGRIND_ARGS)
valgrind-drd: test
.PHONY: valgrind-helgrind
valgrind-helgrind: CFLAGS+=-fno-omit-frame-pointer
valgrind-helgrind: LDFLAGS+=-fno-omit-frame-pointer
valgrind-helgrind: EXE_LAUNCHER=valgrind --tool=helgrind --error-exitcode=10 $(VALGRIND_ARGS)
valgrind-helgrind: test
.PHONY: valgrind-all
valgrind-all:
@$(MAKE) $(EXTRA_MAKE_FLAGS) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-builds" clean
@echo "valgrind memcheck"
@echo "================="
@$(MAKE) $(EXTRA_MAKE_FLAGS) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-builds" VALGRIND_ARGS=-q valgrind
@echo
@echo "valgrind drd"
@echo "============"
@$(MAKE) $(EXTRA_MAKE_FLAGS) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-builds" VALGRIND_ARGS=-q valgrind-drd
@echo
@echo "valgrind helgrind"
@echo "================="
@$(MAKE) $(EXTRA_MAKE_FLAGS) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-builds" VALGRIND_ARGS=-q valgrind-helgrind
@echo
@echo "passed: valgrind found no defects."
@$(MAKE) $(EXTRA_MAKE_FLAGS) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-builds" clean
.PHONY: sanitize
sanitize: CFLAGS+=-fno-omit-frame-pointer -fsanitize=address -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero
sanitize: LDFLAGS+=-fno-omit-frame-pointer -fsanitize=address -fsanitize=pointer-subtract -fsanitize=leak -fsanitize=undefined -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero
ifeq "$(CC_IS_GCC)" "1"
sanitize: CFLAGS+=-fsanitize=bounds-strict
sanitize: LDFLAGS+=-fsanitize=bounds-strict
endif
sanitize: TEST_ENV+=ASAN_OPTIONS='detect_invalid_pointer_pairs=2:halt_on_error=1:detect_stack_use_after_return=1' UBSAN_OPTIONS='halt_on_error=1' LSAN_OPTIONS='halt_on_error=1:exitcode=23'
sanitize: test
.PHONY: sanitize-no-leak
sanitize-no-leak: CFLAGS+=-fno-omit-frame-pointer -fsanitize=address -fsanitize=pointer-subtract -fsanitize=undefined -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero
sanitize-no-leak: LDFLAGS+=-fno-omit-frame-pointer -fsanitize=address -fsanitize=pointer-subtract -fsanitize=undefined -fsanitize=float-cast-overflow -fsanitize=float-divide-by-zero
ifeq "$(CC_IS_GCC)" "1"
sanitize-no-leak: CFLAGS+=-fsanitize=bounds-strict
sanitize-no-leak: LDFLAGS+=-fsanitize=bounds-strict
endif
sanitize-no-leak: TEST_ENV+=ASAN_OPTIONS='detect_leaks=0:detect_invalid_pointer_pairs=2:halt_on_error=1:detect_stack_use_after_return=1' UBSAN_OPTIONS='halt_on_error=1'
sanitize-no-leak: test
.PHONY: sanitize-thread
sanitize-thread: CFLAGS+=-fsanitize=thread
sanitize-thread: LDFLAGS+=-fsanitize=thread
sanitize-thread: TEST_ENV+=ASAN_OPTIONS='halt_on_error=1'
sanitize-thread: test
.PHONY: sanitize-all
sanitize-all:
ifeq "$(CC_IS_GCC)" "1"
@echo "sanitize address, leak, undefined, float-cast-overflow, float-divide-by-zero, and bounds-strict"
@echo "==============================================================================================="
else
@echo "sanitize address, leak, undefined, float-cast-overflow, and float-divide-by-zero"
@echo "================================================================================"
endif
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds" EXTRA_CFLAGS+="-fno-sanitize-recover=all" sanitize
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds" EXTRA_CFLAGS+="-fno-sanitize-recover=all -fshort-enums" sanitize
@echo
@echo "sanitize thread"
@echo "==============="
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds" EXTRA_CFLAGS+="-fno-sanitize-recover=all" sanitize-thread
@echo
@echo "passed: sanitizers found no defects."
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds" clean
.PHONY: valgrind-all-gcc
valgrind-all-gcc:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-gcc-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-gcc-builds" CC=$(GCC) VALGRIND_ARGS=-q valgrind
@echo "passed: no defects from gcc valgrind memcheck"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-gcc-builds" CC=$(GCC) VALGRIND_ARGS=-q valgrind-drd
@echo "passed: no defects from gcc valgrind drd"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-gcc-builds" CC=$(GCC) VALGRIND_ARGS=-q valgrind-helgrind
@echo "passed: no defects from gcc valgrind helgrind"
@echo "passed: no defects from any gcc valgrinds."
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-gcc-builds" clean
.PHONY: valgrind-all-clang
valgrind-all-clang: clang-version-test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-clang-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-clang-builds" CC=$(CLANG) VALGRIND_ARGS=-q valgrind
@echo "passed: no defects from clang valgrind memcheck"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-clang-builds" CC=$(CLANG) VALGRIND_ARGS=-q valgrind-drd
@echo "passed: no defects from clang valgrind drd"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-clang-builds" CC=$(CLANG) VALGRIND_ARGS=-q valgrind-helgrind
@echo "passed: no defects from clang valgrind helgrind"
@echo "passed: no defects from any clang valgrinds."
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-valgrind-clang-builds" clean
.PHONY: sanitize-all-gcc
sanitize-all-gcc:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-gcc" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-gcc" CC=$(GCC) EXTRA_CFLAGS+="-fno-sanitize-recover=all" sanitize
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-gcc" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-gcc" CC=$(GCC) EXTRA_CFLAGS+="-fno-sanitize-recover=all -fshort-enums" sanitize
@echo "passed: no defects from gcc sanitize address, leak, undefined, float-cast-overflow, float-divide-by-zero, and bounds-strict"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-gcc" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-gcc" CC=$(GCC) EXTRA_CFLAGS+="-fno-sanitize-recover=all" sanitize-thread
@echo "passed: no defects from gcc sanitize thread"
@echo "passed: no defects from any gcc sanitizers."
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-gcc" clean
.PHONY: sanitize-all-no-inline-gcc
sanitize-all-no-inline-gcc:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-no-inline-builds-gcc" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-no-inline-builds-gcc" CC=$(GCC) EXTRA_CFLAGS+="-fno-sanitize-recover=all -DWOLFSENTRY_NO_INLINE -fno-inline" sanitize
@echo "passed: no defects from gcc no-inline sanitize address, leak, undefined, float-cast-overflow, float-divide-by-zero, and bounds-strict"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-no-inline-builds-gcc" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-no-inline-builds-gcc" CC=$(GCC) EXTRA_CFLAGS+="-fno-sanitize-recover=all -DWOLFSENTRY_NO_INLINE -fno-inline" sanitize-thread
@echo "passed: no defects from gcc no-inline sanitize thread"
@echo "passed: no defects from any gcc no-inline sanitizers."
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-no-inline-builds-gcc" clean
.PHONY: sanitize-all-NO_POSIX_MEMALIGN-gcc
sanitize-all-NO_POSIX_MEMALIGN-gcc:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-NO_POSIX_MEMALIGN-builds-gcc" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-NO_POSIX_MEMALIGN-builds-gcc" CC=$(GCC) EXTRA_CFLAGS+="-fno-sanitize-recover=all -DWOLFSENTRY_NO_POSIX_MEMALIGN -DPRIVATE_DATA_ALIGNMENT=64 -DPRIVATE_DATA_SIZE=64" sanitize
@echo "passed: no defects from gcc NO_POSIX_MEMALIGN sanitize address, leak, undefined, float-cast-overflow, float-divide-by-zero, and bounds-strict"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-NO_POSIX_MEMALIGN-builds-gcc" clean
.PHONY: sanitize-aarch64-be-test
sanitize-aarch64-be-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitize-aarch64-be-builds" clean
@HOST=aarch64_be-unknown-linux-gnu; \
HOST_RPATH=$$(dirname $$($${HOST}-gcc -print-libgcc-file-name)) && \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitize-aarch64-be-builds" HOST=$$HOST EXE_LAUNCHER="qemu-aarch64_be -E LD_LIBRARY_PATH=$${HOST_RPATH} -L /usr/aarch64_be-unknown-linux-gnu" EXTRA_CFLAGS+='-fno-sanitize-recover=all' EXTRA_LDFLAGS="-Wl,-rpath-link=$$HOST_RPATH -Wl,-rpath=$$HOST_RPATH" sanitize-no-leak
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitize-aarch64-be-builds" clean
@echo "passed: sanitize-aarch64-be test."
.PHONY: sanitize-all-clang
sanitize-all-clang: clang-version-test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-clang" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-clang" CC=$(CLANG) EXTRA_CFLAGS+="-fno-sanitize-recover=all" sanitize
@echo "passed: no defects from clang sanitize address, leak, undefined, float-cast-overflow, and float-divide-by-zero"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-clang" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-clang" CC=$(CLANG) EXTRA_CFLAGS+="-fno-sanitize-recover=all -D__SANITIZE_THREAD__" sanitize-thread
@echo "passed: no defects from clang sanitize thread"
@echo "passed: no defects from any clang sanitizers."
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-clang" clean
.PHONY: sanitize-all-clang-macosx
sanitize-all-clang-macosx: clang-version-test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-clang" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-clang" CC=$(CLANG) EXTRA_CFLAGS+="-fno-sanitize-recover=all" sanitize-no-leak
@echo "passed: no defects from clang sanitize address, undefined, float-cast-overflow, and float-divide-by-zero"
@echo "passed: no defects from any clang sanitizers."
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-sanitizer-builds-clang" clean
ifndef REPO_ROOT
REPO_ROOT:=$(SRC_TOP)
endif
.PHONY: clang-tidy-build-test
clang-tidy-build-test:
@[ -x "$(REPO_ROOT)/../testing/git-hooks/clang-tidy-builder.sh" ] || { echo 'clang-tidy-builder.sh not found - skipping $@.'; exit 0; }; \
[ -r "$(REPO_ROOT)/scripts/analyzer-config.sh" ] || { echo 'analyzer-config.sh not found -- skipping $@.'; exit 0; }; \
command -v clang-tidy 1>/dev/null || { echo 'clang-tidy not found -- skipping $@.'; exit 0; }; \
CLANG=clang CLANG_TIDY=clang-tidy CLANG_TIDY_EXTRA_ARGS='--use-color=1' $(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-clang-tidy-builds" CC="$(REPO_ROOT)/../testing/git-hooks/clang-tidy-builder.sh" clean; \
. $(REPO_ROOT)/scripts/analyzer-config.sh && \
CLANG=clang CLANG_TIDY=clang-tidy CLANG_TIDY_EXTRA_ARGS='--use-color=1' $(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-clang-tidy-builds" CC="$(REPO_ROOT)/../testing/git-hooks/clang-tidy-builder.sh" EXTRA_CFLAGS='-Wunreachable-code-aggressive -Wthread-safety -Wloop-analysis -Wenum-compare-conditional -fcolor-diagnostics -fcomplete-member-pointers -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare' test && \
CLANG=clang CLANG_TIDY=clang-tidy CLANG_TIDY_EXTRA_ARGS='--use-color=1' $(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-clang-tidy-builds" CC="$(REPO_ROOT)/../testing/git-hooks/clang-tidy-builder.sh" clean && \
echo 'passed: $@.'
CPPCHECK := cppcheck
CPPCHECK_COMMON_ARGS = --error-exitcode=2 --check-level=exhaustive --inline-suppr -j $$(($$(nproc) / 2)) $(QUIET_FLAG) --std=c99 -D__STDC__ -D__STDC_VERSION__=199901L -U__STRICT_ANSI__ -UFP_NAN -UFP_INFINITE -UFP_ZERO -UFP_SUBNORMAL -UFP_NORMAL -USIZE_T_32 -DWOLFSENTRY_CPPCHECK --suppress=legacyUninitvar --suppress=constParameterPointer --suppress=constParameterCallback --suppress=unusedStructMember --suppress=variableScope --suppress=knownConditionTrueFalse --suppress=knownArgument --suppress=syntaxError:/usr/\* --suppress=unknownMacro:/usr/\* -I. -I/usr/include -I"$(shell $(CC) -print-file-name=include)" -I"$(LWIP_TOP_FOR_TEST)/src/include" -I"$(SRC_TOP)/ports/Linux-lwIP/include" -UWOLFSENTRY_SEMAPHORE_INCLUDE -UWOLFSENTRY_THREAD_INCLUDE
.PHONY: cppcheck-library
cppcheck-library:
@[ -r "$(REPO_ROOT)/scripts/analyzer-config.sh" ] || { echo "analyzer-config.sh not found -- skipping $@."; exit 0; }; \
command -v cppcheck 1>/dev/null || { echo 'cppcheck not found -- skipping $@.'; exit 0; }; \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-cppcheck-library-builds" clean; \
. $(REPO_ROOT)/scripts/analyzer-config.sh && \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-cppcheck-library-builds" "$(BUILD_PARENT)/wolfsentry-cppcheck-library-builds/wolfsentry/wolfsentry_options.h" && \
cd "$(SRC_TOP)" && \
$(CPPCHECK) --enable=warning,portability,performance,missingInclude,style $(CPPCHECK_COMMON_ARGS) -I"$(BUILD_PARENT)/wolfsentry-cppcheck-library-builds" -UWOLFSENTRY_LOCK_SHARED_ERROR_CHECKING -DBUILDING_LIBWOLFSENTRY -UWOLFSENTRY_USER_SETTINGS_FILE -D__linux__ -D__GNUC__ -UWOLFSENTRY_SINGLETHREADED -DWOLFSENTRY_THREADSAFE -UWOLFSENTRY_NO_ALLOCA --include="$(BUILD_PARENT)/wolfsentry-cppcheck-library-builds/wolfsentry/wolfsentry_options.h" --include=wolfsentry/wolfsentry_settings.h --include=wolfsentry/wolfsentry_util.h --include=wolfsentry/wolfsentry_errcodes.h --include=wolfsentry/wolfsentry_af.h --include=wolfsentry/wolfsentry.h $(CPPCHECK_EXTRA_ARGS) $(addprefix $(SRC_TOP)/src/,$(SRCS)) && \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-cppcheck-library-builds" clean && \
echo 'passed: $@.'
#force --suppress=preprocessorErrorDirective
#force -D__linux__ -UFREERTOS -UWOLFSENTRY_SINGLETHREADED -DWOLFSENTRY_THREADSAFE -DWOLFSENTRY_NO_ALLOCA
.PHONY: cppcheck-force-library
cppcheck-force-library:
@[ -r "$(REPO_ROOT)/scripts/analyzer-config.sh" ] || { echo "analyzer-config.sh not found -- skipping $@."; exit 0; }; \
command -v cppcheck 1>/dev/null || { echo 'cppcheck not found -- skipping $@.'; exit 0; }; \
. $(REPO_ROOT)/scripts/analyzer-config.sh && \
cd "$(SRC_TOP)" && \
$(CPPCHECK) --enable=warning,portability,performance,missingInclude,style --force --suppress=missingIncludeSystem $(CPPCHECK_COMMON_ARGS) -D'__attribute__(x)=' -D__GNUC__ --include=wolfsentry/wolfsentry_settings.h --include=wolfsentry/wolfsentry_util.h --include=wolfsentry/wolfsentry_errcodes.h --include=wolfsentry/wolfsentry_af.h --include=wolfsentry/wolfsentry.h $(CPPCHECK_EXTRA_ARGS) $(addprefix $(SRC_TOP)/src/,$(SRCS)) && \
echo 'passed: $@.'
.PHONY: cppcheck-extras
cppcheck-extras:
@[ -r "$(REPO_ROOT)/scripts/analyzer-config.sh" ] || { echo "analyzer-config.sh not found -- skipping $@."; exit 0; }; \
command -v cppcheck 1>/dev/null || { echo 'cppcheck not found -- skipping $@.'; exit 0; }; \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-cppcheck-extras-builds" clean; \
. $(REPO_ROOT)/scripts/analyzer-config.sh && \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-cppcheck-extras-builds" "$(BUILD_PARENT)/wolfsentry-cppcheck-extras-builds/wolfsentry/wolfsentry_options.h" && \
cd "$(SRC_TOP)" && \
$(CPPCHECK) --enable=warning,portability,performance,missingInclude,style $(CPPCHECK_COMMON_ARGS) -I"$(BUILD_PARENT)/wolfsentry-cppcheck-extras-builds" -DTEST_INIT -DTEST_STATIC_ROUTES -DTEST_DYNAMIC_RULES -DTEST_USER_VALUES -DTEST_USER_ADDR_FAMILIES -DTEST_JSON -DTEST_JSON_CORPUS -UTEST_LWIP -UWOLFSENTRY_LWIP -UWOLFSENTRY_TEST_HPI -DWOLFSENTRY_TEST_HPI_POSIX_VANILLA -DWOLFSENTRY_UNITTEST_BENCHMARKS -UWOLFSENTRY_LOCK_SHARED_ERROR_CHECKING -UBUILDING_LIBWOLFSENTRY -UWOLFSENTRY_USER_SETTINGS_FILE -DTEST_JSON_CONFIG_PATH='""' -DTEST_NUMERIC_JSON_CONFIG_PATH='""' -DWOLFSENTRY_ERROR_FMT -D'WOLFSENTRY_ERROR_FMT_ARGS()' -D__linux__ -D__GNUC__ -UWOLFSENTRY_SINGLETHREADED -DWOLFSENTRY_THREADSAFE -UWOLFSENTRY_NO_ALLOCA --include="$(BUILD_PARENT)/wolfsentry-cppcheck-extras-builds/wolfsentry/wolfsentry_options.h" --include=wolfsentry/wolfsentry_settings.h --include=wolfsentry/wolfsentry_util.h --include=wolfsentry/wolfsentry_errcodes.h --include=wolfsentry/wolfsentry_af.h --include=wolfsentry/wolfsentry.h $(CPPCHECK_EXTRA_ARGS) $(SRC_TOP)/tests/unittests.c && \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-cppcheck-extras-builds" clean && \
echo 'passed: $@.'
.PHONY: cppcheck-force-extras
cppcheck-force-extras:
@[ -r "$(REPO_ROOT)/scripts/analyzer-config.sh" ] || { echo "analyzer-config.sh not found -- skipping $@."; exit 0; }; \
command -v cppcheck 1>/dev/null || { echo 'cppcheck not found -- skipping $@.'; exit 0; }; \
. $(REPO_ROOT)/scripts/analyzer-config.sh && \
cd "$(SRC_TOP)" && \
$(CPPCHECK) --enable=warning,portability,performance,missingInclude,style --force --suppress=missingIncludeSystem $(CPPCHECK_COMMON_ARGS) -D'__attribute__(x)=' -D__GNUC__ -DTEST_INIT -DTEST_STATIC_ROUTES -DTEST_DYNAMIC_RULES -DTEST_USER_VALUES -DTEST_USER_ADDR_FAMILIES -DTEST_JSON -DTEST_JSON_CORPUS --include=wolfsentry/wolfsentry_settings.h --include=wolfsentry/wolfsentry_util.h --include=wolfsentry/wolfsentry_errcodes.h --include=wolfsentry/wolfsentry_af.h --include=wolfsentry/wolfsentry.h $(CPPCHECK_EXTRA_ARGS) $(SRC_TOP)/tests/unittests.c && \
echo 'passed: $@.'
.PHONY: cppcheck-force
cppcheck-force: cppcheck-force-library cppcheck-force-extras
.PHONY: analyze-all
# valgrind-all-clang disabled until the valgrind team fixes https://bugs.kde.org/show_bug.cgi?id=452758
# "Valgrind does not read properly DWARF5 as generated by Clang14"
analyze-all: valgrind-all-gcc sanitize-all-gcc linux-lwip-sanitize-all-gcc sanitize-all-clang sanitize-aarch64-be-test sanitize-all-no-inline-gcc sanitize-all-NO_POSIX_MEMALIGN-gcc clang-tidy-build-test cppcheck-library cppcheck-extras
@echo 'passed: analyzers found no defects.'
.PHONY: analyze-macosx
analyze-macosx: sanitize-all-clang-macosx
@echo 'passed: sanitizers found no defects.'
.PHONY: c99-test
c99-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c99-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c99-builds" EXTRA_CFLAGS+='-std=c99 -pedantic'
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c99-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c99-builds" EXTRA_CFLAGS+='-std=c99 -pedantic' SINGLETHREADED=1
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c99-builds" clean
@echo "passed: std=c99 tests."
.PHONY: c89-test
c89-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c89-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c89-builds" EXTRA_CFLAGS+='-std=c89 -pedantic -DWOLFSENTRY_C89 -Wno-variadic-macros -Wno-overlength-strings' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c89-builds" clean
@echo "passed: std=c89 tests."
.PHONY: c23-test
c23-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c23-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c23-builds" CC=gcc-15 EXTRA_CFLAGS+='-std=c23 -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE=1 -pedantic -Wno-overlength-strings -Wno-unterminated-string-initialization' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c23-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c23-builds" CC=clang EXTRA_CFLAGS+='-std=c23 -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE=1 -pedantic -Wno-overlength-strings' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-c23-builds" clean
@echo "passed: std=c23 tests."
.PHONY: m32-test
m32-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-builds" EXTRA_CFLAGS+='-m32' EXTRA_LDFLAGS+=-m32 test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-builds" clean
@echo "passed: m32 test."
.PHONY: m32-c89-test
m32-c89-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-c89-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-c89-builds" EXTRA_CFLAGS+='-m32 -std=c89 -pedantic -DWOLFSENTRY_C89 -Wno-variadic-macros -Wno-overlength-strings' EXTRA_LDFLAGS+=-m32 test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-c89-builds" clean
@echo "passed: m32-c89 test."
.PHONY: m32-c23-test
m32-c23-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-c23-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-c23-builds" CC=gcc-15 EXTRA_CFLAGS+='-m32 -std=c23 -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE=1 -pedantic -Wno-overlength-strings -Wno-unterminated-string-initialization' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-c23-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-c23-builds" CC=clang EXTRA_CFLAGS+='-m32 -std=c23 -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE=1 -pedantic -Wno-overlength-strings' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-m32-c23-builds" clean
@echo "passed: m32-c23 tests."
.PHONY: fortify-source-test
fortify-source-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-fortify-source-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-fortify-source-builds" EXTRA_CFLAGS+='-flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -pedantic -DWOLFSENTRY_PEDANTIC_C -Wno-overlength-strings -Wno-unterminated-string-initialization -Wno-inline' EXTRA_LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -Wl,--build-id=sha1 ' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-fortify-source-builds" clean
@echo "passed: fortify-source tests."
.PHONY: CALL_TRACE-test
CALL_TRACE-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentryCALL_TRACE-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentryCALL_TRACE-builds" CALL_TRACE=1 test >/dev/null 2>&1
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentryCALL_TRACE-builds" clean
@echo "passed: CALL_TRACE test."
.PHONY: singlethreaded-test
singlethreaded-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-singlethreaded-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-singlethreaded-builds" SINGLETHREADED=1 test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-singlethreaded-builds" clean
@echo "passed: SINGLETHREADED test."
.PHONY: no-json-test
no-json-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-NO_JSON-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-NO_JSON-builds" NO_JSON=1 test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-NO_JSON-builds" clean
@echo "passed: NO_JSON test."
.PHONY: no-json-dom-test
no-json-dom-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-NO_JSON_DOM-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-NO_JSON_DOM-builds" NO_JSON_DOM=1 test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-NO_JSON_DOM-builds" clean
@echo "passed: NO_JSON_DOM test."
.PHONY: no-error-strings-test
no-error-strings-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-error-strings-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-error-strings-builds" EXTRA_CFLAGS+='-DWOLFSENTRY_NO_ERROR_STRINGS' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-error-strings-builds" clean
@echo "passed: no-error-strings test."
.PHONY: no-inline-test
no-inline-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-inline-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-inline-builds" EXTRA_CFLAGS+='-DWOLFSENTRY_NO_INLINE -fno-inline' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-inline-builds" clean
@echo "passed: no-inline test."
.PHONY: no-alloca-test
no-alloca-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-alloca-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-alloca-builds" EXTRA_CFLAGS+='-DWOLFSENTRY_NO_ALLOCA -Walloca' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-alloca-builds" clean
@echo "passed: no-alloca test."
.PHONY: no-protocol-names-test
no-protocol-names-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-protocol-names-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-protocol-names-builds" EXTRA_CFLAGS+='-DWOLFSENTRY_NO_PROTOCOL_NAMES' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-protocol-names-builds" clean
@echo "passed: no-protocol-names test."
.PHONY: no-getprotoby-test
no-getprotoby-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-getprotoby-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-getprotoby-builds" EXTRA_CFLAGS+='-DWOLFSENTRY_NO_GETPROTOBY' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-getprotoby-builds" clean
@echo "passed: no-getprotoby test."
.PHONY: no-stdio-streams-build-test
no-stdio-streams-build-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-stdio-streams-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-stdio-streams-builds" NO_STDIO_STREAMS=1
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-stdio-streams-builds" clean
@echo "passed: NO_STDIO_STREAMS build test."
.PHONY: minimal-build-test
minimal-build-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-minimal-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-minimal-builds" SINGLETHREADED=1 NO_STDIO_STREAMS=1 DEBUG= OPTIM=-Os EXTRA_CFLAGS='-DWOLFSENTRY_NO_CLOCK_BUILTIN -DWOLFSENTRY_NO_MALLOC_BUILTIN -DWOLFSENTRY_NO_ERROR_STRINGS -DWOLFSENTRY_NO_PROTOCOL_NAMES -DWOLFSENTRY_NO_GETPROTOBY -Wno-error=inline -Wno-inline'
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-minimal-builds" clean
@echo "passed: minimal build test."
.PHONY: minimal-threaded-build-test
minimal-threaded-build-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-minimal-threaded-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-minimal-threaded-builds" NO_STDIO_STREAMS=1 DEBUG= OPTIM=-Os EXTRA_CFLAGS='-DWOLFSENTRY_NO_CLOCK_BUILTIN -DWOLFSENTRY_NO_MALLOC_BUILTIN -DWOLFSENTRY_NO_ERROR_STRINGS -DWOLFSENTRY_NO_PROTOCOL_NAMES -DWOLFSENTRY_NO_GETPROTOBY -DWOLFSENTRY_NO_SEM_BUILTIN -DWOLFSENTRY_SEMAPHORE_INCLUDE=\<semaphore.h\> -DWOLFSENTRY_USE_NONPOSIX_THREADS -DWOLFSENTRY_THREAD_INCLUDE=\<pthread.h\> -DWOLFSENTRY_THREAD_ID_T=pthread_t -DWOLFSENTRY_THREAD_GET_ID_HANDLER=pthread_self -Wno-error=inline -Wno-inline'
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-minimal-threaded-builds" clean
@echo "passed: minimal threaded build test."
LIBRARY_DEPENDENCY_SUPPRESSIONS_BASE := U wolfsentry_|U json_|U (inet_ntop|inet_pton|memchr|memcmp|memcpy|__memcpy_chk|memmove|memset|__popcountdi2|snprintf|__snprintf_chk|strchr|strcmp|strlen|strncasecmp|strncmp|strtod|strtol|strtoll|strtoul|strtoull)$$
.PHONY: library-dependency-singlethreaded-build-test
library-dependency-singlethreaded-build-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP='$(BUILD_PARENT)/library-dependency-singlethreaded-builds' clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP='$(BUILD_PARENT)/library-dependency-singlethreaded-builds' NO_STDIO_STREAMS=1 SINGLETHREADED=1 EXTRA_CFLAGS='-DWOLFSENTRY_NO_CLOCK_BUILTIN -DWOLFSENTRY_NO_MALLOC_BUILTIN -DWOLFSENTRY_NO_GETPROTOBY -DWOLFSENTRY_NO_SEM_BUILTIN -DWOLFSENTRY_NO_ERRNO_H -ffreestanding'
@if $(NM) -u '$(BUILD_PARENT)/library-dependency-singlethreaded-builds/libwolfsentry.a' | egrep -q -v '^$$|^[a-zA-Z].*:$$|$(LIBRARY_DEPENDENCY_SUPPRESSIONS_BASE)'; then $(NM) -u '$(BUILD_PARENT)/library-dependency-singlethreaded-builds/libwolfsentry.a' | egrep -v '$(LIBRARY_DEPENDENCY_SUPPRESSIONS_BASE)'; exit 1; fi
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP='$(BUILD_PARENT)/library-dependency-singlethreaded-builds' clean
@echo "passed: library-dependency-singlethreaded-build test."
.PHONY: library-dependency-multithreaded-build-test
library-dependency-multithreaded-build-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP='$(BUILD_PARENT)/library-dependency-multithreaded-builds' clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP='$(BUILD_PARENT)/library-dependency-multithreaded-builds' NO_STDIO_STREAMS=1 EXTRA_CFLAGS='-DWOLFSENTRY_NO_CLOCK_BUILTIN -DWOLFSENTRY_NO_MALLOC_BUILTIN -DWOLFSENTRY_NO_GETPROTOBY -DWOLFSENTRY_NO_SEM_BUILTIN -ffreestanding'
@if $(NM) -u '$(BUILD_PARENT)/library-dependency-multithreaded-builds/libwolfsentry.a' | egrep -q -v '^$$|^[a-zA-Z].*:$$|$(LIBRARY_DEPENDENCY_SUPPRESSIONS_BASE)|U (__errno_location|pthread_self)$$'; then $(NM) -u '$(BUILD_PARENT)/library-dependency-multithreaded-builds/libwolfsentry.a' | egrep -v '$(LIBRARY_DEPENDENCY_SUPPRESSIONS_BASE)|U (__errno_location|pthread_self)$$'; exit 1; fi
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP='$(BUILD_PARENT)/library-dependency-multithreaded-builds' clean
@echo "passed: library-dependency-multithreaded-build test."
.PHONY: user-settings-build-test
user-settings-build-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-user-settings-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-user-settings-builds" SINGLETHREADED=1 NO_JSON=1 EXTRA_CFLAGS='-DWOLFSENTRY_NO_ERROR_STRINGS -DWOLFSENTRY_NO_PROTOCOL_NAMES -DWOLFSENTRY_NO_GETPROTOBY' "$(BUILD_PARENT)/wolfsentry-user-settings-builds/wolfsentry/wolfsentry_options.h"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-user-settings-builds" USER_SETTINGS_FILE=$(BUILD_PARENT)/wolfsentry-user-settings-builds/wolfsentry/wolfsentry_options.h test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-user-settings-builds" clean
@echo "passed: user settings build test."
.PHONY: short-enums-test
short-enums-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-short-enums" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-short-enums" EXTRA_CFLAGS='-fshort-enums' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-short-enums" clean
@echo "passed: short enums test."
.PHONY: no-addr-bitmask-matching-test
no-addr-bitmask-matching-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-addr-bitmask-matching-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-addr-bitmask-matching-builds" NO_ADDR_BITMASK_MATCHING=1 TEST_JSON_CFLAGS='-DTEST_JSON_CONFIG_PATH=\"$(SRC_TOP)/tests/test-config-no-bitmasks.json\" -DEXTRA_TEST_JSON_CONFIG_PATH=\"$(SRC_TOP)/tests/extra-test-config.json\" -DTEST_NUMERIC_JSON_CONFIG_PATH=\"$(SRC_TOP)/tests/test-config-numeric-no-bitmasks.json\"' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-addr-bitmask-matching-builds" clean
@echo "passed: NO_ADDR_BITMASK_MATCHING test."
.PHONY: no-ipv6-test
no-ipv6-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-ipv6-test-builds" NO_IPV6=1 clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-ipv6-test-builds" NO_IPV6=1 TEST_JSON_CFLAGS='-DTEST_JSON_CONFIG_PATH=\"$(SRC_TOP)/tests/test-config-no-ipv6.json\" -DEXTRA_TEST_JSON_CONFIG_PATH=\"$(SRC_TOP)/tests/extra-test-config.json\" -DTEST_NUMERIC_JSON_CONFIG_PATH=\"$(SRC_TOP)/tests/test-config-numeric-no-ipv6.json\"' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-no-ipv6-test-builds" NO_IPV6=1 clean
@echo "passed: no-ipv6 test."
# this test assures that there are no more holes in structs than necessary.
# note that it isn't possible to minimize this simultaneously for both
# -fshort-enums and not-fshort-enums, because -fshort-enums inverts the size
# relationships between shorts and some enum members.
# wolfsentry_eventconfig is excluded because it is a public struct with an incumbent layout.
.PHONY: pahole-test
pahole-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-pahole-test-build" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-pahole-test-build" EXTRA_CFLAGS='-fshort-enums'
@if pahole --prefix_filter wolfsentry_ "$(BUILD_PARENT)"/wolfsentry-pahole-test-build/src/*.o | grep -E ', holes: [2-9],'; then echo 'found gratuitous hole(s) in struct(s)' 1>&2; false; fi
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-pahole-test-build" clean
@echo "passed: pahole test."
.PHONY: route-holes-test
route-holes-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/route-holes-test" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/route-holes-test" EXTRA_CFLAGS='-DWOLFSENTRY_ROUTE_INIT_TEST_FOR_UNINITED_DATA' UNITTEST_LIST='test_static_routes test_json' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/route-holes-test" EXTRA_CFLAGS='-DWOLFSENTRY_ROUTE_INIT_TEST_FOR_UNINITED_DATA -m32' EXTRA_LDFLAGS='-m32' UNITTEST_LIST='test_static_routes test_json' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/route-holes-test" EXTRA_CFLAGS='-DWOLFSENTRY_ROUTE_INIT_TEST_FOR_UNINITED_DATA -m32 -fshort-enums' EXTRA_LDFLAGS='-m32' UNITTEST_LIST='test_static_routes test_json' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/route-holes-test" clean
@echo "passed: route holes test."
.PHONY: small-PRIVATE_DATA_ALIGNMENT-test
small-PRIVATE_DATA_ALIGNMENT-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/small-PRIVATE_DATA_ALIGNMENT-test" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/small-PRIVATE_DATA_ALIGNMENT-test" EXTRA_CFLAGS='-DPRIVATE_DATA_ALIGNMENT=0' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/small-PRIVATE_DATA_ALIGNMENT-test" clean
@echo "passed: small-PRIVATE_DATA_ALIGNMENT test."
.PHONY: big-PRIVATE_DATA_ALIGNMENT-test
big-PRIVATE_DATA_ALIGNMENT-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/big-PRIVATE_DATA_ALIGNMENT-test" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/big-PRIVATE_DATA_ALIGNMENT-test" EXTRA_CFLAGS='-DPRIVATE_DATA_ALIGNMENT=64 -DPRIVATE_DATA_SIZE=64' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/big-PRIVATE_DATA_ALIGNMENT-test" clean
@echo "passed: big-PRIVATE_DATA_ALIGNMENT test."
.PHONY: HPI_POSIX_VANILLA-test
HPI_POSIX_VANILLA-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/HPI_POSIX_VANILLA-test" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/HPI_POSIX_VANILLA-test" EXTRA_CFLAGS='-DWOLFSENTRY_TEST_HPI_POSIX_VANILLA' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/HPI_POSIX_VANILLA-test" clean
@echo "passed: HPI_POSIX_VANILLA test."
.PHONY: dynamic-build-test
dynamic-build-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-dynamic-build-test" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-dynamic-build-test" "$(addprefix $(BUILD_PARENT)/wolfsentry-dynamic-build-test/tests/,$(UNITTEST_LIST_SHARED))"
@for test in $(UNITTEST_LIST_SHARED); do LD_LIBRARY_PATH="$(BUILD_PARENT)/wolfsentry-dynamic-build-test" $(TEST_ENV) $(EXE_LAUNCHER) "$(BUILD_PARENT)/wolfsentry-dynamic-build-test/tests/$$test" >/dev/null || exit $?; done
@echo 'passed: $(UNITTEST_LIST_SHARED).'
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-dynamic-build-test" clean
.PHONY: static-build-test
static-build-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-static-build-test" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-static-build-test" EXTRA_CFLAGS+='-static -DWOLFSENTRY_NO_GETPROTOBY' EXTRA_LDFLAGS+='-static' test
@echo 'passed: $@.'
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-static-build-test" clean
.PHONY: benchmark-test
benchmark-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-benchmark-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-benchmark-builds" EXTRA_CFLAGS+='-DWOLFSENTRY_UNITTEST_BENCHMARKS -DWOLFSENTRY_MAX_CYCLES_PER_CALL_EMPTY_TABLE=360 -DWOLFSENTRY_MAX_CYCLES_PER_CALL_JSON_LOADED=1400' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-benchmark-builds" clean
@echo "passed: benchmark test."
.PHONY: benchmark-singlethreaded-test
benchmark-singlethreaded-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-benchmark-singlethreaded-builds" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-benchmark-singlethreaded-builds" SINGLETHREADED=1 EXTRA_CFLAGS+='-DWOLFSENTRY_UNITTEST_BENCHMARKS -DWOLFSENTRY_MAX_CYCLES_PER_CALL_EMPTY_TABLE=150 -DWOLFSENTRY_MAX_CYCLES_PER_CALL_JSON_LOADED=1100' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-benchmark-singlethreaded-builds" clean
@echo "passed: benchmark-singlethreaded test."
# the performance tripwires on the benchmarks generate false positives when competing for CPU resources.
.NOTPARALLEL: benchmark-test benchmark-singlethreaded-test
ifdef FREERTOS_TOP
FREERTOS_TOP_FOR_TEST := $(FREERTOS_TOP)
else
FREERTOS_TOP_FOR_TEST := $(SRC_TOP)/../third/FreeRTOS
endif
ifdef LWIP_TOP
LWIP_TOP_FOR_TEST := $(LWIP_TOP)
else
LWIP_TOP_FOR_TEST := $(SRC_TOP)/../third/lwip
endif
.PHONY: freertos-arm32-thumb-build-test
freertos-arm32-thumb-build-test:
@[ -d $(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/. ] || ( echo '$@: $(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source not found.' >&2; exit 1)
@[ -d $(LWIP_TOP_FOR_TEST)/. ] || ( echo '$@: $(LWIP_TOP_FOR_TEST) not found.' >&2; exit 1)
@command -v arm-none-eabi-gcc >/dev/null || ( echo '$@: arm-none-eabi-gcc not found.' >&2; exit 1)
@rm -rf "$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds"
# first build without FUNCTION_SECTIONS=1 to detect any bloat or unresolved symbols anywhere in the library.
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mthumb -mcpu=cortex-m7 -specs=nano.specs -Wno-inline' NO_STDIO_STREAMS=1 '$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds/tests/test_lwip' UNITTEST_LIST=test_lwip OPTIM='-Os' STRIPPED=1
@TEST_LWIP_SZ=$$(stat --format='%s' '$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds/tests/test_lwip'); if [[ "$$TEST_LWIP_SZ" -gt 230000 ]]; then echo "$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds/tests/test_lwip is unexpectedly large ($$TEST_LWIP_SZ bytes)."; exit 1; fi
@rm -rf '$(BUILD_PARENT)/'wolfsentry-freertos-arm32-thumb-test-builds/tests/{freertos,lwip}
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mthumb -mcpu=cortex-m7' UNITTEST_LIST=test_lwip clean
# now rebuild with FUNCTION_SECTIONS=1, to test expected text size on a parsimonious link.
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mthumb -mcpu=cortex-m7 -specs=nano.specs -Wno-inline' NO_STDIO_STREAMS=1 '$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds/tests/test_lwip' UNITTEST_LIST=test_lwip OPTIM='-Os' STRIPPED=1 FUNCTION_SECTIONS=1
@TEST_LWIP_SZ=$$(stat --format='%s' '$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds/tests/test_lwip'); if [[ "$$TEST_LWIP_SZ" -gt 100000 ]]; then echo "$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds/tests/test_lwip is unexpectedly large ($$TEST_LWIP_SZ bytes)."; exit 1; fi
@rm -rf '$(BUILD_PARENT)/'wolfsentry-freertos-arm32-thumb-test-builds/tests/{freertos,lwip}
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-thumb-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mthumb -mcpu=cortex-m7' UNITTEST_LIST=test_lwip clean
@echo "passed: freertos-arm32-thumb-build test."
.PHONY: freertos-arm32-build-test
freertos-arm32-build-test:
@[ -d $(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/. ] || ( echo '$@: $(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source not found.' >&2; exit 1)
@[ -d $(LWIP_TOP_FOR_TEST)/. ] || ( echo '$@: $(LWIP_TOP_FOR_TEST) not found.' >&2; exit 1)
@command -v arm-none-eabi-gcc >/dev/null || ( echo '$@: arm-none-eabi-gcc not found.' >&2; exit 1)
@rm -rf "$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds"
# first build without FUNCTION_SECTIONS=1 to detect any bloat or unresolved symbols anywhere in the library.
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mcpu=cortex-m3 -specs=nano.specs -Wno-inline' NO_STDIO_STREAMS=1 '$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds/tests/test_lwip' UNITTEST_LIST=test_lwip OPTIM='-Os' STRIPPED=1
@TEST_LWIP_SZ=$$(stat --format='%s' '$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds/tests/test_lwip'); if [[ "$$TEST_LWIP_SZ" -gt 230000 ]]; then echo "$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds/tests/test_lwip is unexpectedly large ($$TEST_LWIP_SZ bytes)."; exit 1; fi
@rm -rf '$(BUILD_PARENT)/'wolfsentry-freertos-arm32-test-builds/tests/{freertos,lwip}
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mcpu=cortex-m3' UNITTEST_LIST=test_lwip clean
# now rebuild with FUNCTION_SECTIONS=1, to test expected text size on a parsimonious link.
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mcpu=cortex-m3 -specs=nano.specs -Wno-inline' NO_STDIO_STREAMS=1 '$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds/tests/test_lwip' UNITTEST_LIST=test_lwip OPTIM='-Os' STRIPPED=1 FUNCTION_SECTIONS=1
@TEST_LWIP_SZ=$$(stat --format='%s' '$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds/tests/test_lwip'); if [[ "$$TEST_LWIP_SZ" -gt 100000 ]]; then echo "$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds/tests/test_lwip is unexpectedly large ($$TEST_LWIP_SZ bytes)."; exit 1; fi
@rm -rf '$(BUILD_PARENT)/'wolfsentry-freertos-arm32-test-builds/tests/{freertos,lwip}
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mcpu=cortex-m3' UNITTEST_LIST=test_lwip clean
@echo "passed: freertos-arm32-build test."
.PHONY: freertos-arm32-singlethreaded-build-test
freertos-arm32-singlethreaded-build-test:
@[ -d $(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/. ] || ( echo '$@: $(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source not found.' >&2; exit 1)
@[ -d $(LWIP_TOP_FOR_TEST)/. ] || ( echo '$@: $(LWIP_TOP_FOR_TEST) not found.' >&2; exit 1)
@command -v arm-none-eabi-gcc >/dev/null || ( echo '$@: arm-none-eabi-gcc not found.' >&2; exit 1)
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-singlethreaded-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mthumb -mcpu=cortex-m7 -DWOLFSENTRY_DEBUG_LWIP' clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-singlethreaded-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) SINGLETHREADED=1 EXTRA_CFLAGS+='-mthumb -mcpu=cortex-m7 -DWOLFSENTRY_DEBUG_LWIP -Wno-attributes'
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-singlethreaded-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mthumb -mcpu=cortex-m7 -DWOLFSENTRY_DEBUG_LWIP' clean
@echo "passed: freertos-arm32-singlethreaded-build test."
.PHONY: freertos-arm32-c89-build-test
freertos-arm32-c89-build-test:
@[ -d $(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/. ] || ( echo '$@: $(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source not found.' >&2; exit 1)
@[ -d $(LWIP_TOP_FOR_TEST)/. ] || ( echo '$@: $(LWIP_TOP_FOR_TEST) not found.' >&2; exit 1)
@command -v arm-none-eabi-gcc >/dev/null || ( echo '$@: arm-none-eabi-gcc not found.' >&2; exit 1)
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-c89-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mthumb -mcpu=cortex-m7 -DWOLFSENTRY_DEBUG_LWIP' clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-c89-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-DWOLFSENTRY_DEBUG_LWIP -std=c89 -pedantic -DWOLFSENTRY_C89 -DWOLFSENTRY_USE_NONPOSIX_SEMAPHORES -Wno-variadic-macros -Wno-overlength-strings -mthumb -mcpu=cortex-m7 -DWOLFSENTRY_DEBUG_LWIP -Wno-attributes'
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-freertos-arm32-c89-test-builds" HOST=arm-none-eabi RUNTIME=FreeRTOS-lwIP FREERTOS_TOP=$(FREERTOS_TOP_FOR_TEST) LWIP_TOP=$(LWIP_TOP_FOR_TEST) EXTRA_CFLAGS+='-mthumb -mcpu=cortex-m7 -DWOLFSENTRY_DEBUG_LWIP' clean
@echo "passed: freertos-arm32-c89-build test."
LWIP_SRC_LIST_BASE := \
$(LWIP_TOP)/src/core/def.c \
$(LWIP_TOP)/src/core/init.c \
$(LWIP_TOP)/src/core/mem.c \
$(LWIP_TOP)/src/core/memp.c \
$(LWIP_TOP)/src/core/netif.c \
$(LWIP_TOP)/src/core/pbuf.c \
$(LWIP_TOP)/src/core/raw.c \
$(LWIP_TOP)/src/core/stats.c \
$(LWIP_TOP)/src/core/sys.c \
$(LWIP_TOP)/src/core/tcp.c \
$(LWIP_TOP)/src/core/tcp_in.c \
$(LWIP_TOP)/src/core/tcp_out.c \
$(LWIP_TOP)/src/core/ip.c \
$(LWIP_TOP)/src/core/inet_chksum.c \
$(LWIP_TOP)/src/core/timeouts.c \
$(LWIP_TOP)/src/core/ipv4/ip4.c \
$(LWIP_TOP)/src/core/ipv4/ip4_addr.c \
$(LWIP_TOP)/src/core/ipv4/icmp.c \
$(LWIP_TOP)/src/core/ipv4/etharp.c \
$(LWIP_TOP)/src/core/ipv6/ip6.c \
$(LWIP_TOP)/src/core/ipv6/ip6_addr.c \
$(LWIP_TOP)/src/core/ipv6/mld6.c \
$(LWIP_TOP)/src/core/ipv6/ip6_frag.c \
$(LWIP_TOP)/src/core/ipv6/icmp6.c \
$(LWIP_TOP)/src/core/ipv6/nd6.c \
$(LWIP_TOP)/src/api/tcpip.c \
$(LWIP_TOP)/src/api/api_msg.c \
$(LWIP_TOP)/src/api/err.c \
$(LWIP_TOP)/src/api/api_lib.c \
$(LWIP_TOP)/src/api/sockets.c \
$(LWIP_TOP)/src/api/netbuf.c \
$(LWIP_TOP)/src/netif/ethernet.c \
$(LWIP_TOP)/src/core/udp.c \
$(LWIP_TOP)/src/core/ipv4/ip4_frag.c
LWIP_SRC_LIST_UNIX := $(LWIP_TOP)/contrib/ports/unix/port/sys_arch.c
LWIP_SRC_LIST_FREERTOS := $(LWIP_TOP)/contrib/ports/freertos/sys_arch.c
# $(LWIP_TOP)/contrib/ports/unix/port/perf.c \
# $(LWIP_TOP)/contrib/ports/unix/port/netif/fifo.c \
# $(LWIP_TOP)/contrib/ports/unix/port/netif/list.c \
# $(LWIP_TOP)/contrib/ports/unix/port/netif/pcapif.c \
# $(LWIP_TOP)/contrib/ports/unix/port/netif/sio.c \
# $(LWIP_TOP)/contrib/ports/unix/port/netif/tapif.c
FREERTOS_SRC_LIST := \
$(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/tasks.c \
$(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/list.c \
$(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/queue.c \
$(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/timers.c \
$(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/event_groups.c \
$(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/stream_buffer.c \
$(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/portable/MemMang/heap_4.c \
$(FREERTOS_TOP_FOR_TEST)/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c
ifeq "$(RUNTIME)" "FreeRTOS-lwIP"
LWIP_SRC_LIST := $(LWIP_SRC_LIST_BASE) $(LWIP_SRC_LIST_FREERTOS)
else ifeq "$(RUNTIME)" "Linux-lwIP"
LWIP_SRC_LIST := $(LWIP_SRC_LIST_BASE) $(LWIP_SRC_LIST_UNIX)
endif
$(BUILD_TOP)/tests/lwip/%.o: $(LWIP_TOP)/%.c
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
ifeq "$(V)" "1"
$(CC) $(CFLAGS) -Wno-conversion -c $< -o $@
else
ifndef VERY_QUIET
@echo "$(CC) ... -o $@"
endif
@$(CC) $(CFLAGS) -Wno-conversion -c $< -o $@
endif
$(BUILD_TOP)/tests/freertos/%.o: $(FREERTOS_TOP)/%.c
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
ifeq "$(V)" "1"
$(CC) $(CFLAGS) -Wno-conversion -Wno-array-bounds -Wno-cast-align -c $< -o $@
else
ifndef VERY_QUIET
@echo "$(CC) ... -o $@"
endif
@$(CC) $(CFLAGS) -Wno-conversion -Wno-array-bounds -Wno-cast-align -c $< -o $@
endif
ifeq "$(RUNTIME)" "FreeRTOS-lwIP"
$(BUILD_TOP)/tests/test_lwip: $(patsubst $(LWIP_TOP)/%.c,$(BUILD_TOP)/tests/lwip/%.o,$(LWIP_SRC_LIST)) $(patsubst $(FREERTOS_TOP)/%.c,$(BUILD_TOP)/tests/freertos/%.o,$(FREERTOS_SRC_LIST))
else
$(BUILD_TOP)/tests/test_lwip: $(patsubst $(LWIP_TOP)/%.c,$(BUILD_TOP)/tests/lwip/%.o,$(LWIP_SRC_LIST))
endif
ANALYZER_BUILD_ARTIFACTS+=$(patsubst $(LWIP_TOP)/%.c,$(BUILD_TOP)/tests/lwip/%.o,$(LWIP_SRC_LIST))
.PHONY: linux-lwip-test
linux-lwip-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-linux-lwip-test-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-linux-lwip-test-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip EXTRA_CFLAGS=-DWOLFSENTRY_DEBUG_LWIP test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-linux-lwip-test-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip clean
@echo "passed: linux-lwip test."
.PHONY: linux-lwip-test-no-ipv6
linux-lwip-test-no-ipv6:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-linux-lwip-no-ipv6-test-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip NO_IPV6=1 clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-linux-lwip-no-ipv6-test-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip EXTRA_CFLAGS='-DWOLFSENTRY_DEBUG_LWIP -DLWIP_IPV6=0' NO_IPV6=1 TEST_JSON_CFLAGS='-DTEST_JSON_CONFIG_PATH=\"$(SRC_TOP)/tests/test-config-no-ipv6.json\" -DEXTRA_TEST_JSON_CONFIG_PATH=\"$(SRC_TOP)/tests/extra-test-config.json\" -DTEST_NUMERIC_JSON_CONFIG_PATH=\"$(SRC_TOP)/tests/test-config-numeric-no-ipv6.json\"' test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-linux-lwip-no-ipv6-test-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip NO_IPV6=1 clean
@echo "passed: linux-lwip-no-ipv6 test."
.PHONY: linux-lwip-c89-m32-test
linux-lwip-c89-m32-test:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-linux-lwip-c89-m32-test-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-linux-lwip-c89-m32-test-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip EXTRA_CFLAGS+='-DWOLFSENTRY_DEBUG_LWIP -m32 -std=c89 -pedantic -DWOLFSENTRY_C89 -Wno-variadic-macros -Wno-overlength-strings' EXTRA_LDFLAGS+=-m32 test
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-linux-lwip-c89-m32-test-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip clean
@echo "passed: linux-lwip-c89-m32 test."
.PHONY: linux-lwip-sanitize-all-gcc
linux-lwip-sanitize-all-gcc:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) VERY_QUIET=1 -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/linux-lwip-sanitizer-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) VERY_QUIET=1 -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/linux-lwip-sanitizer-builds" EXTRA_CFLAGS+="-DWOLFSENTRY_DEBUG_LWIP -fno-sanitize-recover=all" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip sanitize
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) VERY_QUIET=1 -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/linux-lwip-sanitizer-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) VERY_QUIET=1 -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/linux-lwip-sanitizer-builds" EXTRA_CFLAGS+="-DWOLFSENTRY_DEBUG_LWIP -fno-sanitize-recover=all -fshort-enums" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip sanitize
@echo "passed: no defects from linux-lwip-sanitize-all-gcc for address, leak, undefined, float-cast-overflow, float-divide-by-zero, and bounds-strict"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) VERY_QUIET=1 -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/linux-lwip-sanitizer-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) VERY_QUIET=1 -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/linux-lwip-sanitizer-builds" EXTRA_CFLAGS+="-DWOLFSENTRY_DEBUG_LWIP -fno-sanitize-recover=all" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip sanitize-thread
@echo "passed: no defects from linux-lwip-sanitize-all-gcc for thread sanitizer"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) VERY_QUIET=1 -f $(THIS_MAKEFILE) BUILD_TOP="$(BUILD_PARENT)/linux-lwip-sanitizer-builds" RUNTIME=Linux-lwIP LWIP_TOP=$(LWIP_TOP_FOR_TEST) UNITTEST_LIST_EXTRAS=test_lwip clean
.PHONY: notification-demo-build-test
notification-demo-build-test:
@rm -rf "$(BUILD_PARENT)/wolfsentry-notification-demo-build" "$(BUILD_PARENT)/wolfssl-notification-demo-build"
@git clone -q --shared --no-checkout "$(REPO_ROOT)/../wolfssl" "$(BUILD_PARENT)/wolfssl-notification-demo-build"
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-notification-demo-build" clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-notification-demo-build" install INSTALL_DIR="$(BUILD_PARENT)/wolfsentry-notification-demo-build/installed"
@cp -rs '$(SRC_TOP)/examples/notification-demo' '$(BUILD_PARENT)/wolfsentry-notification-demo-build'
@cd '$(BUILD_PARENT)/wolfsentry-notification-demo-build/notification-demo/udp_to_dbus' && $(MAKE) WOLFSENTRY_ROOT='$(BUILD_PARENT)/wolfsentry-notification-demo-build/installed' OPTFLAGS='$(OPTIM)' DIAGFLAGS='$(DEBUG) $(C_WARNFLAGS)' >/dev/null
@echo 'building libwolfssl with --enable-wolfsentry'
@cd "$(BUILD_PARENT)/wolfssl-notification-demo-build" && \
git checkout -q master && \
bwrap --setenv TMPDIR "$(BUILD_PARENT)" --ro-bind / / --dev-bind /dev /dev --ro-bind /dev/shm /dev/shm --dev-bind /proc /proc --dev-bind "$(BUILD_PARENT)" "$(BUILD_PARENT)" /bin/bash -c './autogen.sh >/dev/null 2>&1 && ./configure --quiet --disable-jobserver --enable-opensslextra --enable-wolfsentry CPPFLAGS="-pedantic -DNO_WOLFSSL_CIPHER_SUITE_TEST -DWOLFSSL_OLD_PRIME_CHECK -Wno-restrict" --with-wolfsentry="$(BUILD_PARENT)/wolfsentry-notification-demo-build/installed" --enable-intelasm --prefix "$(BUILD_PARENT)/wolfssl-notification-demo-build/installed" && $(MAKE) V=1 >/dev/null && echo "checking libwolfssl" && $(MAKE) V=1 check >/dev/null && echo "installing libwolfssl at $(BUILD_PARENT)/wolfssl-notification-demo-build/installed" && $(MAKE) $(QUIET_FLAG) install >/dev/null'
@cd '$(BUILD_PARENT)/wolfsentry-notification-demo-build/notification-demo/log_server' && \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) WOLFSENTRY_ROOT='$(BUILD_PARENT)/wolfsentry-notification-demo-build/installed' WOLFSSL_ROOT='$(BUILD_PARENT)/wolfssl-notification-demo-build/installed' clean && \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) WOLFSENTRY_ROOT='$(BUILD_PARENT)/wolfsentry-notification-demo-build/installed' WOLFSSL_ROOT='$(BUILD_PARENT)/wolfssl-notification-demo-build/installed' OPTFLAGS='$(OPTIM)' DIAGFLAGS='$(DEBUG) $(C_WARNFLAGS)' EXTRA_CFLAGS='-DDEBUG_WOLFSENTRY'
@if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then \
cd '$(BUILD_PARENT)/wolfsentry-notification-demo-build/notification-demo/udp_to_dbus' && \
{ ./udp_to_dbus > '$(BUILD_PARENT)/wolfsentry-notification-demo-build/udp_to_dbus.out' 2>&1 & } && \
UDP_TO_DBUS_PID=$$! && \
sleep 1 && \
kill -0 $$UDP_TO_DBUS_PID && \
UDP_TO_DBUS_OK=1; \
else \
UDP_TO_DBUS_PID=; \
UDP_TO_DBUS_OK=1; \
fi; \
[[ "$${UDP_TO_DBUS_OK-}" = "1" ]] && \
cd '$(BUILD_PARENT)/wolfsentry-notification-demo-build/notification-demo/log_server' && \
{ ./log_server > '$(BUILD_PARENT)/wolfsentry-notification-demo-build/log_server.out' 2>&1 & } && \
LOG_SERVER_PID=$$! && \
sleep 1 && \
kill -0 $$LOG_SERVER_PID || { cat '$(BUILD_PARENT)/wolfsentry-notification-demo-build/log_server.out' && false; } && \
cd '$(BUILD_PARENT)/wolfssl-notification-demo-build' && \
curl --max-time 2 --no-progress-meter --cert ./certs/client-ecc384-cert.pem --key ./certs/client-ecc384-key.pem --cacert ./certs/ca-ecc-cert.pem --resolve 'www.wolfssl.com:10443:127.0.0.1' 'https://www.wolfssl.com:10443/show-log' > '$(BUILD_PARENT)/wolfsentry-notification-demo-build/curl.out' && \
kill $$UDP_TO_DBUS_PID $$LOG_SERVER_PID && \
sleep 1 && \
{ grep -q -E '"action" : "notify-on-decision", "trigger" : "event-on-connect", "parent" : "event-on-connect", "rule-id" : [0-9]{2,}, "rule-hitcount" : [0-9]+, "af" : "INET", "proto" : 6, "remote" : { "address" : "127\.0\.0\.1", "port" : [0-9]+ }, "local" : { "address" : "127\.0\.0\.1", "port" : 10443 }, "decision" : \["accept"\]' '$(BUILD_PARENT)/wolfsentry-notification-demo-build/curl.out' || { echo 'unexpected contents in $(BUILD_PARENT)/wolfsentry-notification-demo-build/curl.out' 1>&2; exit 1; }; } && \
! grep -q -E 'ERROR:|WARNING:|exiting with warnings or errors' '$(BUILD_PARENT)/wolfsentry-notification-demo-build/log_server.out' '$(BUILD_PARENT)/wolfsentry-notification-demo-build/udp_to_dbus.out' && \
{ [[ $$(grep -c -E '^action callback: a="(handle-connect|handle-connect2|handle-match|notify-on-match)" parent_event="static-route-parent" trigger="event-on-connect"' '$(BUILD_PARENT)/wolfsentry-notification-demo-build/log_server.out') == 4 ]] || { echo 'unexpected connect/match callback trace count in $(BUILD_PARENT)/wolfsentry-notification-demo-build/log_server.out' 1>&2; exit 1; }; } && \
{ [[ $$(grep -c -E '^action callback: a="(handle-connect|handle-connect2|handle-match|notify-on-match)" parent_event="static-route-parent" trigger="transaction-successful"' '$(BUILD_PARENT)/wolfsentry-notification-demo-build/log_server.out') == 2 ]] || { echo 'unexpected success callback trace count in $(BUILD_PARENT)/wolfsentry-notification-demo-build/log_server.out' 1>&2; exit 1; }; } && \
{ [[ $$(grep -c -E '^(Handshake done|normal exit\.)$$' '$(BUILD_PARENT)/wolfsentry-notification-demo-build/log_server.out') == 2 ]] || { echo 'missing expected success messages in $(BUILD_PARENT)/wolfsentry-notification-demo-build/log_server.out' 1>&2; exit 1; }; }; \
exit_status=$$?; \
if [[ $$exit_status != 0 ]]; then pkill --parent $$$$ 'log_server|udp_to_dbus'; fi; \
rm -rf "$(BUILD_PARENT)/wolfssl-notification-demo-build"; \
rm -rf "$(BUILD_PARENT)/wolfsentry-notification-demo-build"; \
exit $$exit_status
@echo "passed: notification-demo-build test."
.PHONY: dist-check
dist-check:
@if [[ ! -d $(SRC_TOP)/.git ]]; then echo 'skipping $@ in non-git source tree.'; exit 0; fi; \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 dist-test && \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 dist-test-clean && \
echo 'passed: $@.'
release-check:
@if [[ ! -d $(SRC_TOP)/.git ]]; then echo 'skipping $@ in non-git source tree.'; exit 0; fi; \
mkdir release-test-$$$$ && \
cd release-test-$$$$ && \
$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f ../$(THIS_MAKEFILE) VERY_QUIET=1 SRC_TOP="$(SRC_TOP)" release && \
cd .. && \
rm release-test-$$$$/*.zip && \
rmdir release-test-$$$$ && \
echo 'passed: $@.'
.PHONY: doc-check
doc-check:
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-doc-build" doc-clean
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-doc-build" doc
@$(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) VERY_QUIET=1 BUILD_TOP="$(BUILD_PARENT)/wolfsentry-doc-build" doc-clean
@rm -rf "$(BUILD_PARENT)/wolfsentry-doc-build"
@echo "passed: doc-check."
.PHONY: check
check: dynamic-build-test c99-test no-alloca-test singlethreaded-test no-json-test no-json-dom-test no-error-strings-test no-protocol-names-test no-getprotoby-test no-stdio-streams-build-test minimal-build-test minimal-threaded-build-test user-settings-build-test short-enums-test no-addr-bitmask-matching-test no-ipv6-test
.PHONY: check-extra
check-extra: library-dependency-singlethreaded-build-test library-dependency-multithreaded-build-test pahole-test route-holes-test static-build-test c89-test c23-test no-inline-test m32-test m32-c89-test m32-c23-test fortify-source-test CALL_TRACE-test small-PRIVATE_DATA_ALIGNMENT-test big-PRIVATE_DATA_ALIGNMENT-test HPI_POSIX_VANILLA-test freertos-arm32-thumb-build-test freertos-arm32-build-test freertos-arm32-singlethreaded-build-test freertos-arm32-c89-build-test linux-lwip-test linux-lwip-test-no-ipv6 linux-lwip-c89-m32-test dist-check release-check doc-check notification-demo-build-test .WAIT benchmark-test benchmark-singlethreaded-test
ifdef JSON_TEST_CORPUS_DIR
export JSON_TEST_CORPUS_DIR
endif
.PHONY: check-all
check-all: override EXTRA_MAKE_FLAGS += UNITTEST_LIST_JSON_DOM_EXTRAS=test_json_corpus
check-all: analyze-all check check-extra
@echo "passed: all checks and analyzers."
.PHONY: check-macosx
check-macosx: analyze-macosx check
@echo "passed: all checks and analyzers."
# recipe to run the pre-push hook on the commit head, without actually pushing:
.PHONY: pre-push-check
pre-push-check:
@cd $(BUILD_TOP) && git log -1 --format='format:%S %H%n' | $(SRC_TOP)/scripts/pre-push.sh
ANALYZER_BUILD_ARTIFACTS+=$(BUILD_TOP)/tests/coverage-unittest.o $(BUILD_TOP)/tests/unittests.d $(BUILD_TOP)/tests/coverage-unittest.gcno $(BUILD_TOP)/tests/coverage-unittest.gcda $(BUILD_TOP)/tests/coverage-unittest $(BUILD_TOP)/*.gcov
.PHONY: coverage
coverage: OPTIM=-O0
coverage:
@mkdir -p coverage-build && cd coverage-build && $(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f ../$(THIS_MAKEFILE) SRC_TOP=.. EXTRA_CFLAGS+='--coverage' EXTRA_LDFLAGS+=--coverage ./tests/coverage-unittest
@cd coverage-build && ./tests/coverage-unittest >/dev/null && echo 'passed: omnibus unittest passed.'
@cd coverage-build && gcov --relative-only src/*.o src/json/*.o tests/coverage-unittest $(GCOV_EXTRA_ARGS)
.PHONY: coverage-clean
coverage-clean:
@[ -d coverage-build ] && $(MAKE) $(EXTRA_MAKE_FLAGS) $(QUIET_FLAG) -f $(THIS_MAKEFILE) BUILD_TOP=coverage-build clean || echo 'no coverage-build artifacts found.'
@[ -d coverage-build ] && echo 'artifacts remain in coverage-build' || true
$(BUILD_TOP)/tests/coverage-unittest: $(BUILD_TOP)/tests/coverage-unittest.o $(BUILD_TOP)/$(LIB_NAME)
ifeq "$(V)" "1"
$(CC) $(LDFLAGS) -o $@ $+
else
ifndef VERY_QUIET
@echo "$(CC) ... -o $@"
endif
@$(CC) $(LDFLAGS) -o $@ $+
endif
$(BUILD_TOP)/tests/coverage-unittest.o: override CFLAGS+=$(addprefix -D,$(shell echo '$(UNITTEST_LIST)' | tr '[:lower:]' '[:upper:]'))
ifneq "$(NO_JSON)" "1"
$(BUILD_TOP)/tests/coverage-unittest.o: override CFLAGS+=-DTEST_JSON_CORPUS
endif
$(BUILD_TOP)/tests/coverage-unittest.o: override CFLAGS+=$(TEST_JSON_CFLAGS)
$(BUILD_TOP)/tests/coverage-unittest.o: $(SRC_TOP)/tests/unittests.c
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
@rm -f $(@:.o=.gcda)
ifeq "$(V)" "1"
$(CC) $(CFLAGS) -MF $(<:.c=.d) -c $< -o $@
else
ifndef VERY_QUIET
@echo "$(CC) ... -o $@"
endif
@$(CC) $(CFLAGS) -MF $(<:.c=.d) -c $< -o $@
endif
.PHONY: gcovr
gcovr: GCOV_EXTRA_ARGS = 1>/dev/null
gcovr: coverage
@gcovr -r $(shell realpath $(SRC_TOP)) -g -k -e src/json/centijson_sax.c coverage-build/