xref: /illumos-gate/usr/src/tools/Makefile.tools (revision d17be682)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
53420b242Ssommerfe# Common Development and Distribution License (the "License").
63420b242Ssommerfe# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2287ab3622SRichard Lowe# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
235ca82e69SJohn Levon# Copyright 2020 Joyent, Inc.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate# Definitions common to tool source.
267c478bd9Sstevel@tonic-gate#
277c478bd9Sstevel@tonic-gateinclude $(SRC)/Makefile.master
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gateFILEMODE=	0555
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gateTOOLS=			$(SRC)/tools
32ead1f93eSLiane PrazaTOOLS_PROTO=		$(TOOLS)/proto/root_$(MACH)-nd
332e02daeeSRainer OrthROOTOPT=		$(TOOLS_PROTO)/opt
342e02daeeSRainer OrthROOTONBLD=		$(ROOTOPT)/onbld
357c478bd9Sstevel@tonic-gateROOTONBLDBIN=		$(ROOTONBLD)/bin
367c478bd9Sstevel@tonic-gateROOTONBLDBINMACH=	$(ROOTONBLD)/bin/$(MACH)
377a15b0ecSRichard LoweROOTONBLDBINMACH64=	$(ROOTONBLD)/bin/$(MACH64)
3893af10a4SMark J. NelsonROOTONBLDETC=		$(ROOTONBLD)/etc
397c478bd9Sstevel@tonic-gateROOTONBLDLIB=		$(ROOTONBLD)/lib
407c478bd9Sstevel@tonic-gateROOTONBLDLIBMACH=	$(ROOTONBLD)/lib/$(MACH)
4110d63b7dSRichard LoweROOTONBLDLIBMACH64=	$(ROOTONBLD)/lib/$(MACH)/64
4275ce41a5SAli BahramiROOTONBLDLIBPERL=	$(ROOTONBLD)/lib/perl
43cdf0c1d5SmjnelsonROOTONBLDLIBPY=		$(ROOTONBLD)/lib/python
447c478bd9Sstevel@tonic-gateROOTONBLDENV=		$(ROOTONBLD)/env
457c478bd9Sstevel@tonic-gateROOTONBLDMAN=		$(ROOTONBLD)/man
466cad8c54SRyan ZezeskiROOTONBLDMAN1ONBLD=	$(ROOTONBLD)/man/man1onbld
477c478bd9Sstevel@tonic-gateROOTONBLDETCABI=	$(ROOTONBLD)/etc/abi
4875ce41a5SAli BahramiROOTONBLDETCEXCEPT=	$(ROOTONBLD)/etc/exception_lists
4910d63b7dSRichard LoweROOTONBLDSHARE=		$(ROOTONBLD)/share
507c478bd9Sstevel@tonic-gate
51cc20930cSToomas SoomeCC =			$(NATIVECC)
52cc20930cSToomas SoomeCCC =			$(NATIVECCC)
53cc20930cSToomas SoomeCFLAGS =		$(NATIVE_CFLAGS)
547c478bd9Sstevel@tonic-gateCPPFLAGS=		-D_TS_ERRNO
557c478bd9Sstevel@tonic-gateELFSIGN_O=		$(TRUE)
567c478bd9Sstevel@tonic-gateLDLIBS=
5785f4cb87SRichard LoweLDFLAGS=		$(MAPFILE.NES:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%) \
5885f4cb87SRichard Lowe			    $(MAPFILE.PGA:%=-Wl,-M%) \
595801b0f0SToomas Soome			    $(BDIRECT)
607c478bd9Sstevel@tonic-gate
615eb35ba2SRichard LoweNATIVE_LIBS += libc.so
625eb35ba2SRichard Lowe
6385f4cb87SRichard Lowe# To work around a bootstrapping problem, we can't rely on cw(1) knowing how
6485f4cb87SRichard Lowe# to translate -shared as we may be using an older one to build the current
6585f4cb87SRichard Lowe# tools.
66*d17be682SRichard LoweGSHARED = -_gcc=-shared
6785f4cb87SRichard Lowe
685a0af816SRobert Mustacchi#
695a0af816SRobert Mustacchi# To work around a bootstrapping problem, we don't assume that the
705a0af816SRobert Mustacchi# compiler or environment are properly configured to make the stack
715a0af816SRobert Mustacchi# protector work. Disable it right now for the tools.
725a0af816SRobert Mustacchi#
735a0af816SRobert MustacchiSTACKPROTECT = none
745a0af816SRobert Mustacchi
7569b1fd3fSRichard Lowe# Unset CW_LINKER so we run the default.  We don't set LD here to avoid taking
7669b1fd3fSRichard Lowe# the journey through LD_ALTEXEC unnecessarily.
7769b1fd3fSRichard LoweCW_LINKER=
7869b1fd3fSRichard Lowe
797c478bd9Sstevel@tonic-gateROOTONBLDPROG=		$(PROG:%=$(ROOTONBLDBIN)/%)
805ca82e69SJohn LevonROOTONBLDSCRIPTS=	$(SCRIPTS:%=$(ROOTONBLDBIN)/%)
817c478bd9Sstevel@tonic-gateROOTONBLDMACHPROG=	$(PROG:%=$(ROOTONBLDBINMACH)/%)
827a15b0ecSRichard LoweROOTONBLDMACH64PROG=	$(PROG:%=$(ROOTONBLDBINMACH64)/%)
837c478bd9Sstevel@tonic-gateROOTONBLDSHFILES=	$(SHFILES:%=$(ROOTONBLDBIN)/%)
847c478bd9Sstevel@tonic-gateROOTONBLDMAKEFILES=	$(MAKEFILES:%=$(ROOTONBLDBIN)/%)
857c478bd9Sstevel@tonic-gateROOTONBLDMACHSHFILES=	$(SHFILES:%=$(ROOTONBLDBINMACH)/%)
867c478bd9Sstevel@tonic-gateROOTONBLDMACHBINARIES=	$(BINARIES:%=$(ROOTONBLDBINMACH)/%)
8793af10a4SMark J. NelsonROOTONBLDETCFILES=	$(ETCFILES:%=$(ROOTONBLDETC)/%)
887c478bd9Sstevel@tonic-gateROOTONBLDENVFILES=	$(ENVFILES:%=$(ROOTONBLDENV)/%)
897c478bd9Sstevel@tonic-gateROOTONBLDPERLFILES=	$(PERLFILES:%=$(ROOTONBLDBIN)/%)
9075ce41a5SAli BahramiROOTONBLDPERLMODULES=	$(PERLMODULES:%=$(ROOTONBLDLIBPERL)/%)
9196ccc8cbSesaxeROOTONBLDPYFILES=	$(PYFILES:%=$(ROOTONBLDBIN)/%)
926cad8c54SRyan ZezeskiROOTONBLDMAN1ONBLDFILES=$(MAN1ONBLDFILES:%=$(ROOTONBLDMAN1ONBLD)/%)
937c478bd9Sstevel@tonic-gateROOTONBLDABIAUDITFILES=	$(ABI_AUDITFILES:%=$(ROOTONBLDETCABI)/%)
9475ce41a5SAli BahramiROOTONBLDEXCEPTFILES=	$(EXCEPTFILES:%=$(ROOTONBLDETCEXCEPT)/%)
957c478bd9Sstevel@tonic-gate
967c478bd9Sstevel@tonic-gate$(ROOTONBLDETCABI)/%: %
977c478bd9Sstevel@tonic-gate	$(INS.file)
987c478bd9Sstevel@tonic-gate
9975ce41a5SAli Bahrami$(ROOTONBLDETCEXCEPT)/%: $(CODEMGR_WS)/exception_lists/%
10075ce41a5SAli Bahrami	$(INS.file)
10175ce41a5SAli Bahrami
1027c478bd9Sstevel@tonic-gate$(ROOTONBLDBIN)/%: %
1037c478bd9Sstevel@tonic-gate	$(INS.file)
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gate$(ROOTONBLDBINMACH)/%: %
1067c478bd9Sstevel@tonic-gate	$(INS.file)
1077c478bd9Sstevel@tonic-gate
1087a15b0ecSRichard Lowe$(ROOTONBLDBINMACH64)/%: %
1097a15b0ecSRichard Lowe	$(INS.file)
1107a15b0ecSRichard Lowe
11193af10a4SMark J. Nelson$(ROOTONBLDETC)/%: %
11293af10a4SMark J. Nelson	$(INS.file)
11393af10a4SMark J. Nelson
11475ce41a5SAli Bahrami$(ROOTONBLDLIBPERL)/%: %
11575ce41a5SAli Bahrami	$(INS.file)
11675ce41a5SAli Bahrami
1176cad8c54SRyan Zezeski$(ROOTONBLDMAN1ONBLD)/%: %
1187c478bd9Sstevel@tonic-gate	$(INS.file)
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gate$(ROOTONBLDENV)/%: %
1217c478bd9Sstevel@tonic-gate	$(INS.file)
122