xref: /illumos-gate/usr/src/tools/Makefile (revision eed3be881cd8e53fe7187245b289da7106712dea)
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#
28
29include ../Makefile.master
30
31# Bootstrap problem: 'cw' must be built before anything else can be built.
32# 'install.bin' should be built next, being the 'install' target dependency
33# for everything else.
34#
35# Because of somewhat cyclic dependency between them, both cw and install.bin
36# override the way we install binaries in their Makefiles.
37BOOT_SUBDIRS= \
38	cw \
39	.WAIT \
40	install.bin \
41	.WAIT \
42	ctf
43
44COMMON_SUBDIRS= \
45	codereview \
46	codesign \
47	cscope-fast \
48	env \
49	findunref \
50	lintdump \
51	make \
52	makesoftcore \
53	ndrgen \
54	onbld \
55	protocmp \
56	protolist \
57	scripts
58
59#
60#  special versions of commands for use only in build
61#
62UNSHIPPED_SUBDIRS = \
63	localedef \
64	mandoc \
65	tic \
66	vtfontcvt \
67	zic
68
69sparc_SUBDIRS= \
70	chk4ubin \
71	stabs \
72	tokenize
73
74i386_SUBDIRS=		\
75	aw		\
76	elfextract	\
77	mbh_patch	\
78	btxld
79
80LINTSUBDIRS= \
81	codereview \
82	ctf \
83	cw \
84	findunref \
85	lintdump \
86	ndrgen \
87	protocmp \
88	protolist
89
90SUBDIRS= \
91	$($(MACH)_SUBDIRS) \
92	$(COMMON_SUBDIRS) \
93	$(UNSHIPPED_SUBDIRS)
94
95include Makefile.tools
96
97ROOTDIRS= \
98	$(ROOTOPT) \
99	$(ROOTONBLD) \
100	$(ROOTONBLD)/bin \
101	$(ROOTONBLD)/bin/$(MACH) \
102	$(ROOTONBLD)/lib \
103	$(ROOTONBLD)/lib/$(MACH) \
104	$(ROOTONBLD)/lib/$(MACH)/64 \
105	$(ROOTONBLD)/lib/perl \
106	$(ROOTONBLD)/lib/python$(PYTHON_VERSION) \
107	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld \
108	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Checks \
109	$(ROOTONBLD)/lib/python$(PYTHON_VERSION)/onbld/Scm \
110	$(ROOTONBLD)/env \
111	$(ROOTONBLD)/etc \
112	$(ROOTONBLD)/etc/exception_lists \
113	$(ROOTONBLD)/share \
114	$(ROOTONBLD)/man \
115	$(ROOTONBLD)/man/man1onbld
116
117all :=		TARGET= install
118install :=	TARGET= install
119clean :=	TARGET= clean
120clobber :=	TARGET= clobber
121lint :=		TARGET= lint
122_msg :=		TARGET= _msg
123
124.KEEP_STATE:
125
126#
127# Only create directories in the tools proto area when doing an actual
128# build, not a clean or clobber.
129#
130DOROOTDIRS= $(ROOTDIRS)
131clobber:= DOROOTDIRS=
132clean:= DOROOTDIRS=
133
134DOROOTONBLDLIBPY= $(ROOTONBLDLIBPY)
135clobber:= DOROOTONBLDLIBPY=
136clean:= DOROOTONBLDLIBPY=
137
138all install: $(SUBDIRS)
139
140clean: $(SUBDIRS)
141
142clobber: $(SUBDIRS)
143	$(RM) -rf $(TOOLS_PROTO)
144
145lint: $(LINTSUBDIRS)
146
147_msg: $(MSGSUBDIRS)
148
149.PARALLEL: $(SUBDIRS) $(CLOSED_SUBDIRS)
150
151$(SUBDIRS) $(CLOSED_SUBDIRS): $(BOOT_SUBDIRS)
152
153$(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $$(DOROOTONBLDLIBPY) FRC
154	@cd $@; pwd; $(MAKE) $(TARGET)
155
156# Assume we don't have the install.bin available yet
157$(ROOTDIRS):
158	$(MKDIR) -p -m $(DIRMODE) $@
159
160$(ROOTONBLDLIBPY): $(ROOTDIRS)
161	$(RM) -r $@; $(SYMLINK) python$(PYTHON_VERSION) $@
162
163FRC:
164