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