xref: /illumos-gate/usr/src/tools/Makefile (revision 30165b7f6753bc3d48c52319bed7ec7b3ea36b3c)
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 (c) 2019, Joyent, Inc.
28# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
29#
30
31include ../Makefile.master
32
33# Bootstrap problem: 'cw' must be built before anything else can be built.
34# 'install.bin' should be built next, being the 'install' target dependency
35# for everything else.
36#
37# Because of somewhat cyclic dependency between them, both cw and install.bin
38# override the way we install binaries in their Makefiles.
39BOOT_SUBDIRS= \
40	smatch \
41	.WAIT \
42	cw \
43	.WAIT \
44	install.bin \
45	.WAIT \
46	ctf
47
48COMMON_SUBDIRS= \
49	codereview \
50	codesign \
51	cscope-fast \
52	env \
53	findunref \
54	lintdump \
55	make \
56	makesoftcore \
57	ndrgen \
58	onbld \
59	protocmp \
60	protolist \
61	scripts
62
63#
64#  special versions of commands for use only in build
65#
66UNSHIPPED_SUBDIRS = \
67	localedef \
68	mandoc \
69	tic \
70	vtfontcvt \
71	zic
72
73sparc_SUBDIRS= \
74	chk4ubin \
75	stabs \
76	tokenize
77
78i386_SUBDIRS=		\
79	aw		\
80	elfextract	\
81	mbh_patch	\
82	btxld
83
84LINTSUBDIRS= \
85	codereview \
86	ctf \
87	cw \
88	findunref \
89	lintdump \
90	ndrgen \
91	protocmp \
92	protolist
93
94SUBDIRS= \
95	$($(MACH)_SUBDIRS) \
96	$(COMMON_SUBDIRS) \
97	$(UNSHIPPED_SUBDIRS)
98
99include Makefile.tools
100
101ROOTDIRS= \
102	$(ROOTOPT) \
103	$(ROOTONBLD) \
104	$(ROOTONBLD)/bin \
105	$(ROOTONBLD)/bin/$(MACH) \
106	$(ROOTONBLD)/lib \
107	$(ROOTONBLD)/lib/$(MACH) \
108	$(ROOTONBLD)/lib/$(MACH)/64 \
109	$(ROOTONBLD)/lib/perl \
110	$(ROOTONBLD)/env \
111	$(ROOTONBLD)/etc \
112	$(ROOTONBLD)/etc/exception_lists \
113	$(ROOTONBLD)/share \
114	$(ROOTONBLD)/man \
115	$(ROOTONBLD)/man/man1onbld
116
117$(BUILDPY2TOOLS)ROOTDIRS += \
118	$(ROOTONBLD)/lib/python$(PYTHON_VERSION) \
119	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld \
120	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Checks \
121	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Scm
122
123$(BUILDPY3TOOLS)ROOTDIRS += \
124	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION) \
125	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld \
126	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__ \
127	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks \
128	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__ \
129	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm \
130	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm/__pycache__
131
132all :=		TARGET= install
133install :=	TARGET= install
134clean :=	TARGET= clean
135clobber :=	TARGET= clobber
136lint :=		TARGET= lint
137_msg :=		TARGET= _msg
138
139.KEEP_STATE:
140
141#
142# Only create directories in the tools proto area when doing an actual
143# build, not a clean or clobber.
144#
145DOROOTDIRS= $(ROOTDIRS)
146clobber:= DOROOTDIRS=
147clean:= DOROOTDIRS=
148
149$(BUILDPY2TOOLS)DOROOTONBLDLIBPY= $(ROOTONBLDLIBPY)
150clobber:= DOROOTONBLDLIBPY=
151clean:= DOROOTONBLDLIBPY=
152
153all install: $(SUBDIRS)
154
155clean: $(SUBDIRS)
156
157clobber: $(SUBDIRS)
158	$(RM) -rf $(TOOLS_PROTO)
159
160lint: $(LINTSUBDIRS)
161
162_msg: $(MSGSUBDIRS)
163
164.PARALLEL: $(SUBDIRS) $(CLOSED_SUBDIRS)
165
166$(SUBDIRS) $(CLOSED_SUBDIRS): $(BOOT_SUBDIRS)
167
168$(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $$(DOROOTONBLDLIBPY) FRC
169	@cd $@; pwd; $(MAKE) $(TARGET)
170
171# Assume we don't have the install.bin available yet
172$(ROOTDIRS):
173	$(MKDIR) -p -m $(DIRMODE) $@
174
175$(ROOTONBLDLIBPY): $(ROOTDIRS)
176	$(RM) -r $@; $(SYMLINK) python$(PYTHON_VERSION) $@
177
178FRC:
179