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