xref: /illumos-gate/usr/src/tools/scripts/Makefile (revision 5422785d352a2bb398daceab3d1898a8aa64d006)
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# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
23#
24# Copyright 2010, Richard Lowe
25
26SHELL=/usr/bin/ksh93
27
28SHFILES= \
29	Install \
30	bldenv \
31	build_cscope \
32	bringovercheck \
33	checkpaths \
34	checkproto \
35	cstyle \
36	elfcmp \
37	flg.flp \
38	genoffsets \
39	hgsetup \
40	nightly \
41	onu \
42	protocmp.terse \
43	sccscheck \
44	webrev \
45	which_scm \
46	ws \
47	xref
48
49PERLFILES= \
50	check_rtime \
51	find_elf \
52	interface_check \
53	interface_cmp \
54	jstyle \
55	validate_flg \
56	validate_paths \
57	wdiff
58
59PERLMODULES= \
60	onbld_elfmod.pm \
61	onbld_elfmod_vertype.pm
62
63
64PYFILES= \
65	cddlchk \
66	copyrightchk \
67	git-pbchk \
68	hdrchk \
69	hg-active \
70	mapfilechk \
71	validate_pkg \
72	wsdiff
73
74SCRIPTLINKS= \
75	git-nits
76
77MAN1FILES= \
78	Install.1 \
79	bldenv.1 \
80	bringovercheck.1 \
81	cddlchk.1 \
82	checkpaths.1 \
83	check_rtime.1 \
84	cstyle.1 \
85	find_elf.1 \
86	flg.flp.1 \
87	git-pbchk.1 \
88	hdrchk.1 \
89	interface_check.1 \
90	interface_cmp.1 \
91	hgsetup.1 \
92	jstyle.1 \
93	mapfilechk.1 \
94	nightly.1 \
95	onu.1 \
96	sccscheck.1 \
97	webrev.1 \
98	which_scm.1 \
99	ws.1 \
100	wsdiff.1 \
101	xref.1
102
103MAN1LINKS= \
104	git-nits.1
105
106MAKEFILES= \
107	xref.mk
108
109ETCFILES= \
110	hgstyle \
111	its.conf \
112	its.reg
113
114EXCEPTFILES= \
115	check_rtime \
116	interface_check \
117	interface_cmp
118
119CLEANFILES = $(SHFILES) $(PERLFILES) $(PYFILES) bldenv.1
120
121include ../Makefile.tools
122
123ROOTONBLDSCRIPTLINKS = $(SCRIPTLINKS:%=$(ROOTONBLDBIN)/%)
124ROOTONBLDMAN1LINKS = $(MAN1LINKS:%=$(ROOTONBLDMAN1)/%)
125
126$(ROOTONBLDETCFILES)	:= FILEMODE=	644
127$(ROOTONBLDEXCEPTFILES)	:= FILEMODE=	644
128$(ROOTONBLDPERLMODULES)	:= FILEMODE=	644
129$(ROOTONBLDMAKEFILES)	:= FILEMODE=	644
130$(ROOTONBLDMAN1FILES)	:= FILEMODE=	644
131
132.KEEP_STATE:
133
134all:	$(SHFILES) $(PERLFILES) $(PERLMODULES) $(PYFILES) \
135	$(MAN1FILES) $(MAKEFILES)
136
137$(ROOTONBLDBIN)/git-nits:
138	$(RM) $(ROOTONBLDBIN)/git-nits
139	$(SYMLINK) git-pbchk $(ROOTONBLDBIN)/git-nits
140
141$(ROOTONBLDMAN1)/git-nits.1:
142	$(RM) $(ROOTONBLDMAN1)/git-nits.1
143	$(SYMLINK) git-pbchk.1 $(ROOTONBLDMAN1)/git-nits.1
144
145install: all .WAIT $(ROOTONBLDSHFILES) $(ROOTONBLDPERLFILES)	\
146		$(ROOTONBLDPERLMODULES) $(ROOTONBLDPYFILES)	\
147		$(ROOTONBLDSCRIPTLINKS) $(ROOTONBLDMAN1FILES)	\
148		$(ROOTONBLDMAKEFILES) $(ROOTONBLDETCFILES)	\
149		$(ROOTONBLDEXCEPTFILES) $(ROOTONBLDMAN1LINKS)
150
151clean:
152	$(RM) $(CLEANFILES)
153
154bldenv: bldenv.sh stdenv.sh
155	$(RM) "$@"
156	sed -e '/# STDENV_START/ r stdenv.sh' bldenv.sh > "$@"
157	# Check for shell lint and fail if we hit warnings
158	shlintout="$$( /usr/bin/ksh93 -n "$@" 2>&1 )" ; \
159		[[ "$${shlintout}" != "" ]] && \
160		{ print -r -- "$${shlintout}" ;	false ; } || true
161	$(CHMOD) +x "$@"
162
163bldenv.1: bldenv
164	$(RM) "$@"
165	(set +o errexit ; ksh93 $? --nroff ; true) 2>&1 | \
166	sed 's/\.DS/.nf/g;s/\.DE/.fi/' > "$@"
167
168nightly: nightly.sh stdenv.sh
169	$(RM) "$@"
170	sed -e '/# STDENV_START/ r stdenv.sh' nightly.sh > nightly
171	$(CHMOD) +x "$@"
172
173include ../Makefile.targ
174
175