-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.compiler
531 lines (490 loc) · 17.9 KB
/
Makefile.compiler
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
# -*- makefile-bsdmake -*-
#
# Makefile.compiler - set CFLAGS et al nicely
#
# This should be included in your project's top-level Makefile.inc after
# any include of <bsd.own.mk>
# You can define USE_UBSAN or USE_ASAN on the command line to enable the
# Undefined or Address sanitizers with recent enough Clang or GCC. Note if your
# system supports these you may of course use its way of enabling them instead
# (e.g. on NetBSD set "MKSANITIZER=yes USE_SANITIZER=address").
#
# N.B.: The address sanitizer is not available when the PaX ASLR (Address Space
# Layout Randomization) feature is enabled on a given system, but it can be
# disabled for a given binary with paxctl(8): paxctl +a ${prog}
# You can usually find all CC pre-defines with:
#
# echo "" | cc -E -dM -x c - | sort
#
# to see what specific optimizations are enabled by -O*:
#
# echo "" | gcc -O[0123] -S -fverbose-asm -o - -x c -
#
# to show search paths and "as" and linker commands:
#
# echo "" | gcc -v -x c -
#
#
# N.B.: these tricks do not work for lcc
.if !defined(__GNUC__)
__GNUC__ != echo __GNUC__ | $(CC) -E - | sed '/\#/d;s/__GNUC__//'
.endif
.if empty(__GNUC__)
. undef __GNUC__
.else
. if !defined(__GNUC_MINOR__)
__GNUC_MINOR__ != echo __GNUC_MINOR__ | $(CC) -E - | sed '/\#/d;s/__GNUC_MINOR__//'
. endif
. if !defined(__GNUC_PATCHLEVEL__)
__GNUC_PATCHLEVEL__ != echo __GNUC_PATCHLEVEL__ | $(CC) -E - | sed '/\#/d;s/__GNUC_PATCHLEVEL__//'
. endif
.endif
# Note: for now Clang also defines the __GNUC*__ macros above...
# Note: on all recent Mac OS X (and soon FreeBSD), "cc" is "clang"
# On Mac OS X 10.8 and newer "gcc" is actually "llvm-gcc" too!
.if !defined(__clang__)
__clang__ != echo __clang__ | $(CC) -E - | sed '/\#/d;s/__clang__//'
.endif
.if empty(__clang__)
. undef __clang__
.else
. if !defined(__clang_major__)
__clang_major__ != echo __clang_major__ | $(CC) -E - | sed '/\#/d;s/__clang_major__//'
. endif
. if !defined(__clang_minor__)
__clang_minor__ != echo __clang_minor__ | $(CC) -E - | sed '/\#/d;s/__clang_minor__//'
. endif
. if !defined(__clang_patchlevel__)
__clang_patchlevel__ != echo __clang_patchlevel__ | $(CC) -E - | sed '/\#/d;s/__clang_patchlevel__//'
. endif
.endif
# borrowed from sjg's Mk-files.
.if !defined(_HOST_OSNAME)
# use .MAKE.OS if available
# avoid :U for older bmakes
. if !defined(.MAKE.OS)
_HOST_OSNAME := ${uname -s:L:sh}
. else
_HOST_OSNAME := ${.MAKE.OS}
. endif
.endif
#TARGET_OSNAME?= ${_HOST_OSNAME}
# Note: TARGET_OSNAME is from sjg's Mk-files (host-target.mk, own.mk), and
# OS is from pkgsrc bootstrap-mk. .FreeBSD is a trick shared by FreeBSD and old
# MacOS bsdmake.
#
.if ((defined(TARGET_OSNAME) && (${TARGET_OSNAME} == "Darwin")) || \
(defined(OS) && (${OS} == "Darwin")) || \
(defined(.FreeBSD) && (empty(.FreeBSD) || (${.FreeBSD} == "false"))))
#
# NOTE: Mac OS X does not use GNU ld, but....
#
.else
. if !defined(__GNULD__)
__GNULD__ != $(LD) -v | awk '{print int($$NF);}' | tr -d ' \012'
. endif
.endif
# Note: FreeBSD's mk-files (<bsd.sys.mk>) use this directly, and luckily
# correctly as it blindly adds its own value to CFLAGS after the one added
# below....
#
CSTD ?= c89
# prevent NetBSD's mk-files from adding -std=gnu99 to CFLAGS
#
.if !empty(unix:M*NetBSD*)
# XXX this is very ad-hoc, obviously, but until something better is done...
COVERITY_TOP_CONFIG = 1
.endif
# Enable system-specific warnings -- this would likely double up on many of the
# flags added by here, but on rare occasions it may also add some host-specific
# flags that might be useful.
#
# Of course this is just for developers, and beware it often includes
# -Wsystem-headers leading to miles of useless warnings and sometimes
# unavoidable errors!
#
# XXX so far no system has required this be explicitly set to "0", though for at
# least recent NetBSD when using Clang there may be some advantage as just being
# defined adds "-Wno-sign-compare -Wno-pointer-sign".
#
#WARNS ?= 0
# Do not enable/allow -Werror -- But oh soooo very many ways to do it!
#
NOGCCERROR = 1 # NetBSD
NOCLANGERROR = 1 # NetBSD
# more recent FreeBSDs deprecate NO_WERROR
# (Note the really old bsdmake on OSX/macOS has a wonky huge MAKE_VERSION.)
.if defined(MAKE_VERSION) && (${MAKE_VERSION} >= 20210106 && ${MAKE} != "bsdmake")
MK_WERROR = no
.else
NO_WERROR = 1
.endif
# Just turn off all sjg's Mk-files warnings -- those herein are better tuned to
# the supported compilers....
NO_CFLAGS_WARNINGS = 1
#
# Set ${CWARNFLAGS} based on the detected compiler and its version.
#
# Note we do depend on the mk-files (notably <bsd.sys.mk>) to add ${CWARNFLAGS}
# to ${CFLAGS}, and so far only sjg's Mk-files don't do this...
#
# xxx consider ${CWARNFLAGS.${COMPILER_TYPE}} ala FreeBSD to hopefully simplify
# the .if logic somewhat....
#
# xxx there's also the ${EXPR:? flim : flam} form used by NetBSD....
#
# -Winline
#
# - seems pointless
#
# -Wnested-externs
#
# - possibly useful, though -Wshadow covers worst case
# - see tnested-externs.c
#
# -Wredundant-decls
#
# - seems pointless
.if defined(__GNUC__) && ${__GNUC__} >= 1
CWARNFLAGS += -Wall
# this one is just plain annoying much of the time:
CWARNFLAGS += -Wno-missing-field-initializers
# these aren't always in "-Wall"
CWARNFLAGS += -Wimplicit
CWARNFLAGS += -Wreturn-type
CWARNFLAGS += -Wswitch
CWARNFLAGS += -Wcomment
CWARNFLAGS += -Wcast-qual
CWARNFLAGS += -Wpointer-arith
CWARNFLAGS += -Wshadow
# xxx some code may not be quite ready for full const-ification yet...
CWARNFLAGS += -Wwrite-strings
# this isn't mentioned in 1.42's manual but causes no error
CWARNFLAGS += -Wstrict-prototypes
#XXX# -Wsystem-headers does not go well on many systems!
#XXX#CWARNFLAGS += -Wsystem-headers
CWARNFLAGS += -Wno-system-headers
.endif # ${__GNUC__} >= 1
# in addition to -Wall
#
.if defined(__GNUC__)
. if ${__GNUC__} <= 2
# "-Wid-clash-LEN" is sadly no longer supported in 3.2.2 or 3.3.3
# (but is still in 3.0.4)
CWARNFLAGS += -Wid-clash-30
. endif
.if ${__GNUC__} > 3 || \
(${__GNUC__} == 3 && ${__GNUC_MINOR__} == 4 && ${__GNUC_PATCHLEVEL__} >=6) || \
(${__GNUC__} == 3 && ${__GNUC_MINOR__} >= 5)
# "-W" was replaced by "-Wextra" since at least 3.4.6
# and in clang, which presents as GCC 4.2.1, this is also true
CWARNFLAGS += -Wextra
. else
CWARNFLAGS += -W
. endif
.endif
.if defined(__GNUC__) && \
${__GNUC__} >= 2
# functions are SUPPOSED to be able to return structs!!!
#CWARNFLAGS += -Waggregate-return
CWARNFLAGS += -Wcast-align
CWARNFLAGS += -Wchar-subscripts
# -Wconversion changes meanings in GCC-4.4 and newer, but we may still want it
CWARNFLAGS += -Wconversion
CWARNFLAGS += -Wmissing-declarations
CWARNFLAGS += -Wmissing-prototypes
CWARNFLAGS += -Wno-long-long
# the rest aren't in the manual, but work on at least 2.9x.x
CWARNFLAGS += -Wformat-extra-args
# -Wundef isn't in 2.7.2, but then again if you're still using 2.7.2 you may be
# suffering from far more code generation bugs and other compiler problems than
# you might know!
CWARNFLAGS += -Wundef
# we may intentionally have large arrays
#CWARNFLAGS += -Wlarger-than-65536
# N.B.: -Wbad-function-cast can be extremely annoying as it complains about
# conversions by casts which even -Wconversion doesn't complain about. In
# theory it does warn about cases where UB(?)/IDB can happen because the return
# value is out-of-bounds for the target type.
CWARNFLAGS += -Wbad-function-cast
.endif
.if defined(__GNUC__) && \
${__GNUC__} >= 3
# Yuck: this is broken in at least 3.2.2...
#CWARNFLAGS += -Wunreachable-code
CWARNFLAGS += -Wdeclaration-after-statement
# -Wformat is included in -Wall, but not "-Wformat-nonliteral -Wformat-security"
# but -Wformat-y2k is stupid
CWARNFLAGS += -Wformat=2 -Wno-format-y2k
# note: will only have effect if '-fstrict-aliasing' is enabled, but normally we
# do the opposite and disable that option
# xxx maybe only in >= 3.3?
CWARNFLAGS += -Wstrict-aliasing=2
.endif
.if (defined(__GNUC__) && \
${__GNUC__} >= 4 && \
!defined(__clang__)) || \
(defined(__clang__) && defined(__clang_major__) && ${__clang_major__} > 1)
. if(${__GNUC_MINOR__} >= 4)
# hmmm... this can sometimes be annoying, but....
CWARNFLAGS += -Wtraditional-conversion
. endif
CWARNFLAGS += -Wunreachable-code
# note: this only works if we don't turn off -fstrict-overflow (which we
# normally do) _and_ we have -O2 or greater (see below)
. if(${__GNUC_MINOR__} >= 1)
# xxx not in 4.0.1, and in 4.2.1, but when first?
CWARNFLAGS += -Wstrict-overflow=5
. endif
.endif
# maybe this is right? (it's always enabled in more recent GCC's)
.if !empty(unix:M*NetBSD*) && ${__GNUC__} < 3 && ${__GNUC__} > 2
CWARNFLAGS += -Wnetbsd-format-audit
.endif
# note: since Clang also defines the __GNUC__ macros we just need to add
# Clang-specific flags here and we get all the GCC warning flags for free...
.if defined(__clang__)
# get all the info!
CWARNFLAGS += -fmessage-length=0
# try this -- good for tests, bad for production!!!
. if ${__clang_major__} <= 5
CWARNFLAGS += -fcatch-undefined-behavior
. if ${__clang_major__} == 4 || (${__clang_major__} == 3 && ${__clang_minor__} >= 3)
. if defined(USE_UBSAN)
# i.e. clang 3.3 or clang 4.x (but not clang 5.x)
CWARNFLAGS += -fsanitize=undefined
. endif
. endif
. else
. if ${__clang_major__} >= 7
# N.B.: It is not possible to combine more than one of the -fsanitize=address,
# -fsanitize=thread, and -fsanitize=memory checkers in the same program.
. if defined(USE_UBSAN)
# sadly Apple LLVM version 8.1.0 (clang-802.0.42) says:
# clang: error: unsupported option '-fsanitize=memory' for target 'x86_64-apple-darwin16.6.0'
#CWARNFLAGS += -fsanitize=memory
#CWARNFLAGS += -fsanitize=thread
CWARNFLAGS += -fsanitize=undefined
# Apple LLVM version 8.1.0 (clang-802.0.42) says:
# ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/lib/darwin/libclang_rt.safestack_osx.a
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
#CWARNFLAGS += -fsanitize=safe-stack
#xxx this may not be useful?
#CWARNFLAGS += -fsanitize=dataflow --fsanitize=cfi
. endif
. if defined(USE_ASAN)
#xxx 'address' may not work (requires intrumentation of all program code)
CWARNFLAGS += -fsanitize=address
# (may also require setting ASAN_OPTIONS in the runtime environment,
# e.g. ASAN_OPTIONS=detect_leaks=1)
. endif
. else
# clang > 5.0 < 7.x(?)
. if defined(USE_UBSAN)
# Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) says:
# clang: error: unsupported argument 'undefined' to option 'fsanitize='
#CWARNFLAGS += -fsanitize=undefined
. endif
. if defined(USE_ASAN)
# ???
#CWARNFLAGS += -fsanitize=address
. endif
. endif
. endif
# -fsanitize must also be provided to the linker (for hidden runtime libraries)
LDFLAGS += ${CWARNFLAGS:M-fsanitize=*}
.endif
.if defined(__GNUC__) && !defined(__clang__)
. if defined(USE_UBSAN)
# xxx hmmmm which, exactly?
. if ${__GNUC__} >= 5
CWARNFLAGS += -fsanitize=undefined
# -fsanitize=undefined has sub-options
CWARNFLAGS += -fsanitize=alignment
CWARNFLAGS += -fsanitize=bool
CWARNFLAGS += -fsanitize=bounds
CWARNFLAGS += -fsanitize=enum
CWARNFLAGS += -fsanitize=float-cast-overflow
CWARNFLAGS += -fsanitize=float-divide-by-zero
CWARNFLAGS += -fsanitize=integer-divide-by-zero
CWARNFLAGS += -fsanitize=null
CWARNFLAGS += -fsanitize=object-size
CWARNFLAGS += -fsanitize=shift
LDFLAGS += -fsanitize=undefined -pthread
# xxx adding these _almost_ allows static linking on NetBSD, but for shm_open()
# and shm_unlink() not being resolved from librt even when it is specified
#LDADD += -lrt
#LDADD += -pthread
LDSTATIC := # empty -- undefined sanitizer effectively does not support static linking
. endif
. endif
. if defined(USE_ASAN)
. if ${__GNUC__} > 4 || \
(${__GNUC__} == 4 && ${__GNUC_MINOR__} >= 8)
CWARNFLAGS += -fsanitize=address
LDFLAGS += -fsanitize=address
LDSTATIC := # empty -- address sanitizer does not support static linking
. endif
. endif
# N.B.: LeakSanitizer is incompatible with -fsanitize=thread.
#
# LeakSanitizer is enabled by default in ASan builds of x86_64 Linux, and can be
# enabled with ASAN_OPTIONS=detect_leaks=1 on x86_64 OS X.
#
# You can fine-tune LeakSanitizer's behavior through the LSAN_OPTIONS
# environment variable. See:
#
# <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
#
# Here USE_LEAKSAN is provided for stand-alone leak detection.
#
. if defined(USE_LEAKSAN)
LDFLAGS += -fsanitize=leak
LDSTATIC := # empty -- leak sanitizer does not support static linking
. endif
.endif
.if !defined(__clang__)
# in GCC -g3 includes macro definitions in debug info
DBG = -g3
.else
DBG = -g
.endif
OPTIM = -O2
.if defined(__GNUC__) && ${__GNUC__} >= 1
. if defined(__GNULD__) && ${__GNULD__} >= 1
#LDFLAGS += -Wl,--warn-common
#LDFLAGS += -Wl,--fatal-warnings
LDFLAGS += -Wl,--unresolved-symbols=report-all
#LDFLAGS += -Wl,--error-unresolved-symbols
. else
. if !empty(${DBG:M-g})
# hmmm.... GNU ld(1) doesn't need -g, but some linkers do
#LDFLAGS += -Wl,-g
. endif
. endif
.endif
#
# XXX the rest could/should be split into Makefile.compiler2 that would be
# included after <bsd.{prog,lib}.mk>, but then that has to be done explicitly
# every time, sigh. Only sjg's Mk-files provide an easy option with
# "Makefile-final.inc"
#
# Since <bsd.sys.mk> hasn't been included yet (i.e. CFLAGS et al are all still
# empty), these will still add the flags anyway, and early near the beginning,
# meaning they won't override anything set in <bsd.sys.mk>.
#
# N.B.: on most systems COPTS would be strongly preferred as it is usually
# added late to CFLAGS, but on FreeBSD they have, since nearly forever, mostly
# eliminated it and all its variants and added a warning in <bsd.prog.mk>, the
# only remaining use, saying "XXX The use of COPTS in modern makefiles is
# discouraged."
#
.if !empty(DBG) && empty(CFLAGS:M*${DBG}*)
CFLAGS += ${DBG}
.endif
.if !empty(OPTIM) && empty(CFLAGS:M*${OPTIM}*)
CFLAGS += ${OPTIM}
.endif
.if empty(CFLAGS:M*-std=${CSTD}*)
CFLAGS += -std=${CSTD}
.endif
.if !empty(CPPFLAGS) && empty(CFLAGS:M*${CPPFLAGS}*)
CFLAGS += ${CPPFLAGS}
.endif
.if (defined(__GNUC__) && ${__GNUC__} >= 1) || \
(defined(__clang__) && ${__clang__} >= 1)
. if empty(CFLAGS:M*-pipe*)
CFLAGS += -pipe
. endif
.endif
.if defined(__GNUC__) || defined(__clang__) && \
empty(CFLAGS:M*-fno-strict-aliasing*)
# WARNING: C99 (and C11) allow compilers to perform optimizations based on the
# "strict" aliasing, overflow, and enums rules which _will_ change the behaviour
# of previously correct C90 and earlier code!
CFLAGS += -fno-strict-aliasing
.endif
.if (defined(__GNUC__) && \
${__GNUC__} >= 4 && ${__GNUC_MINOR__} >= 2) && \
empty(CFLAGS:M*-fno-strict-overflow*)
# WARNING: Prevent the optimizer from assuming that the program
# follows the strict signed overflow semantics permitted for the
# language.
CFLAGS += -fno-strict-overflow
.endif
# XXX in GCC -fstrict-enums apparently only applies to C++
.if defined(__GNUC__) && defined(__clang__) && \
empty(CFLAGS:M*-fno-strict-enums*)
# WARNING: Prevent the compiler from optimizing "using the assumption
# that a value of enumerated type can only be one of the values of the
# enumeration"
CFLAGS += -fno-strict-enums
.endif
.if (defined(__GNUC__) && !defined(__clang__) && \
${__GNUC__} >= 4 && ${__GNUC_MINOR__} >= 2) && \
empty(CFLAGS:M*-fno-strict-volatile-bitfields*)
# WARNING: Force the compiler to always read the whole underlying value!
CFLAGS += -fno-strict-volatile-bitfields
.endif
# Dunno for sure if this is right, but Apple's PowerPC GCC-4.0.1 does not have
# stack-protector, however 4.1.x on many systems does....
#
# (gcc 4.4.3 from pkgsrc does not, sadly, as it is forced off in the
# build, but oddly it doesn't complain about the option -- it just
# fails to link programs because the option causes it to ask the
# linker for -lssp)
#
.if defined(__GNUC__) && \
(${__GNUC__} > 4 || (${__GNUC__} == 4 && ${__GNUC_MINOR__} > 0)) && \
empty(CFLAGS:M*-fstack-protector-all*)
CFLAGS += -fstack-protector-all
.endif
.if !empty(CFLAGS:M*-fstack-protector*) && \
empty(CFLAGS:M*-Wstack-protector*) && \
defined(CWARNFLAGS) && \
empty(CWARNFLAGS:M*-Wstack-protector*)
CWARNFLAGS += -Wstack-protector
.endif
# XXX should probably consider adding the following, at least for GCC to avoid
# the worst cases of allowing the optimizer to abuse "undefined behaviour" in
# counter-productive ways (bugs should be bugs!):
#
# -fwrapv -fno-delete-null-pointer-checks -fno-aggressive-loop-optimizations
#
# XXX the problem is we don't have a firm list of which optimizations are "total
# license" optimizations that abuse "undefined behaviour"
#
# XXX see also: https://stackoverflow.com/questions/33278757/disable-all-optimization-options-in-gcc
#
# XXX worse yet GCC (and perhaps Clang) only warn about certain issues IFF they
# are abusing them. For example GCC's -Wstrict-overlfow only works if
# -fstrict-overflow is enabled _and_ you have enabled a sufficient level of
# optimization to trigger it. WTFH!?!?!? The manual at least states this:
#
# Note that it does not warn about all cases where the code might
# overflow: it only warns about cases where the compiler implements some
# optimization. Thus this warning depends on the optimization level.
# This is a hack for my own NetBSD releases where older versions don't include
# CPPFLAGS in the LINK macro, so the ".c:" rule won't get CPPFLAGS..
#
# (Note: it's tempting to include "&& empty(LINK.c:M*CPPFLAGS*)" in the
# expression, but that won't work because empty() expands the variable entirely
# before applying modifiers.)
.if !defined(MAKE_VERSION) && !empty(unix:M*NetBSD*) && !defined(COMPILE_LINK.c)
LDFLAGS += ${CPPFLAGS}
.endif
# This allows builds with a NetBSD cross-compiler toolchain (i.e. with
# "${TOOLDIR}/bin/nbmake-${MACHINE}")
.if !empty(_CCLINKFLAGS)
LDFLAGS += ${_CCLINKFLAGS}
.endif
# for sjg's Mk-files
#
# we disabled all the <warnings.mk> features above with NO_CFLAGS_WARNINGS, so
# now we need to include our warnings in CFLAGS...
#
.if defined(MAKE_VERSION) && ${MAKE} != "bsdmake" && (!defined(.FreeBSD) || ${.FreeBSD} != "true")
CFLAGS += ${CWARNFLAGS}
# xxx also this, as the default ".c:" rule, using ${LINK.c}, doesn't include it
LDFLAGS += ${LDSTATIC}
.endif