/
shared-macros.mk
1511 lines (1252 loc) · 52.4 KB
/
shared-macros.mk
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
#
# 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) 2010, 2024, Oracle and/or its affiliates.
#
.PHONY: void
void:
@echo "Must specify target: prep, build, install, publish, test, etc."
@echo "See $(WS_TOP)/doc/makefile-targets.txt for more info."
PATH=/usr/bin:/usr/gnu/bin
DEFAULT_CONFIG_FILE ?= /etc/userland
# $(1) - variable name
# $(2) - default value
# Produces 'VARIABLE?=default'
#
# Read configuration from DEFAULT_CONFIG_FILE providing default when the config
# file is not found. Config file has the variables prefixed by DEFAULT_ so if
# you want to configure CANONICAL_REPO the line in DEFAULT_CONFIG_FILE should
# be:
# DEFAULT_CANONICAL_REPO=http://.....
define read-config
$(eval $(1)?=$(shell bash -c '[ -r "$(DEFAULT_CONFIG_FILE)" ] && . "$(DEFAULT_CONFIG_FILE)"; echo $${DEFAULT_$(1):-$(2)}'))
endef
# The location of an internal mirror of community source archives that we build
# in this gate. This mirror has been seeded to include "custom" source archives
# for a few components where the communities either no longer provide matching
# source archives or we have changes that aren't reflected in their archives or
# anywhere else.
$(call read-config,INTERNAL_ARCHIVE_MIRROR,http://userland.us.oracle.com/source-archives)
# The location of an external mirror of community source archives that we build
# in this gate. The external mirror is a replica of the internal mirror.
EXTERNAL_ARCHIVE_MIRROR =
# Default to looking for source archives on the internal mirror and the external
# mirror before we hammer on the community source archive repositories.
export DOWNLOAD_SEARCH_PATH += $(INTERNAL_ARCHIVE_MIRROR)
ifneq ($(strip $(EXTERNAL_ARCHIVE_MIRROR)),)
export DOWNLOAD_SEARCH_PATH += $(EXTERNAL_ARCHIVE_MIRROR)
endif
# The workspace starts at the parent of the make-rules directory,
# unless someone already supplied the top.
ifeq ($(origin WS_TOP), undefined)
export WS_TOP := $(realpath $(dir $(realpath $(dir $(filter \
%/make-rules/shared-macros.mk,$(MAKEFILE_LIST))))))
endif
WS_MACH = $(WS_TOP)/$(MACH)
WS_LOGS = $(WS_MACH)/logs
WS_HOME = $(WS_MACH)/home
WS_REPO = $(WS_MACH)/repo
WS_EXPERIMENTAL_REPO = $(WS_MACH)/repo.experimental
WS_TOOLS = $(WS_TOP)/tools
WS_MAKE_RULES = $(WS_TOP)/make-rules
WS_COMPONENTS = $(WS_TOP)/components
WS_LICENSES = $(WS_TOP)/licenses
WS_INCORPORATIONS = $(WS_TOP)/incorporations
WS_LINT_CACHE = $(WS_MACH)/pkglint-cache
# we want our pkg piplines to fail if there is an error
# (like if pkgdepend fails in the middle of a pipe), but
# we don't want the builds or ./configure's failing as well.
# so we only set pipefail for the publish target and have
# to reset it for the others since they might be invoked
# as dependencies of publish.
export SHELLOPTS
build: SHELLOPTS=
test: SHELLOPTS=
install: SHELLOPTS=
publish: SHELLOPTS=pipefail
# This can be overridden to avoid rebuilding when you touch a Makefile
MAKEFILE_PREREQ = Makefile
# some things don't build properly in non-C locales,
# so lets stay there
export LC_ALL=C
# Some things look for files under $HOME, such as git looking for ~/.gitconfig
# which can have unexpected results. Use our minimal $HOME instead.
export HOME=$(WS_HOME)
SHELL= /bin/bash
ID= /usr/bin/id
# We want "nightly" as our publisher, to match other consolidations and
# facilitate migrations. G11N wants $(CONSOLIDATION)-localizable for the
# localizable publisher.
CONSOLIDATION ?= userland
PUBLISHER ?= nightly
PUBLISHER_LOCALIZABLE ?= $(CONSOLIDATION)-localizable
# Defines $(space) as a single blank space, so we can use it to convert
# space-separated paths to colon-separated paths in variables with
# $(subst $(space),:,$(strip $(SPATHS)))
empty :=
quot := "
bkslash := \$(empty)
space := $(empty) $(empty)
define newline
endef
# Change \ -> \\
define prepare_env_args_slash
$(subst $(bkslash),$(bkslash)$(bkslash),$(1))
endef
# Change $ -> \$
define prepare_env_args_dollar
$(subst $$,$(bkslash)$$,$(call prepare_env_args_slash,$(1)))
endef
# Change " -> \"
define prepare_env_args_quote
$(subst $(quot),$(bkslash)$(quot),$(call prepare_env_args_dollar,$(1)))
endef
# Change \n -> "$'\n'"
define prepare_env_args_newline
$(subst $(newline),$(quot)$$'$(bkslash)n'$(quot),$(call prepare_env_args_quote,$(1)))
endef
# Modify all the arguments to a form directly passable to the env(1) command.
# The arguments are encapsulated in double quotes and several characters are
# replaced as follows:
# \ -> \\
# " -> \"
# $ -> \$
# <newline> -> "$'\n'"
#
# It is intended to be used as
# env $(call prepare_env_args,VAR1 VAR2) process
# and process will get VAR1 and VAR2 in it's environment.
define prepare_env_args
$(foreach env,$(1),"$(env)=$(call prepare_env_args_newline,$($(env)))")
endef
PUBLISH_LOG = $(BUILD_DIR)/packages.$(MACH).log
define log-package-publish
$(CAT) $(1) $(WS_TOP)/transforms/print-published-pkgs | \
$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
sed -e '/^$$/d' -e '/^#.*$$/d' >> $(PUBLISH_LOG)
endef
ROOT = /
# The changset and external source repo used in building the packages.
CONSOLIDATION_CHANGESET= \
$(shell hg --config ui.report_untrusted=False identify -i)
CONSOLIDATION_REPOSITORY_URL=https://github.com/oracle/solaris-userland.git
# Native OS version
OS_RELEASE := $(shell uname -r)
SOLARIS_VERSION = $(OS_RELEASE:5.%=2.%)
OS_SUB_VERS_1 := $(shell uname -v)
OS_SUB_VERS_2 = $(subst ., ,$(OS_SUB_VERS_1))
OS_SUB_VERS_MINOR = $(word 1, $(OS_SUB_VERS_2))
OS_SUB_VERS_MICRO = $(word 2, $(OS_SUB_VERS_2))
OS_VERSION ?= $(OS_SUB_VERS_MINOR).$(OS_SUB_VERS_MICRO)
# Define limiting variables. These allow you to write single makefile or p5m
# manifest which can be used on multiple solaris releases even though their
# contents differs
ifeq ($(OS_VERSION),11.5)
SOLARIS_11_3_ONLY =\#
SOLARIS_11_4_ONLY =\#
SOLARIS_11_5_ONLY =
SOLARIS_11_3_4_ONLY =\#
SOLARIS_11_4_5_ONLY =
endif
ifeq ($(OS_VERSION),11.4)
SOLARIS_11_3_ONLY =\#
SOLARIS_11_4_ONLY =
SOLARIS_11_5_ONLY =\#
SOLARIS_11_3_4_ONLY =
SOLARIS_11_4_5_ONLY =
endif
ifeq ($(OS_VERSION),11.3)
SOLARIS_11_3_ONLY =
SOLARIS_11_4_ONLY =\#
SOLARIS_11_5_ONLY =\#
SOLARIS_11_3_4_ONLY =
SOLARIS_11_4_5_ONLY =\#
endif
ifeq ($(strip $(SOLARIS_11_3_ONLY)$(SOLARIS_11_4_ONLY)$(SOLARIS_11_5_ONLY)),)
$(error Unknown OS version "$(OS_VERSION)"; set OS_VERSION to "11.3" or "11.4" or "11.5")
endif
include $(WS_MAKE_RULES)/ips-buildinfo.mk
COMPILER ?= studio
# The values of BITS changes during the build process for components that
# are built 32-bit and 64-bit. This macro makes it possible to determine
# which components are only built 64-bit and allow other make-rules files
# to adjust accordingly. Possible values are: '32', '64', '32_and_64',
# '64_and_32', and 'NO_ARCH' (the orderings specify build preference).
BUILD_BITS ?=$(BITS)
ifeq ($(strip $(BUILD_BITS)),64)
BITS ?= 64
else
BITS ?= 32
endif
# Based on BUILD_BITS, determine which binaries are preferred for a build.
# This macro is for the convenience of other make-rules files and should not be
# overridden by developers.
ifeq ($(strip $(BUILD_BITS)),64)
PREFERRED_BITS=64
endif
ifeq ($(strip $(BUILD_BITS)),64_and_32)
PREFERRED_BITS=64
endif
PREFERRED_BITS ?= 32
# Map target build to macro/variable naming conventions. This macro is for the
# convenience of other make-rules files and should not be overridden by
# developers.
ifeq ($(BUILD_BITS),64_and_32)
MK_BITS=32_and_64
else
MK_BITS=$(strip $(BUILD_BITS))
endif
# Do not assume a default build style for compatibility with older component
# Makefiles. If explicitly set, common.mk will automatically include relevant
# make-rules files. Possible values are: 'ant', 'archive', 'attpackagemake',
# 'cmake', 'configure', 'gnu-component', 'justmake', 'pkg', and 'setup.py'. See
# corresponding file in make-rules for details.
# BUILD_STYLE=
# The default version should go last.
PYTHON_VERSION = 3.9
PYTHON_VERSIONS = 3.9 3.11
# Convenience variable for builds without Python 3.9 and 3.11
WITHOUT_PYTHON3.11 = 3.9
# PYTHON3_SOABI variable defines the naming scheme
# of python3 extension libraries: cpython or abi3.
# Currently, most of the components use cpython naming scheme by default,
# only python/xattr and python/cryptography require abi3 naming.
PYTHON3_SOABI ?= cpython
ifeq ($(PYTHON3_SOABI),cpython)
PY3_CPYTHON_NAMING=
PY3_ABI3_NAMING=\#
else ifeq ($(PYTHON3_SOABI),abi3)
PY3_CPYTHON_NAMING=\#
PY3_ABI3_NAMING=
else
$(error "Invalid python naming scheme '$(PYTHON3_SOABI)' selected!")
endif
USERLAND_COMPONENTS = $(WS_TOOLS)/userland-components
MANIFEST_GENERATE = $(WS_TOOLS)/manifest-generate
MANIFEST_COMPARE = $(WS_TOOLS)/manifest-check
CLONEY = $(WS_TOOLS)/cloney
CONFIG_SHELL = /bin/bash
PKG_REPO = file:$(WS_REPO)
PKG_EXPERIMENTAL_REPO = file:$(WS_EXPERIMENTAL_REPO)
COMPONENT_SRC_NAME = $(COMPONENT_NAME)
# Assume a component is categorized as a utility by default.
COMPONENT_BUGDB= utility/$(COMPONENT_NAME)
COMPONENT_DIR := $(shell pwd)
SOURCE_DIR = $(COMPONENT_DIR)/$(COMPONENT_SRC)
BUILD_DIR = $(COMPONENT_DIR)/build
PROTO_DIR = $(BUILD_DIR)/prototype/$(MACH)
ETCDIR = /etc
USRDIR = /usr
USRGNUDIR = $(USRDIR)/gnu
BINDIR = /bin
SBINDIR = /sbin
LIBDIR = /lib
VARDIR = /var
USRBINDIR = $(USRDIR)/bin
USRBINDIR64 = $(USRDIR)/bin/$(MACH64)
USRSBINDIR = $(USRDIR)/sbin
USRLIBDIR = $(USRDIR)/lib
USRSHAREDIR = $(USRDIR)/share
USRINCDIR = $(USRDIR)/include
USRSHARELOCALEDIR = $(USRSHAREDIR)/locale
USRSHAREMANDIR = $(USRSHAREDIR)/man
USRSHAREDOCDIR = $(USRSHAREDIR)/doc
USRSHAREFONTSDIR = $(USRSHAREDIR)/fonts
USRSHARETTFONTSDIR = $(USRSHAREFONTSDIR)/TrueType
USRSHARELIBDIR = $(USRSHAREDIR)/lib
USRSHAREMAN1DIR = $(USRSHAREMANDIR)/man1
USRSHAREMAN1MDIR = $(USRSHAREMANDIR)/man1m
USRSHAREMAN3DIR = $(USRSHAREMANDIR)/man3
USRSHAREMAN4DIR = $(USRSHAREMANDIR)/man4
USRSHAREMAN5DIR = $(USRSHAREMANDIR)/man5
USRSHAREMAN8DIR = $(USRSHAREMANDIR)/man8
USRLIBDIR64 = $(USRDIR)/lib/$(MACH64)
PROTOBINDIR = $(PROTO_DIR)$(BINDIR)
PROTOETCDIR = $(PROTO_DIR)$(ETCDIR)
PROTOETCSECDIR = $(PROTO_DIR)$(ETCDIR)/security
PROTOUSRDIR = $(PROTO_DIR)$(USRDIR)
PROTOLIBDIR = $(PROTO_DIR)$(LIBDIR)
PROTOSVCMANIFESTDIR = $(PROTOLIBDIR)/svc/manifest
PROTOSVCMETHODDIR = $(PROTOLIBDIR)/svc/method
PROTOUSRBINDIR = $(PROTO_DIR)$(USRBINDIR)
PROTOUSRBINDIR64 = $(PROTO_DIR)$(USRBINDIR64)
PROTOUSRSBINDIR = $(PROTO_DIR)$(USRSBINDIR)
PROTOUSRLIBDIR = $(PROTO_DIR)$(USRLIBDIR)
PROTOUSRLIBDIR64 = $(PROTO_DIR)$(USRLIBDIR64)
PROTOPKGCONFIGDIR = $(PROTOUSRLIBDIR)/pkgconfig
PROTOPKGCONFIGDIR64 = $(PROTOUSRLIBDIR64)/pkgconfig
PROTOUSRINCDIR = $(PROTO_DIR)$(USRINCDIR)
PROTOUSRSHAREDIR = $(PROTO_DIR)$(USRSHAREDIR)
PROTOUSRSHARELIBDIR = $(PROTO_DIR)$(USRSHARELIBDIR)
PROTOUSRSHAREDOCDIR = $(PROTO_DIR)$(USRSHAREDOCDIR)
PROTOUSRSHAREINFODIR = $(PROTOUSRSHAREDIR)/info
PROTOUSRSHAREMANDIR = $(PROTO_DIR)$(USRSHAREMANDIR)
PROTOUSRSHAREMAN1DIR = $(PROTO_DIR)$(USRSHAREMAN1DIR)
PROTOUSRSHAREMAN1MDIR = $(PROTO_DIR)$(USRSHAREMAN1MDIR)
PROTOUSRSHAREMAN3DIR = $(PROTO_DIR)$(USRSHAREMAN3DIR)
PROTOUSRSHAREMAN4DIR = $(PROTO_DIR)$(USRSHAREMAN4DIR)
PROTOUSRSHAREMAN5DIR = $(PROTO_DIR)$(USRSHAREMAN5DIR)
PROTOUSRSHAREMAN8DIR = $(PROTO_DIR)$(USRSHAREMAN8DIR)
PROTOUSRSHARELOCALEDIR = $(PROTO_DIR)$(USRSHARELOCALEDIR)
GNUBIN = $(USRGNUDIR)/bin
GNULIB = $(USRGNUDIR)/lib
GNULIB64 = $(USRGNUDIR)/lib/$(MACH64)
GNUSHARE = $(USRGNUDIR)/share
GNUSHAREMAN = $(USRGNUDIR)/share/man
GNUSHAREMAN1 = $(USRGNUDIR)/share/man/man1
PROTOGNUBIN = $(PROTO_DIR)$(GNUBIN)
PROTOGNUSHARE = $(PROTO_DIR)$(GNUSHARE)
PROTOGNUSHAREMAN = $(PROTO_DIR)$(GNUSHAREMAN)
PROTOGNUSHAREMAN1 = $(PROTO_DIR)$(GNUSHAREMAN1)
# work around _TIME, _DATE, embedded date chatter in component builds
# to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
# to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
CONSTANT_TIME = LD_PRELOAD_32=$(WS_TOOLS)/time-$(MACH32).so
CONSTANT_TIME += LD_PRELOAD_64=$(WS_TOOLS)/time-$(MACH64).so
CONSTANT_TIME += TIME_CONSTANT=$(TIME_CONSTANT)
# set MACH from uname -p to either sparc or i386
MACH := $(shell uname -p)
# Override this to limit builds and publication to a single architecture.
BUILD_ARCH ?= $(MACH)
# set MACH32 from MACH to either sparcv7 or i86
MACH32_1 = $(MACH:sparc=sparcv7)
MACH32 = $(MACH32_1:i386=i86)
# set MACH64 from MACH to either sparcv9 or amd64
MACH64_1 = $(MACH:sparc=sparcv9)
MACH64 = $(MACH64_1:i386=amd64)
CONFIGURE_NO_ARCH = $(BUILD_DIR_NO_ARCH)/.configured
CONFIGURE_32 = $(BUILD_DIR_32)/.configured
CONFIGURE_64 = $(BUILD_DIR_64)/.configured
CONFIGURE_32_and_64 = $(CONFIGURE_32) $(CONFIGURE_64)
BUILD_DIR_NO_ARCH = $(BUILD_DIR)/$(MACH)
BUILD_DIR_32 = $(BUILD_DIR)/$(MACH32)
BUILD_DIR_64 = $(BUILD_DIR)/$(MACH64)
BUILD_NO_ARCH = $(BUILD_DIR_NO_ARCH)/.built
BUILD_32 = $(BUILD_DIR_32)/.built
BUILD_64 = $(BUILD_DIR_64)/.built
BUILD_32_and_64 = $(BUILD_32) $(BUILD_64)
# NO_ARCH uses BITS=32 because some path setting macros use $(BITS)
$(BUILD_DIR_NO_ARCH)/.built: BITS=32
$(BUILD_DIR_32)/.built: BITS=32
$(BUILD_DIR_64)/.built: BITS=64
# COMPONENT_MAKE_JOBS contains the maximal number of build
# jobs per component. The default value is equal to the
# number of physical cores. The maximal system load is
# limited by the number of virtual processors.
ifneq ($(wildcard /usr/sbin/psrinfo),)
PSRINFO=/usr/sbin/psrinfo
COMPONENT_MAKE_JOBS ?= $(shell $(PSRINFO) -t | grep -c core)
SYSTEM_MAX_LOAD := $(shell $(PSRINFO) | wc -l)
# If the number of physical cores cannot be determined from
# 'psrinfo -t' output, we use the number of virtual processors
# (hardware threads) as a workaround.
ifeq ($(COMPONENT_MAKE_JOBS),0)
COMPONENT_MAKE_JOBS := $(SYSTEM_MAX_LOAD)
endif
endif
# If the memory is almost exhausted, then refuse to execute parallel build jobs.
ifneq ($(wildcard /usr/bin/kstat2),)
ifneq ($(wildcard /usr/bin/pagesize),)
KSTAT2 := /usr/bin/kstat2
PAGE_SIZE := $(shell /usr/bin/pagesize)
TOTAL_MEMORY_PAGES := $(shell $(KSTAT2) -p kstat:/vm/usage/memory:mem_total | cut -f 2)
FREE_MEMORY_PAGES := $(shell $(KSTAT2) -p kstat:/pages/unix/system_pages:freemem | cut -f 2)
ZFS_MEMORY_PAGES := $(shell $(KSTAT2) -p kstat:/vm/usage/memory:mem_zfs | cut -f 2)
AVAILABLE_MEMORY_PAGES := $(shell echo $$(($(FREE_MEMORY_PAGES)+$(ZFS_MEMORY_PAGES))))
AVAILABLE_MEMORY_PERCENTAGE := $(shell echo $$((100*$(AVAILABLE_MEMORY_PAGES)/$(TOTAL_MEMORY_PAGES))))
# If there is less than 20 % of available memory, then we set COMPONENT_MAKE_JOBS to 1.
ifeq ($(shell expr $(AVAILABLE_MEMORY_PERCENTAGE) \<= 20),1)
COMPONENT_MAKE_JOBS := 1
endif
endif
endif
# If the number of jobs is greater than 1, then we need to set
# GNU make parameters. If GMAKE variable is used for other
# command (e.g., build.sh), COMPONENT_MAKE_JOBS must be empty or set to 1.
ifneq ($(filter-out 1,$(COMPONENT_MAKE_JOBS)),)
ifeq ($(SYSTEM_MAX_LOAD),)
SYSTEM_MAX_LOAD := $(COMPONENT_MAKE_JOBS)
endif
COMPONENT_BUILD_ARGS += -j $(COMPONENT_MAKE_JOBS) -l $(SYSTEM_MAX_LOAD)
endif
INSTALL_NO_ARCH = $(BUILD_DIR_NO_ARCH)/.installed
INSTALL_32 = $(BUILD_DIR_32)/.installed
INSTALL_64 = $(BUILD_DIR_64)/.installed
INSTALL_32_and_64 = $(INSTALL_32) $(INSTALL_64)
$(BUILD_DIR_NO_ARCH)/.installed: BITS=32
$(BUILD_DIR_32)/.installed: BITS=32
$(BUILD_DIR_64)/.installed: BITS=64
# set the default target for installation of the component
COMPONENT_INSTALL_TARGETS = install
# set the default build test results directory
COMPONENT_TEST_BUILD_DIR = $(BUILD_DIR)/test/$(MACH$(BITS))
# set the default master test results directory
COMPONENT_TEST_RESULTS_DIR = $(COMPONENT_DIR)/test
COMPONENT_SYSTEM_TEST_RESULTS_DIR = $(COMPONENT_DIR)/test
# set the default master test results file
COMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-$(BITS).master
# set the default test results output file
COMPONENT_TEST_OUTPUT = $(COMPONENT_TEST_BUILD_DIR)/test-$(BITS)-results
# set the default test results comparison diffs file
COMPONENT_TEST_DIFFS = $(COMPONENT_TEST_BUILD_DIR)/test-$(BITS)-diffs
# set the default test snapshot file
COMPONENT_TEST_SNAPSHOT = $(COMPONENT_TEST_BUILD_DIR)/results-$(BITS).snapshot
# Normally $(GSED) is simplest, but some results files need more power.
COMPONENT_TEST_TRANSFORMER = $(GSED)
# The set of default transforms to be applied to the test results to try
# to normalize them.
COMPONENT_TEST_TRANSFORMS = \
'-e "s|$(@D)|\\$$(@D)|g" ' \
'-e "s|$(PERL)|\\$$(PERL)|g" ' \
'-e "s|$(SOURCE_DIR)|\\$$(SOURCE_DIR)|g" ' \
'-e "/^gmake: warning: jobserver unavailable:/d" ' \
'-e "/^make\[.* jobserver unavailable:/d" ' \
'-e "/^make: Warning: Ignoring DistributedMake -j option/d" '
# set the default commands used to generate the file containing the set
# of transforms to be applied to the test results to try to normalize them.
COMPONENT_TEST_CREATE_TRANSFORMS = \
@if [ -e $(COMPONENT_TEST_MASTER) ]; \
then \
print "\#!/bin/sh" > $(COMPONENT_TEST_TRANSFORM_CMD); \
print '$(COMPONENT_TEST_TRANSFORMER) ' \
$(COMPONENT_TEST_TRANSFORMS) \
' \\' >> $(COMPONENT_TEST_TRANSFORM_CMD); \
print '$(COMPONENT_TEST_OUTPUT) \\' \
>> $(COMPONENT_TEST_TRANSFORM_CMD); \
print '> $(COMPONENT_TEST_SNAPSHOT)' \
>> $(COMPONENT_TEST_TRANSFORM_CMD); \
else \
print 'Cannot find $(COMPONENT_TEST_MASTER)'; \
exit 2; \
fi
# set the default command for performing any test result munging
COMPONENT_TEST_TRANSFORM_CMD = $(COMPONENT_TEST_BUILD_DIR)/transform-$(BITS)-results
# set the default operation to run to perform test result normalization
COMPONENT_TEST_PERFORM_TRANSFORM = \
@if [ -e $(COMPONENT_TEST_MASTER) ]; \
then \
$(SHELL) $(COMPONENT_TEST_TRANSFORM_CMD); \
else \
print 'Cannot find $(COMPONENT_TEST_MASTER)'; \
exit 2; \
fi
# set the default command used to compare the master results with the snapshot
COMPONENT_TEST_COMPARE_CMD = $(GDIFF) -uN
# set the default way that master and snapshot test results are compared
COMPONENT_TEST_COMPARE = \
@if [ -e $(COMPONENT_TEST_MASTER) ]; \
then \
$(COMPONENT_TEST_COMPARE_CMD) \
$(COMPONENT_TEST_MASTER) $(COMPONENT_TEST_SNAPSHOT) \
> $(COMPONENT_TEST_DIFFS); \
print "Test results in $(COMPONENT_TEST_OUTPUT)"; \
if [ -s $(COMPONENT_TEST_DIFFS) ]; \
then \
print "Differences found."; \
$(CAT) $(COMPONENT_TEST_DIFFS); \
exit 2; \
else \
print "No differences found."; \
fi \
else \
print 'Cannot find $(COMPONENT_TEST_MASTER)'; \
exit 2; \
fi
# set the default env command to use for test of the component
COMPONENT_TEST_ENV_CMD = $(ENV)
COMPONENT_SYSTEM_TEST_ENV_CMD = $(ENV)
# set the default command to use for test of the component
COMPONENT_TEST_CMD = $(GMAKE)
COMPONENT_SYSTEM_TEST_CMD = $(GMAKE)
# set the default target for test of the component
COMPONENT_TEST_TARGETS = check
COMPONENT_SYSTEM_TEST_TARGETS = check
# set the default directory for test of the component
COMPONENT_TEST_DIR = $(@D)
COMPONENT_SYSTEM_TEST_DIR = $(@D)
#
# For tests requiring privilege, check if we can elevate privilege without
# prompting. If we can't, tell the user what to do and fail.
#
COMPONENT_PRE_TEST_SUDO = \
@$(SUDO) -n /bin/true 2>/dev/null || ( \
echo "Test run requires privilege." >&2; \
echo "Run '$(SUDO) /bin/true' and then re-run tests" >&2; \
exit 1 )
# determine the type of tests we want to run.
ifeq ($(strip $(wildcard $(COMPONENT_SYSTEM_TEST_RESULTS_DIR)/results-*.master)),)
SYSTEM_TEST_NO_ARCH = $(BUILD_DIR_NO_ARCH)/.system-tested
SYSTEM_TEST_32 = $(BUILD_DIR_32)/.system-tested
SYSTEM_TEST_64 = $(BUILD_DIR_64)/.system-tested
else
SYSTEM_TEST_NO_ARCH = $(BUILD_DIR_NO_ARCH)/.system-tested-and-compared
SYSTEM_TEST_32 = $(BUILD_DIR_32)/.system-tested-and-compared
SYSTEM_TEST_64 = $(BUILD_DIR_64)/.system-tested-and-compared
endif
SYSTEM_TEST_32_and_64 = $(SYSTEM_TEST_32) $(SYSTEM_TEST_64)
ifeq ($(strip $(wildcard $(COMPONENT_TEST_RESULTS_DIR)/results-*.master)),)
TEST_NO_ARCH ?= $(BUILD_DIR_NO_ARCH)/.tested
TEST_32 ?= $(BUILD_DIR_32)/.tested
TEST_64 ?= $(BUILD_DIR_64)/.tested
else
TEST_NO_ARCH ?= $(BUILD_DIR_NO_ARCH)/.tested-and-compared
TEST_32 ?= $(BUILD_DIR_32)/.tested-and-compared
TEST_64 ?= $(BUILD_DIR_64)/.tested-and-compared
endif
TEST_32_and_64 ?= $(TEST_32) $(TEST_64)
# When running tests at the top level, skip those tests,
# by redefining the above TEST_* targets,
# when a component Makefile includes $(SKIP_TEST_AT_TOP_LEVEL).
define SKIP_TEST_AT_TOP_LEVEL_HELPER
ifeq ($$(TOP_LEVEL_TEST),yes)
TEST_32 = $$(SKIP_TEST)
TEST_64 = $$(SKIP_TEST)
TEST_32_and_64 = $$(SKIP_TEST)
TEST_NO_ARCH = $$(SKIP_TEST)
TEST_TARGET = $$(NO_TESTS)
endif
endef
define SKIP_TEST_AT_TOP_LEVEL
$(eval $(call SKIP_TEST_AT_TOP_LEVEL_HELPER))
endef
$(BUILD_DIR_NO_ARCH)/.system-tested: BITS=32
$(BUILD_DIR_32)/.system-tested: BITS=32
$(BUILD_DIR_64)/.system-tested: BITS=64
$(BUILD_DIR_NO_ARCH)/.system-tested-and-compared: BITS=32
$(BUILD_DIR_32)/.system-tested-and-compared: BITS=32
$(BUILD_DIR_64)/.system-tested-and-compared: BITS=64
$(BUILD_DIR_NO_ARCH)/.tested: BITS=32
$(BUILD_DIR_32)/.tested: BITS=32
$(BUILD_DIR_64)/.tested: BITS=64
$(BUILD_DIR_NO_ARCH)/.tested-and-compared: BITS=32
$(BUILD_DIR_32)/.tested-and-compared: BITS=32
$(BUILD_DIR_64)/.tested-and-compared: BITS=64
$(BUILD_DIR_NO_ARCH)/.system-tested: $(BUILD_DIR_32)
$(BUILD_DIR_32)/.system-tested: $(BUILD_DIR_32)
$(BUILD_DIR_64)/.system-tested: $(BUILD_DIR_64)
$(BUILD_DIR_NO_ARCH)/.system-tested-and-compared: $(BUILD_DIR_32)
$(BUILD_DIR_32)/.system-tested-and-compared: $(BUILD_DIR_32)
$(BUILD_DIR_64)/.system-tested-and-compared: $(BUILD_DIR_64)
$(BUILD_DIR_32) $(BUILD_DIR_64):
$(MKDIR) $(@)
# BUILD_TOOLS is the root of all tools not normally installed on the system.
BUILD_TOOLS ?= /opt
SPRO_ROOT ?= $(BUILD_TOOLS)
SPRO_VROOT ?= $(SPRO_ROOT)/developerstudio12.6
PARFAIT_VER ?= parfait-tools-4.0
PARFAIT_ROOT = $(BUILD_TOOLS)/parfait
PARFAIT_VROOT= $(PARFAIT_ROOT)/$(PARFAIT_VER)
PARFAIT_TOOLS= $(WS_TOOLS)/$(MACH)/parfait
PARFAIT= $(PARFAIT_VROOT)/bin/parfait
export PARFAIT_NATIVESUNCC=$(SPRO_VROOT)/bin/cc
export PARFAIT_NATIVESUNCXX=$(SPRO_VROOT)/bin/CC
export PARFAIT_NATIVEGCC=$(GCC_ROOT)/bin/gcc
export PARFAIT_NATIVEGXX=$(GCC_ROOT)/bin/g++
ONBLD_ROOT ?= $(BUILD_TOOLS)/onbld
ONBLD_BIN ?= $(ONBLD_ROOT)/bin
GCC_ROOT ?= /usr/gcc/13
CC.studio.32 = $(SPRO_VROOT)/bin/cc
CXX.studio.32 = $(SPRO_VROOT)/bin/CC
CC.studio.64 = $(SPRO_VROOT)/bin/cc
CXX.studio.64 = $(SPRO_VROOT)/bin/CC
CC.gcc.32 = $(GCC_ROOT)/bin/gcc
CXX.gcc.32 = $(GCC_ROOT)/bin/g++
CC.gcc.64 = $(GCC_ROOT)/bin/gcc
CXX.gcc.64 = $(GCC_ROOT)/bin/g++
lint.32 = $(SPRO_VROOT)/bin/lint -m32
lint.64 = $(SPRO_VROOT)/bin/lint -m64
LINT = $(lint.$(BITS))
LD = /usr/bin/ld
ifeq ($(strip $(PARFAIT_BUILD)),yes)
CC.studio.32 = $(PARFAIT_TOOLS)/cc
CXX.studio.32 = $(PARFAIT_TOOLS)/CC
CC.studio.64 = $(PARFAIT_TOOLS)/cc
CXX.studio.64 = $(PARFAIT_TOOLS)/CC
CC.gcc.32 = $(PARFAIT_TOOLS)/gcc
CXX.gcc.32 = $(PARFAIT_TOOLS)/g++
CC.gcc.64 = $(PARFAIT_TOOLS)/gcc
CXX.gcc.64 = $(PARFAIT_TOOLS)/g++
LD = $(PARFAIT_TOOLS)/ld
endif
CC = $(CC.$(COMPILER).$(BITS))
CXX = $(CXX.$(COMPILER).$(BITS))
RUBY_VERSION = 3.1
RUBY_PUPPET_VERSION = 3.1
# The default version should go last.
RUBY_VERSIONS = 3.1
RUBY.3.1 = /usr/ruby/3.1/bin/ruby
RUBY = $(RUBY.$(RUBY_VERSION))
# Transform Ruby scripts to call the supported
# version-specific ruby; used in multiple *.mk files
RUBY_SCRIPT_FIX_FUNC = \
$(GNU_GREP) -Rl '^\#! */usr/bin/env ruby' | \
/usr/bin/xargs -I\{\} $(GSED) -i -e \
'1s%^\#! */usr/bin/env ruby%\#!/usr/ruby/$(RUBY_VERSION)/bin/ruby%' \
\{\}
PYTHON.3.9.VENDOR_PACKAGES.32 =
PYTHON.3.9.VENDOR_PACKAGES.64 = /usr/lib/python3.9/vendor-packages
PYTHON.3.9.VENDOR_PACKAGES = $(PYTHON.3.9.VENDOR_PACKAGES.64)
PYTHON.3.11.VENDOR_PACKAGES.32 =
PYTHON.3.11.VENDOR_PACKAGES.64 = /usr/lib/python3.11/vendor-packages
PYTHON.3.11.VENDOR_PACKAGES = $(PYTHON.3.11.VENDOR_PACKAGES.64)
# Base path to vendor packages shared between all Python versions
PYTHON_VENDOR_PACKAGES_BASE = /usr/lib/python$(PYTHON_VERSION)/vendor-packages
PYTHON_VENDOR_PACKAGES.32 = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES.32)
PYTHON_VENDOR_PACKAGES.64 = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES.64)
PYTHON_VENDOR_PACKAGES = $(PYTHON.$(PYTHON_VERSION).VENDOR_PACKAGES)
PYTHON.3.9.TEST = /usr/lib/python3.9/test
PYTHON.3.11.TEST = /usr/lib/python3.11/test
USRBIN.32 = /usr/bin
USRBIN.64 = /usr/bin/$(MACH64)
USRBIN = $(USRBIN.$(BITS))
USRLIB.32 = $(USRLIBDIR)
USRLIB.64 = $(USRLIBDIR64)
USRLIB = $(USRLIB.$(BITS))
# Although we build Python 3 64-bit only, the BUILD_NO_ARCH macro is written
# in such a way that we still need the .32 macro below. And since we build
# 64-bit only, we stick it directly in usr/bin (i.e., the 32-bit path) rather
# than the 64-bit path.
PYTHON.3.9.32 = $(USRBIN.32)/python3.9
PYTHON.3.9.64 = $(USRBIN.32)/python3.9
PYTHON.3.9 = $(USRBIN.32)/python3.9
PYTHON.3.11.32 = $(USRBIN.32)/python3.11
PYTHON.3.11.64 = $(USRBIN.32)/python3.11
PYTHON.3.11 = $(USRBIN.32)/python3.11
PYTHON.32 ?= $(PYTHON.$(PYTHON_VERSION).32)
PYTHON.64 ?= $(PYTHON.$(PYTHON_VERSION).64)
PYTHON ?= $(PYTHON.$(PYTHON_VERSION).$(BITS))
# The default is site-packages, but that directory belongs to the end-user.
# Modules which are shipped by the OS but not with the core Python distribution
# belong in vendor-packages.
PYTHON_LIB= /usr/lib/python$(PYTHON_VERSION)/vendor-packages
PYTHON_DATA= $(PYTHON_LIB)
# If the component has python scripts then the first line should probably
# point at the userland default build python so as not to be influenced
# by the ips python mediator.
# In the component's Makefile define PYTHON_SCRIPTS with a list of files
# to be edited.
# Edit the leading #!/usr/bin/python line in python scripts to use the
# BUILD's $(PYTHON). The source file must be recompiled after that, as
# the corresponding .pyc file is outdated now.
PYTHON_SCRIPT_SHEBANG_FIX_FUNC = \
$(GSED) -i \
-e '1s@/usr/bin/python$$@$(PYTHON)@' \
-e '1s@/usr/bin/python[23]$$@$(PYTHON)@' \
-e '1s@/usr/bin/python\ @$(PYTHON) @' \
-e '1s@/usr/bin/env\ $(PYTHON)@$(PYTHON)@' \
-e '1s@/usr/bin/env\ python[23]@$(PYTHON)@' \
-e '1s@/usr/bin/env\ python@$(PYTHON)@' $(1); \
$(PYTHON) -m compileall $(1);
# PYTHON_SCRIPTS is a list of files from the calling Makefile.
PYTHON_SCRIPTS_PROCESS= \
$(foreach s,$(PYTHON_SCRIPTS), \
$(call PYTHON_SCRIPT_SHEBANG_FIX_FUNC,$(s)))
# Finally if PYTHON_SCRIPTS is defined in a Makefile then process them here.
# If multiple installs in the component then clear
# COMPONENT_POST_INSTALL_ACTION =
# and re-add $(PYTHON_SCRIPTS_PROCESS)
COMPONENT_POST_INSTALL_ACTION += $(PYTHON_SCRIPTS_PROCESS)
JAVA8_HOME = /usr/jdk/instances/jdk1.8.0
JAVA_HOME = $(JAVA8_HOME)
# This is the default BUILD version of perl
# Not necessarily the system's default version, i.e. /usr/bin/perl
PERL_VERSION ?= 5.38
PERL_VERSION_NODOT = $(subst .,,$(PERL_VERSION))
# Used for versionless perl packages. Processed by ips.mk to stamp out
# multiple packages for each version of perl listed here. Used by
# perl_modules/* but also used for those components that deliver a perl
# package like graphviz and openscap.
PERL_VERSIONS = 5.36 5.38
PERL.5.36 = /usr/perl5/5.36/bin/perl
PERL.5.38 = /usr/perl5/5.38/bin/perl
define test-perl-availability
TEST_PERL_PATH=$$(PERL.$(1))
ifeq ($$(strip $$(TEST_PERL_PATH)),)
$$(error variable PERL.$(1) is not defined)
endif
endef
$(foreach p,$(PERL_VERSIONS),$(eval $(call test-perl-availability,$(p))))
# Use these in a component's Makefile for building and packaging with the
# BUILD's default perl and the package it comes from.
PERL = $(PERL.$(PERL_VERSION))
PERL_PKG = $(PERL_VERSION:5.%=runtime/perl-5%)
# PERL_ARCH is perl's architecture string. Use in ips manifests.
PERL_ARCH := $(shell $(PERL) -e 'use Config; print $$Config{archname}')
PERL_ARCH_FUNC= $(shell $(1) -e 'use Config; print $$Config{archname}')
PKG_MACROS += PERL_ARCH=$(PERL_ARCH)
PKG_MACROS += PERL_VERSION=$(PERL_VERSION)
# If the component has perl scripts then the first line should probably
# point at the userland default build perl so as not to be influenced
# by the ips perl mediator.
# In the component's Makefile define PERL_SCRIPTS with a list of files
# to be edited.
# Edit the leading #!/usr/bin/perl line in perl scripts to use the
# BUILD's $(PERL).
PERL_SCRIPT_SHEBANG_FIX_FUNC = \
$(GSED) -i \
-e '1s@/usr/bin/perl@$(PERL)@' \
-e '1s@/usr/perl5/bin/perl@$(PERL)@' \
-e '1s@/usr/bin/env\ perl@$(PERL)@' $(1);
# PERL_SCRIPTS is a list of files from the calling Makefile.
PERL_SCRIPTS_PROCESS= \
$(foreach s,$(PERL_SCRIPTS), \
$(call PERL_SCRIPT_SHEBANG_FIX_FUNC,$(s)))
# Finally if PERL_SCRIPTS is defined in a Makefile then process them here.
# If multiple installs in the component then clear
# COMPONENT_POST_INSTALL_ACTION =
# and re-add $(PERL_SCRIPTS_PROCESS)
COMPONENT_POST_INSTALL_ACTION += $(PERL_SCRIPTS_PROCESS)
# PHP stuff
PHP_TOP_DIR = $(WS_COMPONENTS)/php
# All versions of PHP for building extension packages.
PHP_VERSIONS = 8.1 8.2 8.3
PHP.8.1 = /usr/php/8.1/bin/php
PHP.8.2 = /usr/php/8.2/bin/php
PHP.8.3 = /usr/php/8.3/bin/php
# This is the default BUILD version of tcl
# Not necessarily the system's default version, i.e. /usr/bin/tclsh
TCL_VERSION = 8.6
TCLSH.8.6.i386.32 = /usr/bin/i86/tclsh8.6
TCLSH.8.6.i386.64 = /usr/bin/amd64/tclsh8.6
TCLSH.8.6.sparc.32 = /usr/bin/sparcv7/tclsh8.6
TCLSH.8.6.sparc.64 = /usr/bin/sparcv9/tclsh8.6
TCLSH = $(TCLSH.$(TCL_VERSION).$(MACH).$(BITS))
CCSMAKE = /usr/ccs/bin/make
DOXYGEN = /usr/bin/doxygen
ELFEDIT = /usr/bin/elfedit
GMAKE ?= /usr/gnu/bin/make
GPATCH = /usr/bin/patch
PATCH_LEVEL = 1
GPATCH_BACKUP = --backup --version-control=numbered
GPATCH_FLAGS = -p$(PATCH_LEVEL) $(GPATCH_BACKUP)
GSED = /usr/gnu/bin/sed
GDIFF = /usr/gnu/bin/diff
GSORT = /usr/gnu/bin/sort
GUNZIP = /usr/bin/gunzip
PKGREPO = /usr/bin/pkgrepo
PKGSEND = /usr/bin/pkgsend
PKGMOGRIFY = /usr/bin/pkgmogrify
PKGLINT = /usr/bin/pkglint
ifeq ($(strip $(PKGLINT_COMPONENT)),)
PKGLINTVAR = $(PKGLINT)
else
PKGLINTVAR = ${WS_TOOLS}/pkglint
endif
ACLOCAL = /usr/bin/aclocal-1.16
AUTOMAKE = /usr/bin/automake-1.16
AUTORECONF = /usr/bin/autoreconf
KSH93 = /usr/bin/ksh93
TOUCH = /usr/bin/touch
MKDIR = /bin/mkdir -p
RM = /bin/rm -f
CP = /bin/cp -f
MV = /bin/mv -f
LN = /bin/ln
CAT = /bin/cat
SYMLINK = /bin/ln -s
ENV = /usr/bin/env
FIND = /usr/bin/find
INSTALL = /usr/bin/ginstall
GNU_GREP = /usr/gnu/bin/grep
CHMOD = /usr/bin/chmod
NAWK = /usr/bin/nawk
TAR = /usr/bin/tar
GNU_TAR = /usr/gnu/bin/tar
TEE = /usr/bin/tee
ANT = /usr/bin/ant
LOCALEDEF = /usr/bin/localedef
INS.dir= $(INSTALL) -d $@
INS.file= $(INSTALL) -m 444 $< $(@D)
MKFONTDIR = /usr/bin/mkfontdir
MKFONTSCALE = /usr/bin/mkfontscale
UNZIP = /usr/bin/unzip
#
# To simplify adding directories to PKG_CONFIG_PATH, since += adds spaces, not :
# use PKG_CONFIG_PATHS += ... and the following will convert to the : form
#
PKG_CONFIG_PATH.32 = /usr/lib/pkgconfig
PKG_CONFIG_PATH.64 = /usr/lib/$(MACH64)/pkgconfig
PKG_CONFIG_DEFAULT = $(PKG_CONFIG_PATH.$(BITS))
PKG_CONFIG_PATH = $(subst $(space),:,$(strip \
$(PKG_CONFIG_PATHS) $(PKG_CONFIG_DEFAULT)))
LIBNSL=$(shell elfdump -d /usr/lib/libnsl.so.1 | $(NAWK) 'BEGIN {ret="-lnsl"} $$2 == "FILTER" && $$4 == "libc.so.1" {ret=""} END {print ret}')
LIBSOCKET=$(shell elfdump -d /usr/lib/libsocket.so.1 | $(NAWK) 'BEGIN {ret="-lsocket"} $$2 == "FILTER" && $$4 == "libc.so.1" {ret=""} END {print ret}')
LIBXNET=$(shell elfdump -d /usr/lib/libxnet.so.1 | $(NAWK) 'BEGIN {ret="-lxnet"} $$2 == "FILTER" && $$4 == "libc.so.1" {ret=""} END {print ret}')
#
# C preprocessor flag sets to ease feature selection. Add the required
# feature to your Makefile with CPPFLAGS += $(FEATURE_MACRO) and add to
# the component build with CONFIGURE_OPTIONS += CPPFLAGS="$(CPPFLAGS)" or
# similar.
#
# Enables visibility of some c99 math functions that aren't visible by default.
# What other side-effects are there?
CPP_C99_EXTENDED_MATH = -D_STDC_99
# Enables large file support for components that have no other means of doing
# so. Use CPP_LARGEFILES and not the .32/.64 variety directly
CPP_LARGEFILES.32 := $(shell getconf LFS_CFLAGS)
CPP_LARGEFILES.64 := $(shell getconf LFS64_CFLAGS)
CPP_LARGEFILES = $(CPP_LARGEFILES.$(BITS))
# Enables some #pragma redefine_extname to POSIX-compliant Standard C Library
# functions. Also avoids the component's #define _POSIX_C_SOURCE to some value
# we currently do not support.
CPP_POSIX = -D_POSIX_C_SOURCE=200112L -D_POSIX_PTHREAD_SEMANTICS
# XPG6 mode. This option enables XPG6 conformance, plus extensions.
# Amongst other things, this option will cause system calls like
# popen (3C) and system (3C) to invoke the standards-conforming
# shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh. Add studio_XPG6MODE to
# CFLAGS instead of using this directly
CPP_XPG6MODE= -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -D_XPG6
# XPG5 mode. These options are specific for C++, where _XPG6,
# _XOPEN_SOURCE=600 and C99 are illegal. -D__EXTENSIONS__=1 is legal in C++.
CPP_XPG5MODE= -D_XOPEN_SOURCE=500 -D__EXTENSIONS__=1 -D_XPG5
#
# Studio C compiler flag sets to ease feature selection. Add the required
# feature to your Makefile with CFLAGS += $(FEATURE_MACRO) and add to the
# component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similar.
#
# Generate 32/64 bit objects
CC_BITS = -m$(BITS)
# Code generation instruction set and optimization 'hints'. Use studio_XBITS
# and not the .arch.bits variety directly.
studio_XBITS.sparc.32 = -xtarget=generic -xarch=sparcvis -xchip=generic
studio_XBITS.sparc.64 =
ifneq ($(strip $(PARFAIT_BUILD)),yes)
studio_XBITS.sparc.64 += -xtarget=generic
endif
studio_XBITS.sparc.64 += -xarch=sparcvis -xchip=generic
studio_XBITS.i386.32 = -xchip=pentium
studio_XBITS.i386.64 = -xchip=generic -Ui386 -U__i386
studio_XBITS = $(studio_XBITS.$(MACH).$(BITS))