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