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