xref: /illumos-gate/usr/src/tools/scripts/Makefile (revision 0f554fe53a6056402dbaf025d945afa8659af0c7)
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	wsdiff
70
71SCRIPTLINKS= \
72	git-nits
73
74MAN1ONBLDFILES= \
75	Install.1onbld \
76	bldenv.1onbld \
77	bringovercheck.1onbld \
78	cddlchk.1onbld \
79	checkpaths.1onbld \
80	check_rtime.1onbld \
81	cstyle.1onbld \
82	find_elf.1onbld \
83	flg.flp.1onbld \
84	git-pbchk.1onbld \
85	hdrchk.1onbld \
86	interface_check.1onbld \
87	interface_cmp.1onbld \
88	jstyle.1onbld \
89	mapfilechk.1onbld \
90	nightly.1onbld \
91	onu.1onbld \
92	sccscheck.1onbld \
93	webrev.1onbld \
94	which_scm.1onbld \
95	ws.1onbld \
96	wsdiff.1onbld \
97	xref.1onbld
98
99MAN1ONBLDLINKS= \
100	git-nits.1onbld
101
102MAKEFILES= \
103	xref.mk
104
105ETCFILES= \
106	its.conf \
107	its.reg
108
109EXCEPTFILES= \
110	check_rtime \
111	interface_check \
112	interface_cmp
113
114CLEANFILES = $(SHFILES) $(PERLFILES) $(PYFILES) bldenv.1onbld onu.sh
115
116onu.sh:	onu.sh.in
117	$(SED) -e "s:@PYTHON_VERSION@:$(PYTHON_VERSION):g" < onu.sh.in > $@
118
119include ../Makefile.tools
120
121ROOTONBLDSCRIPTLINKS = $(SCRIPTLINKS:%=$(ROOTONBLDBIN)/%)
122ROOTONBLDMAN1ONBLDLINKS = $(MAN1ONBLDLINKS:%=$(ROOTONBLDMAN1ONBLD)/%)
123
124$(ROOTONBLDETCFILES)		:= FILEMODE=	644
125$(ROOTONBLDEXCEPTFILES)		:= FILEMODE=	644
126$(ROOTONBLDPERLMODULES)		:= FILEMODE=	644
127$(ROOTONBLDMAKEFILES)		:= FILEMODE=	644
128$(ROOTONBLDMAN1ONBLDFILES)	:= FILEMODE=	644
129
130.KEEP_STATE:
131
132all:	$(SHFILES) $(PERLFILES) $(PERLMODULES) $(PYFILES) \
133	$(MAN1ONBLDFILES) $(MAKEFILES)
134
135$(ROOTONBLDBIN)/git-nits:
136	$(RM) $(ROOTONBLDBIN)/git-nits
137	$(SYMLINK) git-pbchk $(ROOTONBLDBIN)/git-nits
138
139$(ROOTONBLDMAN1ONBLD)/git-nits.1onbld:
140	$(RM) $(ROOTONBLDMAN1ONBLD)/git-nits.1onbld
141	$(SYMLINK) git-pbchk.1onbld $(ROOTONBLDMAN1ONBLD)/git-nits.1onbld
142
143install: all .WAIT $(ROOTONBLDSHFILES) $(ROOTONBLDPERLFILES)		\
144		$(ROOTONBLDPERLMODULES) $(ROOTONBLDPYFILES)		\
145		$(ROOTONBLDSCRIPTLINKS) $(ROOTONBLDMAN1ONBLDFILES)	\
146		$(ROOTONBLDMAKEFILES) $(ROOTONBLDETCFILES)		\
147		$(ROOTONBLDEXCEPTFILES) $(ROOTONBLDMAN1ONBLDLINKS)
148
149clean:
150	$(RM) $(CLEANFILES)
151
152bldenv: bldenv.sh stdenv.sh
153	$(RM) "$@"
154	sed -e '/# STDENV_START/ r stdenv.sh' bldenv.sh > "$@"
155	# Check for shell lint and fail if we hit warnings
156	shlintout="$$( /usr/bin/ksh93 -n "$@" 2>&1 )" ; \
157		[[ "$${shlintout}" != "" ]] && \
158		{ print -r -- "$${shlintout}" ;	false ; } || true
159	$(CHMOD) +x "$@"
160
161bldenv.1onbld: bldenv
162	$(RM) "$@"
163	(set +o errexit ; ksh93 $? --nroff ; true) 2>&1 | \
164	sed -e 's/\.DS/.nf/g;s/\.DE/.fi/' \
165	-e 's/\.TH BLDENV 1/.TH BLDENV 1ONBLD/' \
166	-e 's/(1)/(1ONBLD)/' > "$@"
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