xref: /illumos-gate/usr/src/tools/Makefile (revision c94be9439c4f0773ef60e2cec21d548359cfea20)
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#
23# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
24# Copyright 2014 Garrett D'Amore <garrett@damore.org>
25# Copyright 2016 Toomas Soome <tsoome@me.com>
26# Copyright (c) 2016, Chris Fraire <cfraire@me.com>.
27# Copyright 2019 Joyent, Inc.
28# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
29#
30
31include ../Makefile.master
32
33# Bootstrap problem: some utilities are pre-requisites for building everything
34# else:
35#    - smatch - as it is a shadow compiler
36#    - cw - as it is used to drive builds
37#    - install.bin - being the 'install' target dependency
38#    - ctf - being used to generate CTF data
39#
40# Anything built before 'install.bin' is present must override binary
41# installation rules in their makefiles. This includes the Makefile for
42# 'install.bin' itself.
43BOOT_SUBDIRS= \
44	smatch \
45	.WAIT \
46	cw \
47	.WAIT \
48	install.bin \
49	.WAIT \
50	ctf
51
52COMMON_SUBDIRS= \
53	codesign \
54	cscope-fast \
55	env \
56	findunref \
57	lintdump \
58	make \
59	makesoftcore \
60	ndrgen \
61	onbld \
62	protocmp \
63	protolist \
64	scripts \
65	sgs
66
67#
68#  special versions of commands for use only in build
69#
70UNSHIPPED_SUBDIRS = \
71	$(SGSMSG) \
72	$(SGSLIBCONV) \
73	$(SGSLIBELF) \
74	$(SGSLIBLDDBG) \
75	$(SGSLIBLD) \
76	$(SGSLD) \
77	localedef \
78	mandoc \
79	rpcgen \
80	tic \
81	vtfontcvt \
82	zic
83
84sparc_SUBDIRS= \
85	chk4ubin \
86	stabs \
87	tokenize
88
89i386_SUBDIRS=		\
90	aw		\
91	cpcgen		\
92	elfextract	\
93	mbh_patch	\
94	btxld
95
96$(INTEL_BLD)sgs: aw
97
98SUBDIRS= \
99	$($(MACH)_SUBDIRS) \
100	$(COMMON_SUBDIRS) \
101	$(UNSHIPPED_SUBDIRS)
102
103include Makefile.tools
104
105ROOTDIRS= \
106	$(ROOTOPT) \
107	$(ROOTONBLD) \
108	$(ROOTONBLD)/bin \
109	$(ROOTONBLD)/bin/$(MACH) \
110	$(ROOTONBLD)/lib \
111	$(ROOTONBLD)/lib/$(MACH) \
112	$(ROOTONBLD)/lib/$(MACH)/64 \
113	$(ROOTONBLD)/lib/perl \
114	$(ROOTONBLD)/env \
115	$(ROOTONBLD)/etc \
116	$(ROOTONBLD)/etc/exception_lists \
117	$(ROOTONBLD)/share \
118	$(ROOTONBLD)/man \
119	$(ROOTONBLD)/man/man1onbld
120
121$(BUILDPY2TOOLS)ROOTDIRS += \
122	$(ROOTONBLD)/lib/python$(PYTHON_VERSION) \
123	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld \
124	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Checks \
125	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Scm
126
127$(BUILDPY3TOOLS)ROOTDIRS += \
128	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION) \
129	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld \
130	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__ \
131	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks \
132	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__ \
133	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm \
134	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm/__pycache__
135
136all :=		TARGET= install
137install :=	TARGET= install
138clean :=	TARGET= clean
139clobber :=	TARGET= clobber
140_msg :=		TARGET= _msg
141
142.KEEP_STATE:
143
144#
145# Only create directories in the tools proto area when doing an actual
146# build, not a clean or clobber.
147#
148DOROOTDIRS= $(ROOTDIRS)
149clobber:= DOROOTDIRS=
150clean:= DOROOTDIRS=
151
152$(BUILDPY2TOOLS)DOROOTONBLDLIBPY= $(ROOTONBLDLIBPY)
153clobber:= DOROOTONBLDLIBPY=
154clean:= DOROOTONBLDLIBPY=
155
156all install: $(SUBDIRS)
157
158clean: $(SUBDIRS)
159
160clobber: $(SUBDIRS)
161	$(RM) -rf $(TOOLS_PROTO)
162
163bootstrap: $(BOOT_SUBDIRS)
164
165_msg: $(MSGSUBDIRS)
166
167.PARALLEL: $(SUBDIRS) $(CLOSED_SUBDIRS)
168
169$(SUBDIRS) $(CLOSED_SUBDIRS): $(BOOT_SUBDIRS)
170
171$(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $$(DOROOTONBLDLIBPY) FRC
172	@cd $@; pwd; $(MAKE) $(TARGET)
173
174# Assume we don't have the install.bin available yet
175$(ROOTDIRS):
176	$(MKDIR) -p -m $(DIRMODE) $@
177
178$(ROOTONBLDLIBPY): $(ROOTDIRS)
179	$(RM) -r $@; $(SYMLINK) python$(PYTHON_VERSION) $@
180
181FRC:
182