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