xref: /illumos-gate/usr/src/tools/Makefile (revision 78a75454a34d2b5e9b2c2967ecdaf9c5d3e6b030)
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	yacc		\
53	lex
54
55COMMON_SUBDIRS=		\
56	codesign	\
57	cscope-fast	\
58	env		\
59	find_elf	\
60	findunref	\
61	lintdump	\
62	make		\
63	makesoftcore	\
64	manlink		\
65	ndrgen		\
66	onbld		\
67	protocmp	\
68	protolist	\
69	scripts		\
70	sgs		\
71	svc
72
73#
74#  special versions of commands for use only in build
75#
76UNSHIPPED_SUBDIRS =		\
77	$(SGSMSG)		\
78	$(SGSLIBCONV)		\
79	$(SGSLIBELF)		\
80	$(SGSLIBLDDBG)		\
81	$(SGSLIBLD)		\
82	$(SGSLD)		\
83	geniconvtbl		\
84	localedef		\
85	mandoc			\
86	rpcgen			\
87	tic			\
88	vtfontcvt		\
89	zic
90
91i386_SUBDIRS=			\
92	cpcgen			\
93	elfextract		\
94	mbh_patch		\
95	btxld
96
97SUBDIRS=			\
98	$($(MACH)_SUBDIRS)	\
99	$(COMMON_SUBDIRS)	\
100	$(UNSHIPPED_SUBDIRS)
101
102include Makefile.tools
103
104ROOTDIRS=					\
105	$(ROOTOPT)				\
106	$(ROOTONBLD)				\
107	$(ROOTONBLD)/bin			\
108	$(ROOTONBLD)/bin/$(MACH)		\
109	$(ROOTONBLD)/bin/$(MACH64)		\
110	$(ROOTONBLD)/lib			\
111	$(ROOTONBLD)/lib/$(MACH)		\
112	$(ROOTONBLD)/lib/$(MACH)/64		\
113	$(ROOTONBLD)/lib/perl			\
114	$(ROOTONBLD)/env			\
115	$(ROOTONBLD)/etc			\
116	$(ROOTONBLD)/etc/exception_lists	\
117	$(ROOTONBLD)/share			\
118	$(ROOTONBLD)/share/lib			\
119	$(ROOTONBLD)/share/lib/ccs		\
120	$(ROOTONBLD)/man			\
121	$(ROOTONBLD)/man/man1onbld
122
123ROOTDIRS +=							\
124	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)				\
125	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld				\
126	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/__pycache__		\
127	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks			\
128	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Checks/__pycache__	\
129	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm			\
130	$(ROOTONBLD)/lib/python$(PYTHON3_VERSION)/onbld/Scm/__pycache__
131
132all :=		TARGET= install
133install :=	TARGET= install
134clean :=	TARGET= clean
135clobber :=	TARGET= clobber
136_msg :=		TARGET= _msg
137
138.KEEP_STATE:
139
140#
141# Only create directories in the tools proto area when doing an actual
142# build, not a clean or clobber.
143#
144DOROOTDIRS= $(ROOTDIRS)
145clobber:= DOROOTDIRS=
146clean:= DOROOTDIRS=
147
148clobber:= DOROOTONBLDLIBPY=
149clean:= DOROOTONBLDLIBPY=
150
151all install: $(SUBDIRS)
152
153clean: $(SUBDIRS)
154
155clobber: $(SUBDIRS)
156	$(RM) -rf $(TOOLS_PROTO)
157
158bootstrap: $(BOOT_SUBDIRS)
159
160_msg: $(MSGSUBDIRS)
161
162.PARALLEL: $(SUBDIRS)
163
164$(SUBDIRS): $(BOOT_SUBDIRS)
165
166$(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $$(DOROOTONBLDLIBPY) FRC
167	@cd $@; pwd; $(MAKE) $(TARGET)
168
169# Assume we don't have the install.bin available yet
170$(ROOTDIRS):
171	$(MKDIR) -p -m $(DIRMODE) $@
172
173$(ROOTONBLDLIBPY): $(ROOTDIRS)
174	$(RM) -r $@; $(SYMLINK) python$(PYTHON3_VERSION) $@
175
176FRC:
177