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