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
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
|
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright 2014 Garrett D'Amore <garrett@damore.org>
# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2015 Gary Mills
# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
# Copyright 2016 Toomas Soome <tsoome@me.com>
# Copyright 2019 RackTop Systems.
# Copyright 2025 Oxide Computer Company
# Copyright 2020 Peter Tribble
# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2021 Joyent, Inc.
#
# Hammerhead: Include guard to prevent duplicate inclusion warnings from gmake
# when this file is included multiple times through different Makefile chains
ifndef _MAKEFILE_MASTER
_MAKEFILE_MASTER = 1
#
# Makefile.master, global definitions for system source
#
#
# Hammerhead: GNU Make compatibility
#
# .WAIT is supported natively in GNU Make 4.4+ as a special target
# that causes parallel builds to wait for preceding prerequisites.
# Do NOT override it - let GNU Make handle it.
#
# .KEEP_STATE is a dmake feature for dependency tracking.
# GNU Make does this automatically, so we define it as a no-op.
#
.PHONY: .KEEP_STATE
.KEEP_STATE:
# Hammerhead: Use ?= to allow environment override
ROOT ?= /proto
# Hammerhead: amd64-only build
# MACH=i386 represents the x86 CPU family (used for directory selection).
# MACH64=amd64 is used for 64-bit specific paths.
# BUILD32=$(POUND_SIGN) below disables 32-bit builds.
MACH ?= i386
MACH64 ?= amd64
#
# Adjunct root, containing an additional proto area to be searched for headers
# and libraries for the target environment, which may not necessarily function
# in the build environment.
#
# Hammerhead: Use ?= to allow environment variable to override
ADJUNCT_PROTO?=
# HAVE_ADJUNCT_PROTO - ADJUNCT_PROTO is set to a non-default value
# NO_ADJUNCT_PROTO - ADJUNCT_PROTO is unset
#
# This works by replacing any value in ADJUNCT_PROTO with POUND_SIGN, which
# only happens if it has some value, and then setting HAVE_ADJUNCT_PROTO
# oppositely.
NO_ADJUNCT_PROTO=$(ADJUNCT_PROTO:%=$(POUND_SIGN))
$(NO_ADJUNCT_PROTO)HAVE_ADJUNCT_PROTO=$(POUND_SIGN)
#
# A separate area to be searched for native tools and libraries for use by the
# build or the build machine. These libraries are specific to the build
# machine and may not work on the target machine.
#
NATIVE_ADJUNCT= /usr
#
# Compatibility code for FreeBSD etc.
#
COMPAT= $(SRC)/compat
CONTRIB= $(SRC)/contrib
#
# RELEASE_BUILD should be cleared for final release builds.
# NOT_RELEASE_BUILD is exactly what the name implies.
#
# The declaration POUND_SIGN is always '#'. This is needed to get around the
# make feature that '#' is always a comment delimiter, even when escaped or
# quoted. We use this macro expansion method to get POUND_SIGN rather than
# always breaking out a shell because the general case can cause a noticable
# slowdown in build times when so many Makefiles include Makefile.master.
#
# While the majority of users are expected to override the setting below
# with an env file (via nightly or bldenv), if you aren't building that way
# (ie, you're using "ws" or some other bootstrapping method) then you need
# this definition in order to avoid the subshell invocation mentioned above.
#
# Hammerhead: Direct definition for GNU Make compatibility
# Original dmake pattern: PRE_POUND=pre\# POUND_SIGN=$(PRE_POUND:pre\%=%)
POUND_SIGN := \#
NOT_RELEASE_BUILD=
RELEASE_BUILD= $(POUND_SIGN)
$(RELEASE_BUILD)NOT_RELEASE_BUILD= $(POUND_SIGN)
# Hammerhead: SPARC_BLD/INTEL_BLD removed - amd64 only
# Allow build-time "configuration" to enable or disable some things.
# The default is POUND_SIGN, meaning "not enabled". If the environment
# passes in an override like ENABLE_SMB_PRINTING= (empty) that will
# uncomment things in the lower Makefiles to enable the feature.
ENABLE_SMB_PRINTING= $(POUND_SIGN)
# BUILD_TOOLS is the root of all tools including compilers.
# ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
# Hammerhead: Use ?= to allow env.sh to override with local tools proto.
# Default to /opt/onbld for system-installed tools.
BUILD_TOOLS ?= /opt
ONBLD_TOOLS ?= $(BUILD_TOOLS)/onbld
# define runtime JAVA_HOME, primarily for cmd/pools/poold
JAVA_HOME= /usr/java
# define buildtime JAVA_ROOT
JAVA_ROOT= /usr/java
# Build uses java8 by default. Pass the variable below set to empty
# string in the environment to override.
BLD_JAVA_11= $(POUND_SIGN)
# Hammerhead: GCC 14 toolchain
# On OI build VM: /usr/gcc/14 (default)
# On standalone hammerhead: /usr (set GNUC_ROOT=/usr in environment)
GNUC_ROOT ?= /usr/gcc/14
GCCLIBDIR= $(GNUC_ROOT)/lib
GCCLIBDIR64= $(GNUC_ROOT)/lib/$(MACH64)
NATIVE_GNUC_ROOT= $(GNUC_ROOT)
NATIVE_GCCLIBDIR= $(NATIVE_GNUC_ROOT)/lib
NATIVE_GCCLIBDIR64= $(NATIVE_GNUC_ROOT)/lib/$(MACH64)
DOCBOOK_XSL_ROOT= /usr/share/sgml/docbook/xsl-stylesheets
# Hammerhead: Use ?= to allow environment override for tools that may be missing from onbld
RPCGEN ?= $(ONBLD_TOOLS)/bin/$(MACH)/rpcgen
ELFEXTRACT= $(ONBLD_TOOLS)/bin/$(MACH)/elfextract
# Hammerhead: mbh_patch only exists in i386 directory
MBH_PATCH= $(ONBLD_TOOLS)/bin/i386/mbh_patch
BTXLD= $(ONBLD_TOOLS)/bin/$(MACH)/btxld
# Hammerhead: Use /usr/bin/vtfontcvt as it's not in onbld
VTFONTCVT ?= /usr/bin/vtfontcvt
# Hammerhead: Use = not ?= because GNU Make has built-in defaults for YACC
# (yacc) which prevent ?= from taking effect
YACC = $(ONBLD_TOOLS)/bin/$(MACH)/yacc -P \
$(ONBLD_TOOLS)/share/lib/ccs/yaccpar
# echo(1) and true(1) are specified without absolute paths, so that the shell
# spawned by make(1) may use the built-in versions. This is minimally
# problematic, as the shell spawned by make(1) is known and under control, the
# only risk being if the shell falls back to $PATH.
#
# We specifically want an echo(1) that does interpolation of escape sequences,
# which ksh93, /bin/sh, and bash will all provide.
ECHO= echo
TRUE= true
INS= $(ONBLD_TOOLS)/bin/$(MACH)/install
# Hammerhead: Tools with ?= can be overridden by the env file.
# On standalone Hammerhead, boot-essential commands are in /bin/ (not /usr/bin/).
# hammerhead.sh exports /bin/ paths; OI builds use the /usr/bin/ defaults below.
ED ?= /usr/bin/ed
SYMLINK ?= /usr/bin/ln -s
LN ?= /usr/bin/ln
MKDIR ?= /usr/bin/mkdir
CHMOD ?= /usr/bin/chmod
MV ?= /usr/bin/mv -f
RM ?= /usr/bin/rm -f
CUT= /usr/bin/cut
NM= /usr/bin/nm
DIFF= /usr/bin/diff
GREP ?= /usr/bin/grep
EGREP ?= /usr/bin/egrep
ELFWRAP= /usr/bin/elfwrap
KSH93 ?= /usr/bin/ksh93
SED ?= /usr/bin/sed
AWK ?= /usr/bin/nawk
CP ?= /usr/bin/cp -f
MCS= /usr/bin/mcs
CAT ?= /usr/bin/cat
ELFDUMP= /usr/bin/elfdump
M4 ?= /usr/bin/m4
GM4 ?= /usr/bin/gm4
STRIP= /usr/bin/strip
# Hammerhead: Use = not ?= because GNU Make has built-in defaults for LEX
# (lex) which prevent ?= from taking effect
LEX = $(ONBLD_TOOLS)/bin/$(MACH)/lex -Y $(ONBLD_TOOLS)/share/lib/ccs
FLEX= /usr/bin/flex
BISON= /usr/bin/bison
CPP= /usr/bin/cpp
SH ?= /usr/bin/sh
ANSI_CPP= $(GNUC_ROOT)/bin/cpp
JAVAC= $(JAVA_ROOT)/bin/javac
JAVADOC= $(JAVA_ROOT)/bin/javadoc
JAR= $(JAVA_ROOT)/bin/jar
CTFCONVERT= $(ONBLD_TOOLS)/bin/$(MACH)/ctfconvert
CTFDIFF= $(ONBLD_TOOLS)/bin/$(MACH)/ctfdiff
CTFMERGE= $(ONBLD_TOOLS)/bin/$(MACH)/ctfmerge
CTFSTABS= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
CTFSTRIP= $(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip
MANLINK= $(ONBLD_TOOLS)/bin/$(MACH)/manlink
NDRGEN= $(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
# Hammerhead: Use our patched genoffsets that adds -E flag for GCC 14
GENOFFSETS= $(SRC)/tools/scripts/genoffsets
XREF= $(ONBLD_TOOLS)/bin/xref
FIND= /usr/bin/find
PERL= /usr/bin/perl
PERL_VERSION= 5.10.0
PERL_PKGVERS= -510
PERL_MACH= i86pc
PERL_VARIANT=
PERL_ARCH= $(PERL_MACH)-solaris$(PERL_VARIANT)-64int
PERL_ARCH64= $(PERL_MACH)-solaris$(PERL_VARIANT)-64
PYTHON3_VERSION= 3.9
PYTHON3_PKGVERS= -39
PYTHON3_SUFFIX=
PYTHON3= /usr/bin/python$(PYTHON3_VERSION)
# BUILDPY3b should be overridden in the env file in order to build python
# modules with a secondary python to aid migration between versions.
BUILDPY3b= $(POUND_SIGN)
PYTHON3b_VERSION= 3.5
PYTHON3b_PKGVERS= -35
PYTHON3b_SUFFIX= m
#
$(BUILDPY3b)PYTHON3b= /usr/bin/python$(PYTHON3b_VERSION)
TOOLS_PYTHON= $(PYTHON3)
SORT ?= /usr/bin/sort
TR ?= /usr/bin/tr
TOUCH= /usr/bin/touch
WC= /usr/bin/wc
XARGS ?= /usr/bin/xargs
ELFEDIT= /usr/bin/elfedit
# Hammerhead: dtrace -G invokes the illumos linker (sunld) for DOF linking.
# LD_ALTEXEC must be cleared so sunld doesn't redirect to gnu-ld-wrapper
# (which doesn't support -Blocal/-Breduce used by dtrace DOF linking).
DTRACE= LD_ALTEXEC= /usr/sbin/dtrace -xnolibs -xldpath=/usr/bin/sunld
UNIQ= /usr/bin/uniq
TAR= /usr/bin/tar
ASTBINDIR= /usr/bin
MSGCC= $(ASTBINDIR)/msgcc
MSGFMT= /usr/bin/msgfmt -s
LCDEF= $(ONBLD_TOOLS)/bin/$(MACH)/localedef
TIC= $(ONBLD_TOOLS)/bin/$(MACH)/tic
ZIC= $(ONBLD_TOOLS)/bin/$(MACH)/zic
OPENSSL= /usr/bin/openssl
CPCGEN= $(ONBLD_TOOLS)/bin/$(MACH)/cpcgen
GENICONVTBL= $(ONBLD_TOOLS)/bin/$(MACH)/geniconvtbl
DEFAULT_CONSOLE_COLOR= \
-DDEFAULT_ANSI_FOREGROUND=ANSI_COLOR_WHITE \
-DDEFAULT_ANSI_BACKGROUND=ANSI_COLOR_BLACK
FILEMODE= 644
DIRMODE= 755
# Hammerhead: GNU Make compatibility
# In dmake, .NOTPARALLEL: was the default, overridden by .PARALLEL: in subdirs.
# In GNU Make, parallelism is controlled by -j flag. We don't set .NOTPARALLEL:
# here because that would globally disable parallelism.
# Individual Makefiles that need serial builds should use .NOTPARALLEL:
# For stylistic checks
#
# Note that the X and C checks are not used at this time and may need
# modification when they are actually used.
#
CSTYLE= $(ONBLD_TOOLS)/bin/cstyle
CSTYLE_TAIL=
HDRCHK= $(ONBLD_TOOLS)/bin/hdrchk
HDRCHK_TAIL=
JSTYLE= $(ONBLD_TOOLS)/bin/jstyle
DOT_H_CHECK= \
@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
$(HDRCHK) $< $(HDRCHK_TAIL)
# Hammerhead: pre-generated (rpcgen + GNU cpp truncation bug)
# DOT_X_CHECK= \
# @$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
# $(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
DOT_X_CHECK= \
@$(ECHO) "skipping rpcgen check for $< (pre-generated)"
DOT_C_CHECK= \
@$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
MANIFEST_CHECK= @:
INS.file= $(RM) $@; $(INS) -s -m $(FILEMODE) -f $(@D) $<
INS.dir= $(INS) -s -d -m $(DIRMODE) $@
# installs and renames at once
#
INS.rename= $(INS.file); $(MV) $(@D)/$(<F) $@
# install a link
INSLINKTARGET= $<
INS.link= $(RM) $@; $(LN) $(INSLINKTARGET) $@
INS.symlink= $(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
# The path to python that will be used for the shebang line when installing
# python scripts to the proto area. This is overridden by makefiles to
# select to the correct version.
PYSHEBANG= $(PYTHON3)
#
# Python bakes the mtime of the .py file into the compiled .pyc and
# rebuilds if the baked-in mtime != the mtime of the source file
# (rather than only if it's less than), thus when installing python
# files we must make certain to not adjust the mtime of the source
# (.py) file.
#
INS.pyfile= $(RM) $@; $(SED) \
-e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \
-e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \
< $< > $@; $(CHMOD) $(FILEMODE) $@; $(TOUCH) -r $< $@
# MACH must be set in the shell environment per uname -p on the build host
# More specific architecture variables should be set in lower makefiles.
# Hammerhead: Simplified for amd64-only - 64-bit only, no 32-bit builds
MACH64= amd64
BUILD64=
BUILD32= $(POUND_SIGN)
#
# C compiler verbose mode. This is so we can enable it globally,
# but turn it off in the lower level makefiles of things we cannot
# (or aren't going to) fix.
#
CCVERBOSE= -v
#
# generate v9 code which tolerates callers using the v7 ABI, for the sake of
# system calls.
CC32BITCALLERS= -massume-32bit-callers
# GCC, especially, is increasingly beginning to auto-inline functions and
# sadly does so separately not under the general -fno-inline-functions
# Additionally, we wish to prevent optimisations which cause GCC to clone
# functions -- in particular, these may cause unhelpful symbols to be
# emitted instead of function names
CCNOAUTOINLINE= \
-fno-inline-small-functions \
-fno-inline-functions-called-once \
-fno-ipa-cp \
-fno-ipa-icf
# GCC may put functions in different named sub-sections of .text based on
# their presumed calling frequency. At least in the kernel, where we actually
# deliver relocatable objects, we don't want this to happen.
#
# Since at present we don't benefit from this even in userland, we disable it globally,
# but the application of this may move into usr/src/uts/ in future.
CCNOREORDER= -fno-reorder-functions \
-fno-reorder-blocks-and-partition
#
# gcc has a rather aggressive optimization on by default that infers loop
# bounds based on undefined behavior (!!). This can lead to some VERY
# surprising optimizations -- ones that may be technically correct in the
# strictest sense but also result in incorrect program behavior. We turn
# this optimization off, with extreme prejudice.
#
CCNOAGGRESSIVELOOPS= -fno-aggressive-loop-optimizations
#
# gcc has a limit on the maximum size of a function which will be inlined
# in the presence of the 'inline' keyword; this limit varies between versions
# of gcc. For consistent output and to ensure that some of the slightly larger
# functions are inlined as intended, we specify the limit explicitly.
#
CCINLINESIZE= --param=max-inline-insns-single=450
CCWARNINLINE= -Winline
#
# Options to control which version of stack-protector we enable. This
# gives us a bit of flexibility and is unfortunately necessary as some
# modules do not function correctly with our defaults (qede).
#
# o STACKPROTECT_ Sets the appropriate version for the compiler
# o STACKPROTECT_strong Sets us to use strong on all of the
# compilers it supports. This is the same
# as the default.
#
# o STACKPROTECT_none Disables the stack protector.
#
# o STACKPROTECT_all Enables it for everything.
#
# o STACKPROTECT_basic Enables the basic stack protector.
#
# -fstack-protector-strong is not available in gcc4 which is why we
# have per-compiler versions below. These are not added to the default
# global CFLAGS at this time as it's being incrementally enabled
# throughout the build.
#
STACKPROTECT_ = -fstack-protector-strong
STACKPROTECT_strong = $(STACKPROTECT_)
STACKPROTECT_none =
STACKPROTECT_all = -fstack-protector-all
STACKPROTECT_basic = -fstack-protector
STACKPROTECT_LD_ = -lssp_ns
STACKPROTECT_LD_none =
STACKPROTECT_LD_all = $(STACKPROTECT_LD_)
STACKPROTECT_LD_basic = $(STACKPROTECT_LD_)
CCSTACKPROTECT= $(STACKPROTECT_$(STACKPROTECT))
LDSTACKPROTECT= $(STACKPROTECT_LD_$(STACKPROTECT))
# Hammerhead: amd64-only XARCH flag
amd64_XARCH= -m64 -Ui386 -U__i386
# Hammerhead: i386 (32-bit) flags needed for dboot early boot code
# The dboot code starts in 32-bit protected mode before transitioning to 64-bit
i386_XARCH= -m32
i386_CFLAGS= $(i386_XARCH)
i386_ASFLAGS= $(i386_CFLAGS)
#
# These flags define what we need to be 'standalone' i.e. -not- part
# of the rather more cosy userland environment. This basically means
# the kernel.
#
# Disabling MMX also disables 3DNow, disabling SSE also disables all later
# additions to SSE (SSE2, AVX ,etc.)
NO_SIMD= -mno-mmx -mno-sse
# Hammerhead: Changed -xmodel=kernel to GCC -mcmodel=kernel
# -mno-red-zone is critical: the x86_64 ABI red zone (128 bytes below rsp)
# must not be used in kernel code — interrupts and traps use the stack from
# rsp and will overwrite red zone data, corrupting local variables.
amd64_STAND_FLAGS= -mcmodel=kernel -mno-red-zone $(NO_SIMD)
# Hammerhead: -msave-args saves function arguments on stack for mdb debugging.
# This is an illumos-patched GCC extension (not available in stock upstream GCC).
# On OI build VM: set SAVEARGS=-msave-args in environment (hammerhead.sh does this)
# On standalone: leave empty (stock GCC 14 from bootstrap)
SAVEARGS ?=
amd64_STAND_FLAGS += $(SAVEARGS)
# Hammerhead: amd64-only - no 32-bit STAND_FLAGS
STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
#
# turn warnings into errors (C)
# Hammerhead: Changed Sun Studio flags to GCC equivalents
CERRWARN = -Wall -Wextra -Werror
CERRWARN += -Wno-missing-braces
CERRWARN += -Wno-sign-compare
CERRWARN += -Wno-unused-parameter
CERRWARN += -Wno-missing-field-initializers
# Unfortunately, this option can misfire very easily and unfixably.
CERRWARN += -Wno-array-bounds
CNOWARN_UNINIT = -Wno-maybe-uninitialized
CERRWARN +=
include $(SRC)/Makefile.smatch
#
# turn warnings into errors (C++)
# Hammerhead: Changed Sun Studio flags to GCC equivalents
CCERRWARN = -Wall -Wextra -Werror
CCERRWARN += -Wno-missing-braces
CCERRWARN += -Wno-sign-compare
CCERRWARN += -Wno-unused-parameter
CCERRWARN += -Wno-missing-field-initializers
# C standard
# Hammerhead: Changed Sun Studio -xc99 to GCC -std
CSTD_GNU89= -std=gnu89
CSTD_GNU99= -std=gnu99
CSTD_GNU17= -std=gnu17
CSTD= $(CSTD_GNU89)
# In most places, assignments to these macros should be appended with +=
# (CPPFLAGS.first allows values to be prepended to CPPFLAGS).
# Hammerhead: SPARC CFLAGS removed - amd64 only
# Hammerhead: amd64-only CFLAGS
amd64_CFLAGS= $(amd64_XARCH)
$(MACH64)_ASFLAGS= $($(MACH64)_CFLAGS)
ASFLAGS64= $($(MACH64)_ASFLAGS)
# Hammerhead: amd64-only optimization flags
amd64_COPTFLAG= -O2
COPTFLAG64= $($(MACH64)_COPTFLAG)
# Sometimes we want all symbols and types in debugging information even
# if they aren't used.
CALLSYMS= -fno-eliminate-unused-debug-symbols \
-fno-eliminate-unused-debug-types
#
# We force the compilers to generate the debugging information best understood
# by the CTF tools. Currently this is DWARFv4.
#
DEBUGFORMAT= -gdwarf-4 -gstrict-dwarf
#
# Ask the compiler to include debugging information
#
CCGDEBUG= -g $(DEBUGFORMAT)
#
# Flags used to build in debug mode for ctf generation.
#
# Hammerhead: amd64-only CTF_FLAGS
CTF_FLAGS_amd64 = $(CCGDEBUG) $(CSTD) $(SAVEARGS)
CTF_FLAGS_64 = $(CTF_FLAGS_$(MACH64))
CTF_FLAGS = $(CTF_FLAGS_64)
#
# Flags used with genoffsets
# Hammerhead: Add -Wno-builtin-declaration-mismatch for GCC 14 compatibility
GENOFFSETS_FLAGS = $(CALLSYMS) -Wno-builtin-declaration-mismatch
# Hammerhead: Use GCC directly instead of cw wrapper
OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
$(GCC) $(GENOFFSETS_FLAGS) $(CFLAGS) $(CPPFLAGS)
OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
$(GCC) $(GENOFFSETS_FLAGS) $(CFLAGS64) $(CPPFLAGS)
# dmake SOURCEDEBUG=yes ... enables source-level debugging information, and
# avoids stripping it.
SOURCEDEBUG = $(POUND_SIGN)
SRCDBGBLD = $(SOURCEDEBUG:yes=)
#
# These variables are intended ONLY for use by developers to safely pass extra
# flags to the compilers without unintentionally overriding Makefile-set
# flags. They should NEVER be set to any value in a Makefile.
#
# They come last in the associated FLAGS variable such that they can
# explicitly override things if necessary, there are gaps in this, but it's
# the best we can manage.
#
CUSERFLAGS =
CUSERFLAGS64 = $(CUSERFLAGS)
CCUSERFLAGS =
CCUSERFLAGS64 = $(CCUSERFLAGS)
CSOURCEDEBUGFLAGS =
CCSOURCEDEBUGFLAGS =
$(SRCDBGBLD)CSOURCEDEBUGFLAGS = $(CCGDEBUG)
$(SRCDBGBLD)CCSOURCEDEBUGFLAGS = $(CCGDEBUG)
# Hammerhead: For amd64-only build, CFLAGS uses 64-bit settings
# Original illumos uses $(MACH)_CFLAGS which would be i386_CFLAGS (-m32)
# We use $(MACH64)_CFLAGS which is amd64_CFLAGS (-m64)
CFLAGS= $(COPTFLAG64) $($(MACH64)_CFLAGS) \
$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) $(CCNOREORDER) \
$(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
CFLAGS64= $(COPTFLAG64) $($(MACH64)_CFLAGS) \
$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) $(CCNOREORDER) \
$(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS64)
#
# Flags that are used to build parts of the code that are subsequently
# run on the build machine (also known as the NATIVE_BUILD).
#
NATIVE_CFLAGS= $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) \
$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) \
$(CCNOREORDER) $(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
NATIVE_ASFLAGS= $(NATIVE_CFLAGS)
NATIVE_CCFLAGS= $(CCOPTFLAG) $($(NATIVE_MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
$(CCUSERFLAGS)
NATIVE_CFLAGS64= $(COPTFLAG64) $($(NATIVE_MACH64)_CFLAGS) \
$(CERRWARN) $(CSTD) $(CCNOAUTOINLINE) \
$(CCNOREORDER) $(CCNOAGGRESSIVELOOPS) $(CCINLINESIZE) \
$(CSOURCEDEBUGFLAGS) $(CUSERFLAGS64)
NATIVE_ASFLAGS64= $(NATIVE_CFLAGS64)
NATIVE_CCFLAGS64= $(CCOPTFLAG64) $($(NATIVE_MACH64)_CCFLAGS) \
$(CCSOURCEDEBUGFLAGS) $(CCUSERFLAGS64)
DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\" # For messaging.
DTS_ERRNO=-D_TS_ERRNO
CPPFLAGS.first= # Please keep empty. Only lower makefiles should set this.
CPPFLAGS.master=$(DTEXTDOM) $(DTS_ERRNO) \
$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
$(ADJUNCT_PROTO:%=-I%/usr/include)
CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
$(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master)
AS_CPPFLAGS= $(CPPFLAGS.first) $(CPPFLAGS.master)
JAVAFLAGS= -source 7 -target 7 -Xlint:deprecation,-options
$(BLD_JAVA_11)JAVAFLAGS= -source 7 -target 7 -Xlint:-options
#
# For source message catalogue
#
.SUFFIXES: $(SUFFIXES) .i .po
MSGROOT= $(ROOT)/catalog
MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
CLOBBERFILES += $(POFILE) $(POFILES)
COMPILE.cpp= $(CC) -E -C $(CFLAGS) $(CPPFLAGS)
# Hammerhead: C++ preprocessor for message extraction - uses CCFLAGS instead of CFLAGS
# to avoid passing -std=gnu89 (a C-only flag) to the C++ compiler
COMPILE.ccpp= $(CCC) -E -C $(CCFLAGS) $(CPPFLAGS)
XGETTEXT= /usr/bin/xgettext
XGETFLAGS= -c TRANSLATION_NOTE
# Hammerhead: GNU xgettext may not be at /usr/gnu/bin on self-hosted builds
GNUXGETTEXT= $(shell test -x /usr/gnu/bin/xgettext && echo /usr/gnu/bin/xgettext || echo /bin/true)
GNUXGETFLAGS= --add-comments=TRANSLATION_NOTE --keyword=_ \
--strict --no-location --omit-header
BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
$(RM) $@ ;\
$(SED) "/^domain/d" < $(<F).po > $@ ;\
$(RM) $(<F).po $<.i
#
# This is overwritten by local Makefile when PROG is a list.
#
POFILE= $(PROG).po
# Hammerhead: amd64-only CCFLAGS
amd64_CCFLAGS= $(amd64_XARCH) $(CCERRWARN)
amd64_CCOPTFLAG= -O
CCOPTFLAG64= $($(MACH64)_CCOPTFLAG)
CCFLAGS64= $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
$(CCUSERFLAGS64)
#
#
#
ELFWRAP_FLAGS =
ELFWRAP_FLAGS64 = -64
#
# Various mapfiles that are used throughout the build, and delivered to
# /usr/lib/ld.
#
# Hammerhead: amd64-only mapfiles
MAPFILE.NED = $(SRC)/common/mapfiles/common/map.noexdata
MAPFILE.PGA = $(SRC)/common/mapfiles/common/map.pagealign
MAPFILE.NES = $(SRC)/common/mapfiles/common/map.noexstk
MAPFILE.FLT = $(SRC)/common/mapfiles/common/map.filter
MAPFILE.LEX = $(SRC)/common/mapfiles/common/map.lex.yy
#
# Generated mapfiles that are compiler specific, and used throughout the
# build. These mapfiles are not delivered in /usr/lib/ld.
#
# Hammerhead: amd64-only mapfiles
MAPFILE.NGB_amd64 = $(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
MAPFILE.NGB = $(MAPFILE.NGB_$(MACH64))
#
# A generic interface mapfile name, used by various dynamic objects to define
# the interfaces and interposers the object must export.
#
MAPFILE.INT = mapfile-intf
#
# LDLIBS32 and LDLIBS64 can be set in the environment to override the following
# assignments.
#
LDLIBS32 = $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
# Hammerhead: GNU Make pattern substitution only replaces ONE % in replacement.
# Use separate substitutions for each -L path.
LDLIBS32 += $(ADJUNCT_PROTO:%=-L%/usr/lib) $(ADJUNCT_PROTO:%=-L%/lib)
LDLIBS.cmd = $(LDLIBS32)
LDLIBS.lib = $(LDLIBS32)
# Hammerhead: 64-bit only - flatten library paths (no amd64 subdirectory)
# Libraries install to $ROOT/lib and $ROOT/usr/lib directly, so search
# paths are the same as LDLIBS32.
LDLIBS64 = $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
LDLIBS64 += $(ADJUNCT_PROTO:%=-L%/usr/lib) $(ADJUNCT_PROTO:%=-L%/lib)
#
# Define compilation macros.
#
COMPILE.c= $(CC) $(CFLAGS) $(CPPFLAGS) -c
COMPILE64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) -c
COMPILE.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) -c
COMPILE64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
COMPILE.s= $(AS) $(ASFLAGS) $(AS_CPPFLAGS) -c
COMPILE64.s= $(AS) $(ASFLAGS64) $(AS_CPPFLAGS) -c
COMPILE.d= $(DTRACE) -G -64
COMPILE64.d= $(DTRACE) -G -64
COMPILE.b= $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
COMPILE64.b= $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
CLASSPATH= .
COMPILE.java= $(JAVAC) $(JAVAFLAGS) -classpath $(CLASSPATH)
#
# Link time macros
#
CCNEEDED = -L$(GCCLIBDIR) -lstdc++ -lgcc_s
CCEXTNEEDED = $(CCNEEDED)
NATIVECCNEEDED = -R$(NATIVE_GCCLIBDIR) -L$(NATIVE_GCCLIBDIR) -lstdc++ -lgcc_s
CCNEEDED64 = -L$(GCCLIBDIR) -lstdc++ -lgcc_s
NATIVECCNEEDED64 = -R$(NATIVE_GCCLIBDIR) -L$(NATIVE_GCCLIBDIR) -lstdc++ -lgcc_s
CCEXTNEEDED = $(CCNEEDED64)
# Libraries we expect to use natively on the build machine
NATIVE_LIBS=
LDCHECKS = $(ZASSERTDEFLIB) $(ZGUIDANCE) $(ZFATALWARNINGS)
# Hammerhead: Only add =lib syntax when ZASSERTDEFLIB is set
LDCHECKS += $(if $(ZASSERTDEFLIB),$(NATIVE_LIBS:%=$(ZASSERTDEFLIB)=%))
LINK.c= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LDCHECKS)
LINK64.c= $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS) $(LDCHECKS)
# Hammerhead: Sun Studio -nolib prevents default runpaths; GCC doesn't add them
NORUNPATH=
LINK.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
$(LDFLAGS) $(CCNEEDED) $(LDCHECKS)
LINK64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
$(LDFLAGS) $(CCNEEDED64) $(LDCHECKS)
# Hammerhead: amd64-only build - native tools are built as 64-bit
# (Legacy illumos used NATIVE_MACH=i386 for cross-compiling amd64 on 32-bit hosts)
# MACH=i386 is the platform, MACH64=amd64 is the 64-bit ABI
NATIVE_MACH= $(MACH64)
NATIVE_MACH64= $(MACH64)
# Base directory where compilers can be found. Usually overridden in the
# environment.
GNU_ROOT= /usr
# Hammerhead: Use GCC 14 directly (cw wrapper removed)
GCC= $(GNUC_ROOT)/bin/gcc
GXX= $(GNUC_ROOT)/bin/g++
# Base GCC flags (previously added by cw wrapper)
# These ensure consistent behavior across the codebase
GCC_BASE_FLAGS = \
-fident \
-finline \
-fno-inline-functions \
-fno-builtin \
-fno-asm \
-fdiagnostics-show-option \
-nodefaultlibs \
-D__sun \
-fno-strict-aliasing \
-fno-unit-at-a-time \
-fno-optimize-sibling-calls \
-Wno-builtin-declaration-mismatch
# Native build flags - same as above but WITHOUT -nodefaultlibs
# Native tools (like genassym) need to link against host libc
GCC_NATIVE_FLAGS = \
-fident \
-finline \
-fno-inline-functions \
-fno-builtin \
-fno-asm \
-fdiagnostics-show-option \
-D__sun \
-fno-strict-aliasing \
-fno-unit-at-a-time \
-fno-optimize-sibling-calls \
-Wno-builtin-declaration-mismatch
# Use LD_ALTEXEC to tell the illumos linker to use our GNU ld wrapper
# GCC on OpenIndiana is configured with --with-ld=/usr/bin/ld, so we need
# LD_ALTEXEC to redirect to our wrapper
BUILD_CC= LD_ALTEXEC=$(LD) $(GCC) $(GCC_BASE_FLAGS)
BUILD_CCC= LD_ALTEXEC=$(LD) $(GXX) $(GCC_BASE_FLAGS)
BUILD_CPP= /usr/bin/cpp
# Hammerhead: GNU ld wrapper converts illumos linker flags for GNU ld
BUILD_LD ?= /usr/local/bin/gnu-ld-wrapper
BUILD_AS= $(BUILD_CC)
# Hammerhead: illumos native linker — used by kernel, rtld, and MDB modules.
# Defaults to /usr/bin/ld (OI build VM). On standalone hammerhead,
# override to /usr/bin/sunld (GNU ld occupies /usr/bin/ld).
SUNLD ?= /usr/bin/ld
# Hammerhead: Native builds use GCC_NATIVE_FLAGS (no -nodefaultlibs)
NATIVEBUILD_CC= $(GCC) $(GCC_NATIVE_FLAGS)
NATIVEBUILD_CCC= $(GXX) $(GCC_NATIVE_FLAGS)
NATIVEBUILD_CPP= /usr/bin/cpp
# Hammerhead: GNU ld wrapper converts illumos linker flags for GNU ld
NATIVEBUILD_LD ?= /usr/local/bin/gnu-ld-wrapper
NATIVEBUILD_AS= $(NATIVEBUILD_CC)
$(MACH)_CC= $(BUILD_CC)
$(MACH)_CCC= $(BUILD_CCC)
$(MACH)_CPP= $(BUILD_CPP)
$(MACH)_LD= $(BUILD_LD)
$(MACH)_AS= $(BUILD_AS)
# Hammerhead: Explicit i386 compiler for dboot 32-bit early boot code
# The dboot code must always be compiled as 32-bit regardless of target arch
# Include LD_ALTEXEC to use GNU ld wrapper for linking
i386_CC= LD_ALTEXEC=$(BUILD_LD) $(GCC) $(GCC_BASE_FLAGS) $(i386_XARCH)
i386_AS= $(i386_CC)
$(MACH64)_CC= $(BUILD_CC)
$(MACH64)_CCC= $(BUILD_CCC)
$(MACH64)_CPP= $(BUILD_CPP)
$(MACH64)_LD= $(BUILD_LD)
$(MACH64)_AS= $(BUILD_AS)
NATIVECC= $(NATIVEBUILD_CC)
NATIVECCC= $(NATIVEBUILD_CCC)
NATIVECPP= $(NATIVEBUILD_CPP)
NATIVEAS= $(NATIVEBUILD_AS)
NATIVELD= $(NATIVEBUILD_LD)
NATIVECC64= $(NATIVEBUILD_CC)
NATIVECCC64= $(NATIVEBUILD_CCC)
NATIVECPP64= $(NATIVEBUILD_CPP)
NATIVEAS64= $(NATIVEBUILD_AS)
NATIVELD64= $(NATIVEBUILD_LD)
#
# Makefile.master.64 overrides these settings
#
CC= $($(MACH)_CC)
CCC= $($(MACH)_CCC)
CPP= $($(MACH)_CPP)
AS= $($(MACH)_AS)
LD= $($(MACH)_LD)
CC64= $($(MACH64)_CC)
CCC64= $($(MACH64)_CCC)
CPP64= $($(MACH64)_CPP)
AS64= $($(MACH64)_AS)
LD64= $($(MACH64)_LD)
# Hammerhead: GCC uses -I instead of Sun Studio's -Y I,
# Note: trailing space is intentional (path is concatenated directly)
CCYFLAG= -I
# Hammerhead: GNU ld compatible linker flags
# Flags supported by GNU ld - keep as-is
BDYNAMIC= -Wl,-Bdynamic
BSTATIC= -Wl,-Bstatic
BSYMBOLIC= -Wl,-Bsymbolic
# Flags NOT supported by GNU ld - set empty (illumos-specific optimizations)
BDIRECT=
BLOCAL=
BNODIRECT=
BREDUCE=
# Z-flags supported by GNU ld
ZDEFS= -Wl,-zdefs
ZINITFIRST= -Wl,-zinitfirst
ZINTERPOSE= -Wl,-zinterpose
ZLOADFLTR= -Wl,-zloadfltr
ZMULDEFS= -Wl,-zmuldefs
ZNODEFAULTLIB= -Wl,-znodefaultlib
ZNODEFS= -Wl,-znodefs
ZNODELETE= -Wl,-znodelete
ZNODLOPEN= -Wl,-znodlopen
ZNODUMP= -Wl,-znodump
ZTEXT= -Wl,-ztext
# Z-flags NOT supported by GNU ld - set empty
ZDIRECT=
ZIGNORE=
ZLAZYLOAD=
ZNOLAZYLOAD=
ZNOLDYNSYM=
ZNOVERSION=
ZRECORD=
ZREDLOCSYM=
ZVERBOSE=
ZASSERTDEFLIB=
ZGUIDANCE=
# ZNORELOC: Keep for kernel module linking (test during validation)
ZNORELOC= -Wl,-znoreloc
# GNU ld syntax adjustments
ZFATALWARNINGS= -Wl,--fatal-warnings
# ZASLR: Use PIE for ASLR support
ZASLR= -Wl,-pie
# Hammerhead: Use GNU ld for shared library linking
# We rely on LD_ALTEXEC (set in Makefile.tools) to direct GCC to use
# gnu-ld-wrapper, which handles flag/mapfile conversion.
# Note: -fuse-ld=bfd doesn't work with GCC configured --without-gnu-ld
GSHARED= -shared
CCMT= -mt
# Handle different PIC models on different ISAs
# (May be overridden by lower-level Makefiles)
# Hammerhead: amd64-only PICFLAGS
# Note: i386_* flags needed because NATIVE_MACH=i386 for native builds
# Use -fPIC (uppercase) for amd64 - GNU ld requires this for R_X86_64_32S
# relocations that exceed the small PIC model's 32-bit GOT offset limit.
# The illumos linker was lenient about -fpic vs -fPIC but GNU ld is not.
i386_C_PICFLAGS = -fPIC
amd64_C_PICFLAGS = -fPIC
C_PICFLAGS = $($(MACH)_C_PICFLAGS)
C_PICFLAGS64 = $($(MACH64)_C_PICFLAGS)
i386_C_BIGPICFLAGS = -fPIC
amd64_C_BIGPICFLAGS = -fPIC
C_BIGPICFLAGS = $($(MACH)_C_BIGPICFLAGS)
C_BIGPICFLAGS64 = $($(MACH64)_C_BIGPICFLAGS)
i386_CC_PICFLAGS = -fPIC
amd64_CC_PICFLAGS = -fPIC
CC_PICFLAGS = $($(MACH)_CC_PICFLAGS)
CC_PICFLAGS64 = $($(MACH64)_CC_PICFLAGS)
# Hammerhead: amd64-only assembler PIC flags
AS_PICFLAGS= $(C_PICFLAGS64)
AS_BIGPICFLAGS= $(C_BIGPICFLAGS64)
#
# Default label for CTF sections
#
CTFCVTFLAGS= -L VERSION
#
# Override to pass module-specific flags to ctfmerge. Currently used only by
# krtld to turn on fuzzy matching, and source-level debugging to inhibit
# stripping.
#
# Hammerhead: -m allows files without CTF data (e.g., assembly files)
CTFMRGFLAGS= -m
CTFCONVERT_O = $(CTFCONVERT) $(CTFCVTFLAGS) $@
# Rules (normally from make.rules) and macros which are used for post
# processing files. Normally, these do stripping of the comment section
# automatically.
# RELEASE_CM: Should be edited to reflect the release.
# POST_PROCESS_O: Post-processing for `.o' files (typically C source)
# POST_PROCESS_S_O: Post-processing for `.o' files built from asssembly
# POST_PROCESS_CC_O: Post-processing for `.o' files built from C++
# POST_PROCESS_A: Post-processing for `.a' files (currently null).
# POST_PROCESS_SO: Post-processing for `.so' files.
# POST_PROCESS: Post-processing for executable files (no suffix).
#
# Note that these macros are not completely generalized as they are to be
# used with the file name to be processed following.
#
# It is left as an exercise to Release Engineering to embellish the generation
# of the release comment string.
#
# If this is a standard development build:
# compress the comment section (mcs -c)
# add the standard comment (mcs -a $(RELEASE_CM))
# add the development specific comment (mcs -a $(DEV_CM))
#
# If this is an installation build:
# delete the comment section (mcs -d)
# add the standard comment (mcs -a $(RELEASE_CM))
# add the development specific comment (mcs -a $(DEV_CM))
#
# If this is an release build:
# delete the comment section (mcs -d)
# add the standard comment (mcs -a $(RELEASE_CM))
#
# The following list of macros are used in the definition of RELEASE_CM
# which is used to label all binaries in the build:
#
# RELEASE Specific release of the build, eg: 5.2
# RELEASE_MAJOR Major version number part of $(RELEASE)
# RELEASE_MINOR Minor version number part of $(RELEASE)
# VERSION Version of the build (alpha, beta, Generic)
# RELEASE_DATE Date of the Release Build
#
RELEASE_MAJOR= 5
RELEASE_MINOR= 11
RELEASE= $(RELEASE_MAJOR).$(RELEASE_MINOR)
VERSION= Hammerhead
RELEASE_DATE= release date not set
RELEASE_CM= "@($(POUND_SIGN))illumos $(VERSION) $(RELEASE_DATE)"
DEV_CM_TAIL= development build: $(LOGNAME)
DEV_CM= "@($(POUND_SIGN))illumos $(DEV_CM_TAIL)"
UTS_LABEL= $(RELEASE)
#
# The boot banner may be overridden by distributions. Up to five lines can be
# specified by overriding the BOOTBANNER macros, and any line that expands to
# an empty string will not be printed. See comments in
# bootbanner_expand_template() for more details about the template string
# format.
#
BOOTBANNER1= ^o Version ^v ^w-bit
BOOTBANNER2=
BOOTBANNER3=
BOOTBANNER4=
BOOTBANNER5=
# Hammerhead: Changed @? (dmake syntax) to -@ (GNU Make: - ignore errors, @ silent)
PROCESS_COMMENT= -@${MCS} -d -a $(RELEASE_CM) -a $(DEV_CM)
$(RELEASE_BUILD)PROCESS_COMMENT= -@${MCS} -d -a $(RELEASE_CM)
STRIP_STABS= $(STRIP) -x $@
$(SRCDBGBLD)STRIP_STABS= :
PROCESS_CTF= :
POST_PROCESS_O=
POST_PROCESS_S_O=
POST_PROCESS_CC_O=
POST_PROCESS_A=
POST_PROCESS_SO= $(PROCESS_COMMENT) $@ ; $(STRIP_STABS) ; \
$(ELFSIGN_OBJECT)
POST_PROCESS= $(PROCESS_COMMENT) $@ ; $(PROCESS_CTF) ; \
$(STRIP_STABS) ; $(ELFSIGN_OBJECT)
#
# PKGARCHIVE specifies the default location where packages should be
# placed if built.
#
$(RELEASE_BUILD)PKGARCHIVESUFFIX= -nd
PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly$(PKGARCHIVESUFFIX)
#
# The repositories will be created with these publisher settings. To
# update an image to the resulting repositories, this must match the
# publisher name provided to "pkg set-publisher."
#
PKGPUBLISHER_REDIST= on-nightly
PKGPUBLISHER_NONREDIST= on-extra
# Allow suffix rules like the below for .S as well as .s
.SUFFIXES: .S
# Default build rules which perform comment section post-processing.
#
.c:
$(LINK.c) -o $@ $< $(LDLIBS)
$(POST_PROCESS)
.c.o:
$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
$(POST_PROCESS_O)
.c.a:
$(COMPILE.c) -o $% $<
$(PROCESS_COMMENT) $%
$(AR) $(ARFLAGS) $@ $%
$(RM) $%
.s.o:
$(COMPILE.s) -o $@ $<
$(POST_PROCESS_S_O)
.s.a:
$(COMPILE.s) -o $% $<
$(PROCESS_COMMENT) $%
$(AR) $(ARFLAGS) $@ $%
$(RM) $%
.S.o:
$(COMPILE.s) -o $@ $<
$(POST_PROCESS_S_O)
.S.a:
$(COMPILE.s) -o $% $<
$(PROCESS_COMMENT) $%
$(AR) $(ARFLAGS) $@ $%
$(RM) $%
.cc:
$(LINK.cc) -o $@ $< $(LDLIBS)
$(POST_PROCESS)
.cc.o:
$(COMPILE.cc) $(OUTPUT_OPTION) $<
$(POST_PROCESS_CC_O)
.cc.a:
$(COMPILE.cc) -o $% $<
$(AR) $(ARFLAGS) $@ $%
$(PROCESS_COMMENT) $%
$(RM) $%
.y:
$(YACC.y) $<
$(LINK.c) -o $@ y.tab.c $(LDLIBS)
$(POST_PROCESS)
$(RM) y.tab.c
.y.o:
$(YACC.y) $<
$(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
$(POST_PROCESS_O)
$(RM) y.tab.c
.l:
$(RM) $*.c
$(LEX.l) $< > $*.c
$(LINK.c) -o $@ $*.c -ll $(LDLIBS)
$(POST_PROCESS)
$(RM) $*.c
.l.o:
$(RM) $*.c
$(LEX.l) $< > $*.c
$(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
$(POST_PROCESS_O)
$(RM) $*.c
.bin.o:
$(COMPILE.b) -o $@ $<
$(POST_PROCESS_O)
.java.class:
$(COMPILE.java) $<
# Bourne and Korn shell script message catalog build rules.
# We extract all gettext strings with sed(1) (being careful to permit
# multiple gettext strings on the same line), weed out the dups, and
# build the catalogue with awk(1).
.sh.po .ksh.po:
$(SED) -n -e ":a" \
-e "h" \
-e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p" \
-e "x" \
-e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/" \
-e "t a" \
$< | sort -u | $(AWK) '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
#
# Python and Perl executable and message catalog build rules.
#
.SUFFIXES: .pl .pm .py .pyc
.pl:
$(RM) $@;
$(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
$(CHMOD) +x $@
.py:
$(RM) $@; $(SED) \
-e "1s:^\#!@PYTHON@:\#!$(PYSHEBANG):" \
-e "1s:^\#!@TOOLS_PYTHON@:\#!$(TOOLS_PYTHON):" \
< $< > $@; $(CHMOD) +x $@
.py.po:
$(GNUXGETTEXT) $(GNUXGETFLAGS) -d $(<F:%.py=%) $< ;
.pl.po .pm.po:
$(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
$(RM) $@ ;
$(SED) "/^domain/d" < $(<F).po > $@ ;
$(RM) $(<F).po
#
# When using xgettext, we want messages to go to the default domain,
# rather than the specified one. This special version of the
# COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
# causing xgettext to put all messages into the default domain.
#
CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
# Hammerhead: C++ version for .cc files - avoids -std=gnu89 warning
CPPFORPOCC=$(COMPILE.ccpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
.c.i:
$(CPPFORPO) $< > $@
.h.i:
$(CPPFORPO) $< > $@
.y.i:
$(YACC) -d $<
$(CPPFORPO) y.tab.c > $@
$(RM) y.tab.c
.l.i:
$(LEX) $<
$(CPPFORPO) lex.yy.c > $@
$(RM) lex.yy.c
.c.po:
$(CPPFORPO) $< > $<.i
$(BUILD.po)
.cc.po:
$(CPPFORPOCC) $< > $<.i
$(BUILD.po)
.y.po:
$(YACC) -d $<
$(CPPFORPO) y.tab.c > $<.i
$(BUILD.po)
$(RM) y.tab.c
.l.po:
$(LEX) $<
$(CPPFORPO) lex.yy.c > $<.i
$(BUILD.po)
$(RM) lex.yy.c
#
# Rules to perform stylistic checks
#
.SUFFIXES: .x .xml .check .xmlchk
.h.check:
$(DOT_H_CHECK)
.x.check:
$(DOT_X_CHECK)
.xml.xmlchk:
$(MANIFEST_CHECK)
endif # _MAKEFILE_MASTER
|