xref: /illumos-gate/usr/src/tools/Makefile (revision 06ca4e396ecc93ed45a333664a51558b7e84e8f5)
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
125ROOTDIRS +=							\
126	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)				\
127	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld				\
128	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__		\
129	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks			\
130	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__	\
131	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm			\
132	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm/__pycache__
133
134all :=		TARGET= install
135install :=	TARGET= install
136clean :=	TARGET= clean
137clobber :=	TARGET= clobber
138_msg :=		TARGET= _msg
139
140.KEEP_STATE:
141
142#
143# Only create directories in the tools proto area when doing an actual
144# build, not a clean or clobber.
145#
146DOROOTDIRS= $(ROOTDIRS)
147clobber:= DOROOTDIRS=
148clean:= DOROOTDIRS=
149
150clobber:= DOROOTONBLDLIBPY=
151clean:= DOROOTONBLDLIBPY=
152
153all install: $(SUBDIRS)
154
155clean: $(SUBDIRS)
156
157clobber: $(SUBDIRS)
158	$(RM) -rf $(TOOLS_PROTO)
159
160bootstrap: $(BOOT_SUBDIRS)
161
162_msg: $(MSGSUBDIRS)
163
164.PARALLEL: $(SUBDIRS)
165
166$(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$(PYTHON3_VERSION) $@
177
178FRC:
179