xref: /illumos-gate/usr/src/tools/Makefile (revision d2f7972d81337947df76c36b8c2a5f290829fa7a)
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	tic \
80	vtfontcvt \
81	zic
82
83sparc_SUBDIRS= \
84	chk4ubin \
85	stabs \
86	tokenize
87
88i386_SUBDIRS=		\
89	aw		\
90	cpcgen		\
91	elfextract	\
92	mbh_patch	\
93	btxld
94
95$(INTEL_BLD)sgs: aw
96
97SUBDIRS= \
98	$($(MACH)_SUBDIRS) \
99	$(COMMON_SUBDIRS) \
100	$(UNSHIPPED_SUBDIRS)
101
102include Makefile.tools
103
104ROOTDIRS= \
105	$(ROOTOPT) \
106	$(ROOTONBLD) \
107	$(ROOTONBLD)/bin \
108	$(ROOTONBLD)/bin/$(MACH) \
109	$(ROOTONBLD)/lib \
110	$(ROOTONBLD)/lib/$(MACH) \
111	$(ROOTONBLD)/lib/$(MACH)/64 \
112	$(ROOTONBLD)/lib/perl \
113	$(ROOTONBLD)/env \
114	$(ROOTONBLD)/etc \
115	$(ROOTONBLD)/etc/exception_lists \
116	$(ROOTONBLD)/share \
117	$(ROOTONBLD)/man \
118	$(ROOTONBLD)/man/man1onbld
119
120$(BUILDPY2TOOLS)ROOTDIRS += \
121	$(ROOTONBLD)/lib/python$(PYTHON_VERSION) \
122	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld \
123	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Checks \
124	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Scm
125
126$(BUILDPY3TOOLS)ROOTDIRS += \
127	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION) \
128	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld \
129	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__ \
130	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks \
131	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__ \
132	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm \
133	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm/__pycache__
134
135all :=		TARGET= install
136install :=	TARGET= install
137clean :=	TARGET= clean
138clobber :=	TARGET= clobber
139_msg :=		TARGET= _msg
140
141.KEEP_STATE:
142
143#
144# Only create directories in the tools proto area when doing an actual
145# build, not a clean or clobber.
146#
147DOROOTDIRS= $(ROOTDIRS)
148clobber:= DOROOTDIRS=
149clean:= DOROOTDIRS=
150
151$(BUILDPY2TOOLS)DOROOTONBLDLIBPY= $(ROOTONBLDLIBPY)
152clobber:= DOROOTONBLDLIBPY=
153clean:= DOROOTONBLDLIBPY=
154
155all install: $(SUBDIRS)
156
157clean: $(SUBDIRS)
158
159clobber: $(SUBDIRS)
160	$(RM) -rf $(TOOLS_PROTO)
161
162bootstrap: $(BOOT_SUBDIRS)
163
164_msg: $(MSGSUBDIRS)
165
166.PARALLEL: $(SUBDIRS) $(CLOSED_SUBDIRS)
167
168$(SUBDIRS) $(CLOSED_SUBDIRS): $(BOOT_SUBDIRS)
169
170$(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $$(DOROOTONBLDLIBPY) FRC
171	@cd $@; pwd; $(MAKE) $(TARGET)
172
173# Assume we don't have the install.bin available yet
174$(ROOTDIRS):
175	$(MKDIR) -p -m $(DIRMODE) $@
176
177$(ROOTONBLDLIBPY): $(ROOTDIRS)
178	$(RM) -r $@; $(SYMLINK) python$(PYTHON_VERSION) $@
179
180FRC:
181