xref: /illumos-gate/usr/src/tools/Makefile (revision ae5a8bed14db6c16225cac733ea042c27e242d18)
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)/bin/$(MACH64)		\
112	$(ROOTONBLD)/lib			\
113	$(ROOTONBLD)/lib/$(MACH)		\
114	$(ROOTONBLD)/lib/$(MACH)/64		\
115	$(ROOTONBLD)/lib/perl			\
116	$(ROOTONBLD)/env			\
117	$(ROOTONBLD)/etc			\
118	$(ROOTONBLD)/etc/exception_lists	\
119	$(ROOTONBLD)/share			\
120	$(ROOTONBLD)/man			\
121	$(ROOTONBLD)/man/man1onbld
122
123$(BUILDPY2TOOLS)ROOTDIRS += \
124	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)		\
125	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld		\
126	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Checks	\
127	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Scm
128
129$(BUILDPY3TOOLS)ROOTDIRS +=							\
130	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)				\
131	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld				\
132	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__		\
133	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks			\
134	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__	\
135	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm			\
136	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm/__pycache__
137
138all :=		TARGET= install
139install :=	TARGET= install
140clean :=	TARGET= clean
141clobber :=	TARGET= clobber
142_msg :=		TARGET= _msg
143
144.KEEP_STATE:
145
146#
147# Only create directories in the tools proto area when doing an actual
148# build, not a clean or clobber.
149#
150DOROOTDIRS= $(ROOTDIRS)
151clobber:= DOROOTDIRS=
152clean:= DOROOTDIRS=
153
154$(BUILDPY2TOOLS)DOROOTONBLDLIBPY= $(ROOTONBLDLIBPY)
155clobber:= DOROOTONBLDLIBPY=
156clean:= DOROOTONBLDLIBPY=
157
158all install: $(SUBDIRS)
159
160clean: $(SUBDIRS)
161
162clobber: $(SUBDIRS)
163	$(RM) -rf $(TOOLS_PROTO)
164
165bootstrap: $(BOOT_SUBDIRS)
166
167_msg: $(MSGSUBDIRS)
168
169.PARALLEL: $(SUBDIRS)
170
171$(SUBDIRS): $(BOOT_SUBDIRS)
172
173$(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $$(DOROOTONBLDLIBPY) FRC
174	@cd $@; pwd; $(MAKE) $(TARGET)
175
176# Assume we don't have the install.bin available yet
177$(ROOTDIRS):
178	$(MKDIR) -p -m $(DIRMODE) $@
179
180$(ROOTONBLDLIBPY): $(ROOTDIRS)
181	$(RM) -r $@; $(SYMLINK) python$(PYTHON_VERSION) $@
182
183FRC:
184