1#
2# Copyright (c) 2001-2009 Hypertriton, Inc. <http://hypertriton.com/>
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright
9#    notice, this list of conditions and the following disclaimer.
10# 2. Redistributions in binary form must reproduce the above copyright
11#    notice, this list of conditions and the following disclaimer in the
12#    documentation and/or other materials provided with the distribution.
13#
14# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
18# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19# DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
23# USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25#
26# Logic required for recursing into subdirectories.
27#
28
29MAKE?=make
30
31all-subdir:
32	@(if [ "${SUBDIR}" = "" ]; then \
33	    SUBDIR="NONE"; \
34	else \
35	    SUBDIR="${SUBDIR}"; \
36	fi; \
37	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
38		for F in $$SUBDIR; do \
39		    echo "==> ${REL}$$F"; \
40		    (cd $$F && ${MAKE} REL=${REL}$$F/); \
41		    if [ $$? != 0 ]; then \
42		    	exit 1; \
43		    fi; \
44		done; \
45	fi)
46
47all-subdir-ifexists:
48	@(if [ "${SUBDIR}" = "" ]; then \
49	    SUBDIR="NONE"; \
50	else \
51	    SUBDIR="${SUBDIR}"; \
52	fi; \
53	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
54		for F in $$SUBDIR; do \
55		    if [ -e "$$F" ]; then \
56		        echo "==> ${REL}$$F"; \
57		        (cd $$F && ${MAKE} REL=${REL}$$F/); \
58		        if [ $$? != 0 ]; then \
59		    	    exit 1; \
60		        fi; \
61		    fi; \
62		done; \
63	fi)
64
65clean-subdir:
66	@(if [ "${SUBDIR}" = "" ]; then \
67	    SUBDIR="NONE"; \
68	else \
69	    SUBDIR="${SUBDIR}"; \
70	fi; \
71	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
72		for F in $$SUBDIR; do \
73		    echo "==> ${REL}$$F"; \
74		    (cd $$F && ${MAKE} REL=${REL}$$F/ clean); \
75		    if [ $$? != 0 ]; then \
76		    	exit 1; \
77		    fi; \
78		done; \
79	fi)
80
81clean-subdir-ifexists:
82	@(if [ "${SUBDIR}" = "" ]; then \
83	    SUBDIR="NONE"; \
84	else \
85	    SUBDIR="${SUBDIR}"; \
86	fi; \
87	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
88		for F in $$SUBDIR; do \
89		    if [ -e "$$F" ]; then \
90		        echo "==> ${REL}$$F"; \
91		        (cd $$F && ${MAKE} REL=${REL}$$F/ clean); \
92		        if [ $$? != 0 ]; then \
93		    	    exit 1; \
94		        fi; \
95		    fi; \
96		done; \
97	fi)
98
99install-subdir:
100	@(if [ "${SUBDIR}" = "" ]; then \
101	    SUBDIR="NONE"; \
102	else \
103	    SUBDIR="${SUBDIR}"; \
104	fi; \
105	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
106		for F in $$SUBDIR; do \
107		    echo "==> ${REL}$$F"; \
108		    (cd $$F && ${MAKE} REL=${REL}$$F/ install); \
109		    if [ $$? != 0 ]; then \
110		    	exit 1; \
111		    fi; \
112		done; \
113	fi)
114
115install-subdir-ifexists:
116	@(if [ "${SUBDIR}" = "" ]; then \
117	    SUBDIR="NONE"; \
118	else \
119	    SUBDIR="${SUBDIR}"; \
120	fi; \
121	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
122		for F in $$SUBDIR; do \
123		    if [ -e "$$F" ]; then \
124		        echo "==> ${REL}$$F"; \
125		        (cd $$F && ${MAKE} REL=${REL}$$F/ install); \
126		        if [ $$? != 0 ]; then \
127		    	    exit 1; \
128		        fi; \
129		    fi; \
130		done; \
131	fi)
132
133deinstall-subdir:
134	@(if [ "${SUBDIR}" = "" ]; then \
135	    SUBDIR="NONE"; \
136	else \
137	    SUBDIR="${SUBDIR}"; \
138	fi; \
139	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
140		for F in $$SUBDIR; do \
141		    echo "==> ${REL}$$F"; \
142		    (cd $$F && ${MAKE} REL=${REL}$$F/ deinstall); \
143		    if [ $$? != 0 ]; then \
144		    	exit 1; \
145		    fi; \
146		done; \
147	fi)
148
149deinstall-subdir-ifexists:
150	@(if [ "${SUBDIR}" = "" ]; then \
151	    SUBDIR="NONE"; \
152	else \
153	    SUBDIR="${SUBDIR}"; \
154	fi; \
155	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
156		for F in $$SUBDIR; do \
157		    if [ -e "$$F" ]; then \
158		        echo "==> ${REL}$$F"; \
159		        (cd $$F && ${MAKE} REL=${REL}$$F/ deinstall); \
160		        if [ $$? != 0 ]; then \
161		    	    exit 1; \
162		        fi; \
163		    fi; \
164		done; \
165	fi)
166
167depend-subdir:
168	@(if [ "${SUBDIR}" = "" ]; then \
169	    SUBDIR="NONE"; \
170	else \
171	    SUBDIR="${SUBDIR}"; \
172	fi; \
173	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
174		for F in $$SUBDIR; do \
175		    echo "==> ${REL}$$F"; \
176		    (cd $$F && ${MAKE} REL=${REL}$$F/ depend); \
177		    if [ $$? != 0 ]; then \
178		    	exit 1; \
179		    fi; \
180		done; \
181	fi)
182
183depend-subdir-ifexists:
184	@(if [ "${SUBDIR}" = "" ]; then \
185	    SUBDIR="NONE"; \
186	else \
187	    SUBDIR="${SUBDIR}"; \
188	fi; \
189	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
190		for F in $$SUBDIR; do \
191		    if [ -e "$$F" ]; then \
192		        echo "==> ${REL}$$F"; \
193		        (cd $$F && ${MAKE} REL=${REL}$$F/ depend); \
194		        if [ $$? != 0 ]; then \
195		    	    exit 1; \
196		        fi; \
197		    fi; \
198		done; \
199	fi)
200
201
202cleandir-subdir:
203	@(if [ "${SUBDIR}" = "" ]; then \
204	    SUBDIR="NONE"; \
205	else \
206	    SUBDIR="${SUBDIR}"; \
207	fi; \
208	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
209		for F in $$SUBDIR; do \
210		    echo "==> ${REL}$$F"; \
211		    (cd $$F && ${MAKE} REL=${REL}$$F/ cleandir); \
212		    if [ $$? != 0 ]; then \
213		    	exit 1; \
214		    fi; \
215		done; \
216	fi)
217
218cleandir-subdir-ifexists:
219	@(if [ "${SUBDIR}" = "" ]; then \
220	    SUBDIR="NONE"; \
221	else \
222	    SUBDIR="${SUBDIR}"; \
223	fi; \
224	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
225		for F in $$SUBDIR; do \
226		    if [ -e "$$F" ]; then \
227		        echo "==> ${REL}$$F"; \
228		        (cd $$F && ${MAKE} REL=${REL}$$F/ cleandir); \
229		        if [ $$? != 0 ]; then \
230		    	    exit 1; \
231		        fi; \
232		    fi; \
233		done; \
234	fi)
235
236regress-subdir:
237	@(if [ "${SUBDIR}" = "" ]; then \
238	    SUBDIR="NONE"; \
239	else \
240	    SUBDIR="${SUBDIR}"; \
241	fi; \
242	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
243		for F in $$SUBDIR; do \
244		    echo "==> ${REL}$$F"; \
245		    (cd $$F && ${MAKE} REL=${REL}$$F/ regress); \
246		    if [ $$? != 0 ]; then \
247		    	exit 1; \
248		    fi; \
249		done; \
250	fi)
251
252regress-subdir-ifexists:
253	@(if [ "${SUBDIR}" = "" ]; then \
254	    SUBDIR="NONE"; \
255	else \
256	    SUBDIR="${SUBDIR}"; \
257	fi; \
258	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
259		for F in $$SUBDIR; do \
260		    if [ -e "$$F" ]; then \
261		        echo "==> ${REL}$$F"; \
262		        (cd $$F && ${MAKE} REL=${REL}$$F/ regress); \
263		        if [ $$? != 0 ]; then \
264		    	    exit 1; \
265		        fi; \
266		    fi; \
267		done; \
268	fi)
269
270proj-package-subdir:
271	@(if [ "${SUBDIR}" = "" ]; then \
272	    SUBDIR="NONE"; \
273	else \
274	    SUBDIR="${SUBDIR}"; \
275	fi; \
276	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
277		for F in $$SUBDIR; do \
278		    echo "==> ${REL}$$F"; \
279		    (cd $$F && ${MAKE} REL=${REL}$$F/ proj-package); \
280		    if [ $$? != 0 ]; then \
281		    	exit 1; \
282		    fi; \
283		done; \
284	fi)
285
286proj-clean-subdir:
287	@(if [ "${SUBDIR}" = "" ]; then \
288	    SUBDIR="NONE"; \
289	else \
290	    SUBDIR="${SUBDIR}"; \
291	fi; \
292	if [ "$$SUBDIR" != "" -a "$$SUBDIR" != "NONE" ]; then \
293		for F in $$SUBDIR; do \
294		    echo "==> ${REL}$$F"; \
295		    (cd $$F && ${MAKE} REL=${REL}$$F/ proj-clean); \
296		    if [ $$? != 0 ]; then \
297		    	exit 1; \
298		    fi; \
299		done; \
300	fi)
301
302.PHONY:	all-subdir clean-subdir cleandir-subdir install-subdir
303.PHONY: deinstall-subdir depend-subdir regress-subdir
304.PHONY:	all-subdir-ifexists clean-subdir-ifexists cleandir-subdir-ifexists
305.PHONY: install-subdir-ifexists deinstall-subdir-ifexists
306.PHONY: depend-subdir-ifexists regress-subdir-ifexists
307.PHONY: proj-package-subdir proj-clean-subdir
308