xref: /illumos-gate/usr/src/tools/Makefile.tools (revision 66597161e2ba69a84fa138bce7ac02a1e6b9746c)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
23# Copyright 2020 Joyent, Inc.
24#
25# Definitions common to tool source.
26#
27include $(SRC)/Makefile.master
28
29FILEMODE=	0555
30
31TOOLS=			$(SRC)/tools
32TOOLS_PROTO=		$(TOOLS)/proto/root_$(MACH)-nd
33ROOTOPT=		$(TOOLS_PROTO)/opt
34ROOTONBLD=		$(ROOTOPT)/onbld
35ROOTONBLDBIN=		$(ROOTONBLD)/bin
36ROOTONBLDBINMACH=	$(ROOTONBLD)/bin/$(MACH)
37ROOTONBLDETC=		$(ROOTONBLD)/etc
38ROOTONBLDLIB=		$(ROOTONBLD)/lib
39ROOTONBLDLIBMACH=	$(ROOTONBLD)/lib/$(MACH)
40ROOTONBLDLIBMACH64=	$(ROOTONBLD)/lib/$(MACH)/64
41ROOTONBLDLIBPERL=	$(ROOTONBLD)/lib/perl
42ROOTONBLDLIBPY=		$(ROOTONBLD)/lib/python
43ROOTONBLDENV=		$(ROOTONBLD)/env
44ROOTONBLDMAN=		$(ROOTONBLD)/man
45ROOTONBLDMAN1ONBLD=	$(ROOTONBLD)/man/man1onbld
46ROOTONBLDETCABI=	$(ROOTONBLD)/etc/abi
47ROOTONBLDETCEXCEPT=	$(ROOTONBLD)/etc/exception_lists
48ROOTONBLDSHARE=		$(ROOTONBLD)/share
49
50CC =			$(NATIVECC)
51CCC =			$(NATIVECCC)
52CFLAGS =		$(NATIVE_CFLAGS)
53CPPFLAGS=		-D_TS_ERRNO
54ELFSIGN_O=		$(TRUE)
55LDLIBS=
56LDFLAGS=		$(MAPFILE.NES:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%) \
57			    $(MAPFILE.PGA:%=-Wl,-M%) \
58			    $(BDIRECT)
59
60NATIVE_LIBS += libc.so
61
62# To work around a bootstrapping problem, we can't rely on cw(1) knowing how
63# to translate -shared as we may be using an older one to build the current
64# tools.
65GSHARED = -_cc=-G -_gcc=-shared
66
67#
68# To work around a bootstrapping problem, we don't assume that the
69# compiler or environment are properly configured to make the stack
70# protector work. Disable it right now for the tools.
71#
72STACKPROTECT = none
73
74# Unset CW_LINKER so we run the default.  We don't set LD here to avoid taking
75# the journey through LD_ALTEXEC unnecessarily.
76CW_LINKER=
77
78ROOTONBLDPROG=		$(PROG:%=$(ROOTONBLDBIN)/%)
79ROOTONBLDSCRIPTS=	$(SCRIPTS:%=$(ROOTONBLDBIN)/%)
80ROOTONBLDMACHPROG=	$(PROG:%=$(ROOTONBLDBINMACH)/%)
81ROOTONBLDSHFILES=	$(SHFILES:%=$(ROOTONBLDBIN)/%)
82ROOTONBLDMAKEFILES=	$(MAKEFILES:%=$(ROOTONBLDBIN)/%)
83ROOTONBLDMACHSHFILES=	$(SHFILES:%=$(ROOTONBLDBINMACH)/%)
84ROOTONBLDMACHBINARIES=	$(BINARIES:%=$(ROOTONBLDBINMACH)/%)
85ROOTONBLDETCFILES=	$(ETCFILES:%=$(ROOTONBLDETC)/%)
86ROOTONBLDENVFILES=	$(ENVFILES:%=$(ROOTONBLDENV)/%)
87ROOTONBLDPERLFILES=	$(PERLFILES:%=$(ROOTONBLDBIN)/%)
88ROOTONBLDPERLMODULES=	$(PERLMODULES:%=$(ROOTONBLDLIBPERL)/%)
89ROOTONBLDPYFILES=	$(PYFILES:%=$(ROOTONBLDBIN)/%)
90ROOTONBLDMAN1ONBLDFILES=$(MAN1ONBLDFILES:%=$(ROOTONBLDMAN1ONBLD)/%)
91ROOTONBLDABIAUDITFILES=	$(ABI_AUDITFILES:%=$(ROOTONBLDETCABI)/%)
92ROOTONBLDEXCEPTFILES=	$(EXCEPTFILES:%=$(ROOTONBLDETCEXCEPT)/%)
93
94# Break a chicken-and-egg dependency cycle for the tools build
95SCCSCHECK=@echo would sccscheck
96
97$(ROOTONBLDETCABI)/%: %
98	$(INS.file)
99
100$(ROOTONBLDETCEXCEPT)/%: $(CODEMGR_WS)/exception_lists/%
101	$(INS.file)
102
103$(ROOTONBLDBIN)/%: %
104	$(INS.file)
105
106$(ROOTONBLDBINMACH)/%: %
107	$(INS.file)
108
109$(ROOTONBLDETC)/%: %
110	$(INS.file)
111
112$(ROOTONBLDLIBPERL)/%: %
113	$(INS.file)
114
115$(ROOTONBLDMAN1ONBLD)/%: %
116	$(INS.file)
117
118$(ROOTONBLDENV)/%: %
119	$(INS.file)
120