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