xref: /illumos-gate/usr/src/tools/Makefile.tools (revision d17be682)
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)
37ROOTONBLDBINMACH64=	$(ROOTONBLD)/bin/$(MACH64)
38ROOTONBLDETC=		$(ROOTONBLD)/etc
39ROOTONBLDLIB=		$(ROOTONBLD)/lib
40ROOTONBLDLIBMACH=	$(ROOTONBLD)/lib/$(MACH)
41ROOTONBLDLIBMACH64=	$(ROOTONBLD)/lib/$(MACH)/64
42ROOTONBLDLIBPERL=	$(ROOTONBLD)/lib/perl
43ROOTONBLDLIBPY=		$(ROOTONBLD)/lib/python
44ROOTONBLDENV=		$(ROOTONBLD)/env
45ROOTONBLDMAN=		$(ROOTONBLD)/man
46ROOTONBLDMAN1ONBLD=	$(ROOTONBLD)/man/man1onbld
47ROOTONBLDETCABI=	$(ROOTONBLD)/etc/abi
48ROOTONBLDETCEXCEPT=	$(ROOTONBLD)/etc/exception_lists
49ROOTONBLDSHARE=		$(ROOTONBLD)/share
50
51CC =			$(NATIVECC)
52CCC =			$(NATIVECCC)
53CFLAGS =		$(NATIVE_CFLAGS)
54CPPFLAGS=		-D_TS_ERRNO
55ELFSIGN_O=		$(TRUE)
56LDLIBS=
57LDFLAGS=		$(MAPFILE.NES:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%) \
58			    $(MAPFILE.PGA:%=-Wl,-M%) \
59			    $(BDIRECT)
60
61NATIVE_LIBS += libc.so
62
63# To work around a bootstrapping problem, we can't rely on cw(1) knowing how
64# to translate -shared as we may be using an older one to build the current
65# tools.
66GSHARED = -_gcc=-shared
67
68#
69# To work around a bootstrapping problem, we don't assume that the
70# compiler or environment are properly configured to make the stack
71# protector work. Disable it right now for the tools.
72#
73STACKPROTECT = none
74
75# Unset CW_LINKER so we run the default.  We don't set LD here to avoid taking
76# the journey through LD_ALTEXEC unnecessarily.
77CW_LINKER=
78
79ROOTONBLDPROG=		$(PROG:%=$(ROOTONBLDBIN)/%)
80ROOTONBLDSCRIPTS=	$(SCRIPTS:%=$(ROOTONBLDBIN)/%)
81ROOTONBLDMACHPROG=	$(PROG:%=$(ROOTONBLDBINMACH)/%)
82ROOTONBLDMACH64PROG=	$(PROG:%=$(ROOTONBLDBINMACH64)/%)
83ROOTONBLDSHFILES=	$(SHFILES:%=$(ROOTONBLDBIN)/%)
84ROOTONBLDMAKEFILES=	$(MAKEFILES:%=$(ROOTONBLDBIN)/%)
85ROOTONBLDMACHSHFILES=	$(SHFILES:%=$(ROOTONBLDBINMACH)/%)
86ROOTONBLDMACHBINARIES=	$(BINARIES:%=$(ROOTONBLDBINMACH)/%)
87ROOTONBLDETCFILES=	$(ETCFILES:%=$(ROOTONBLDETC)/%)
88ROOTONBLDENVFILES=	$(ENVFILES:%=$(ROOTONBLDENV)/%)
89ROOTONBLDPERLFILES=	$(PERLFILES:%=$(ROOTONBLDBIN)/%)
90ROOTONBLDPERLMODULES=	$(PERLMODULES:%=$(ROOTONBLDLIBPERL)/%)
91ROOTONBLDPYFILES=	$(PYFILES:%=$(ROOTONBLDBIN)/%)
92ROOTONBLDMAN1ONBLDFILES=$(MAN1ONBLDFILES:%=$(ROOTONBLDMAN1ONBLD)/%)
93ROOTONBLDABIAUDITFILES=	$(ABI_AUDITFILES:%=$(ROOTONBLDETCABI)/%)
94ROOTONBLDEXCEPTFILES=	$(EXCEPTFILES:%=$(ROOTONBLDETCEXCEPT)/%)
95
96$(ROOTONBLDETCABI)/%: %
97	$(INS.file)
98
99$(ROOTONBLDETCEXCEPT)/%: $(CODEMGR_WS)/exception_lists/%
100	$(INS.file)
101
102$(ROOTONBLDBIN)/%: %
103	$(INS.file)
104
105$(ROOTONBLDBINMACH)/%: %
106	$(INS.file)
107
108$(ROOTONBLDBINMACH64)/%: %
109	$(INS.file)
110
111$(ROOTONBLDETC)/%: %
112	$(INS.file)
113
114$(ROOTONBLDLIBPERL)/%: %
115	$(INS.file)
116
117$(ROOTONBLDMAN1ONBLD)/%: %
118	$(INS.file)
119
120$(ROOTONBLDENV)/%: %
121	$(INS.file)
122