xref: /illumos-gate/usr/src/tools/Makefile (revision 6446bd46ed1b4e9f69da153665f82181ccaedad5)
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# Copyright 2021 Jason King
30#
31
32include ../Makefile.master
33
34# Bootstrap problem: some utilities are pre-requisites for building everything
35# else:
36#    - smatch - as it is a shadow compiler
37#    - cw - as it is used to drive builds
38#    - install.bin - being the 'install' target dependency
39#    - ctf - being used to generate CTF data
40#
41# Anything built before 'install.bin' is present must override binary
42# installation rules in their makefiles. This includes the Makefile for
43# 'install.bin' itself.
44BOOT_SUBDIRS=		\
45	smatch		\
46	.WAIT		\
47	cw		\
48	.WAIT		\
49	install.bin	\
50	.WAIT		\
51	ctf
52
53COMMON_SUBDIRS=		\
54	codesign	\
55	cscope-fast	\
56	env		\
57	find_elf	\
58	findunref	\
59	lintdump	\
60	make		\
61	makesoftcore	\
62	ndrgen		\
63	onbld		\
64	protocmp	\
65	protolist	\
66	scripts		\
67	sgs
68
69#
70#  special versions of commands for use only in build
71#
72UNSHIPPED_SUBDIRS =		\
73	$(SGSMSG)		\
74	$(SGSLIBCONV)		\
75	$(SGSLIBELF)		\
76	$(SGSLIBLDDBG)		\
77	$(SGSLIBLD)		\
78	$(SGSLD)		\
79	geniconvtbl		\
80	localedef		\
81	mandoc			\
82	rpcgen			\
83	tic			\
84	vtfontcvt		\
85	zic
86
87sparc_SUBDIRS=			\
88	chk4ubin		\
89	stabs			\
90	tokenize
91
92i386_SUBDIRS=			\
93	aw			\
94	cpcgen			\
95	elfextract		\
96	mbh_patch		\
97	btxld
98
99$(INTEL_BLD)sgs: aw
100
101SUBDIRS=			\
102	$($(MACH)_SUBDIRS)	\
103	$(COMMON_SUBDIRS)	\
104	$(UNSHIPPED_SUBDIRS)
105
106include Makefile.tools
107
108ROOTDIRS=					\
109	$(ROOTOPT)				\
110	$(ROOTONBLD)				\
111	$(ROOTONBLD)/bin			\
112	$(ROOTONBLD)/bin/$(MACH)		\
113	$(ROOTONBLD)/bin/$(MACH64)		\
114	$(ROOTONBLD)/lib			\
115	$(ROOTONBLD)/lib/$(MACH)		\
116	$(ROOTONBLD)/lib/$(MACH)/64		\
117	$(ROOTONBLD)/lib/perl			\
118	$(ROOTONBLD)/env			\
119	$(ROOTONBLD)/etc			\
120	$(ROOTONBLD)/etc/exception_lists	\
121	$(ROOTONBLD)/share			\
122	$(ROOTONBLD)/man			\
123	$(ROOTONBLD)/man/man1onbld
124
125$(BUILDPY2TOOLS)ROOTDIRS += \
126	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)		\
127	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld		\
128	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Checks	\
129	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Scm
130
131$(BUILDPY3TOOLS)ROOTDIRS +=							\
132	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)				\
133	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld				\
134	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__		\
135	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks			\
136	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__	\
137	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm			\
138	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm/__pycache__
139
140all :=		TARGET= install
141install :=	TARGET= install
142clean :=	TARGET= clean
143clobber :=	TARGET= clobber
144_msg :=		TARGET= _msg
145
146.KEEP_STATE:
147
148#
149# Only create directories in the tools proto area when doing an actual
150# build, not a clean or clobber.
151#
152DOROOTDIRS= $(ROOTDIRS)
153clobber:= DOROOTDIRS=
154clean:= DOROOTDIRS=
155
156$(BUILDPY2TOOLS)DOROOTONBLDLIBPY= $(ROOTONBLDLIBPY)
157clobber:= DOROOTONBLDLIBPY=
158clean:= DOROOTONBLDLIBPY=
159
160all install: $(SUBDIRS)
161
162clean: $(SUBDIRS)
163
164clobber: $(SUBDIRS)
165	$(RM) -rf $(TOOLS_PROTO)
166
167bootstrap: $(BOOT_SUBDIRS)
168
169_msg: $(MSGSUBDIRS)
170
171.PARALLEL: $(SUBDIRS)
172
173$(SUBDIRS): $(BOOT_SUBDIRS)
174
175$(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $$(DOROOTONBLDLIBPY) FRC
176	@cd $@; pwd; $(MAKE) $(TARGET)
177
178# Assume we don't have the install.bin available yet
179$(ROOTDIRS):
180	$(MKDIR) -p -m $(DIRMODE) $@
181
182$(ROOTONBLDLIBPY): $(ROOTDIRS)
183	$(RM) -r $@; $(SYMLINK) python$(PYTHON_VERSION) $@
184
185FRC:
186