xref: /illumos-gate/usr/src/tools/Makefile.tools (revision c4ecba8a)
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			    $(ZASSERTDEFLIB)=libc.so \
59			    $(BDIRECT)
60
61# To work around a bootstrapping problem, we can't rely on cw(1) knowing how
62# to translate -shared as we may be using an older one to build the current
63# tools.
64GSHARED = -_cc=-G -_gcc=-shared
65
66# Unset CW_LINKER so we run the default.  We don't set LD here to avoid taking
67# the journey through LD_ALTEXEC unnecessarily.
68CW_LINKER=
69
70ROOTONBLDPROG=		$(PROG:%=$(ROOTONBLDBIN)/%)
71ROOTONBLDSCRIPTS=	$(SCRIPTS:%=$(ROOTONBLDBIN)/%)
72ROOTONBLDMACHPROG=	$(PROG:%=$(ROOTONBLDBINMACH)/%)
73ROOTONBLDSHFILES=	$(SHFILES:%=$(ROOTONBLDBIN)/%)
74ROOTONBLDMAKEFILES=	$(MAKEFILES:%=$(ROOTONBLDBIN)/%)
75ROOTONBLDMACHSHFILES=	$(SHFILES:%=$(ROOTONBLDBINMACH)/%)
76ROOTONBLDMACHBINARIES=	$(BINARIES:%=$(ROOTONBLDBINMACH)/%)
77ROOTONBLDETCFILES=	$(ETCFILES:%=$(ROOTONBLDETC)/%)
78ROOTONBLDENVFILES=	$(ENVFILES:%=$(ROOTONBLDENV)/%)
79ROOTONBLDPERLFILES=	$(PERLFILES:%=$(ROOTONBLDBIN)/%)
80ROOTONBLDPERLMODULES=	$(PERLMODULES:%=$(ROOTONBLDLIBPERL)/%)
81ROOTONBLDPYFILES=	$(PYFILES:%=$(ROOTONBLDBIN)/%)
82ROOTONBLDMAN1ONBLDFILES=$(MAN1ONBLDFILES:%=$(ROOTONBLDMAN1ONBLD)/%)
83ROOTONBLDABIAUDITFILES=	$(ABI_AUDITFILES:%=$(ROOTONBLDETCABI)/%)
84ROOTONBLDEXCEPTFILES=	$(EXCEPTFILES:%=$(ROOTONBLDETCEXCEPT)/%)
85
86# Break a chicken-and-egg dependency cycle for the tools build
87SCCSCHECK=@echo would sccscheck
88
89$(ROOTONBLDETCABI)/%: %
90	$(INS.file)
91
92$(ROOTONBLDETCEXCEPT)/%: $(CODEMGR_WS)/exception_lists/%
93	$(INS.file)
94
95$(ROOTONBLDBIN)/%: %
96	$(INS.file)
97
98$(ROOTONBLDBINMACH)/%: %
99	$(INS.file)
100
101$(ROOTONBLDETC)/%: %
102	$(INS.file)
103
104$(ROOTONBLDLIBPERL)/%: %
105	$(INS.file)
106
107$(ROOTONBLDMAN1ONBLD)/%: %
108	$(INS.file)
109
110$(ROOTONBLDENV)/%: %
111	$(INS.file)
112