Mercurial > audlegacy-plugins
annotate buildsys.mk.in @ 1841:3c7750b27c80
evdev-plug: Mk2
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Mon, 24 Sep 2007 14:05:33 -0500 |
parents | 1adfd05736a5 |
children | eaa979be9b89 |
rev | line source |
---|---|
1763 | 1 # |
2 # Copyright (c) 2007, Jonathan Schleifer <js@h3c.de> | |
3 # | |
4 # Permission to use, copy, modify, and/or distribute this software for any | |
5 # purpose with or without fee is hereby granted, provided that the above | |
6 # copyright notice and this permission notice is present in all copies. | |
7 # | |
8 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
9 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
10 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
11 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
12 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
13 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
14 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
15 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
16 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
17 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
18 # POSSIBILITY OF SUCH DAMAGE. | |
19 # | |
20 | |
21 PACKAGE = @PACKAGE@ | |
22 CC = @CC@ | |
23 CXX = @CXX@ | |
24 CPP = @CPP@ | |
25 DC = @DC@ | |
26 ERLC = @ERLC@ | |
27 OBJC = @OBJC@ | |
28 AR = @AR@ | |
29 LD = ${CC} | |
30 CFLAGS = @CFLAGS@ | |
31 CXXFLAGS = @CXXFLAGS@ | |
32 CPPFLAGS = @CPPFLAGS@ | |
33 DFLAGS = @DFLAGS@ | |
34 ERLCFLAGS = @ERLCFLAGS@ | |
35 OBJCFLAGS = @OBJCFLAGS@ | |
36 LDFLAGS = @LDFLAGS@ | |
37 LIBS = @LIBS@ | |
38 LIB_CPPFLAGS = @LIB_CPPFLAGS@ | |
39 LIB_CFLAGS = @LIB_CFLAGS@ | |
40 LIB_LDFLAGS = @LIB_LDFLAGS@ | |
41 LIB_PREFIX = @LIB_PREFIX@ | |
42 LIB_SUFFIX = @LIB_SUFFIX@ | |
43 PLUGIN_CPPFLAGS = @PLUGIN_CPPFLAGS@ | |
44 PLUGIN_CFLAGS = @PLUGIN_CFLAGS@ | |
45 PLUGIN_LDFLAGS = @PLUGIN_LDFLAGS@ | |
46 PLUGIN_SUFFIX = @PLUGIN_SUFFIX@ | |
47 INSTALL_LIB = @INSTALL_LIB@ | |
48 UNINSTALL_LIB = @UNINSTALL_LIB@ | |
49 CLEAN_LIB = @CLEAN_LIB@ | |
50 LN_S = @LN_S@ | |
51 MKDIR_P = mkdir -p | |
52 INSTALL = @INSTALL@ | |
53 SHELL = @SHELL@ | |
54 prefix = @prefix@ | |
55 exec_prefix = @exec_prefix@ | |
56 bindir = @bindir@ | |
57 libdir = @libdir@ | |
58 plugindir ?= ${PACKAGE} | |
59 datarootdir = @datarootdir@ | |
60 datadir = @datadir@ | |
61 includedir = @includedir@ | |
62 includesubdir ?= ${PACKAGE} | |
63 mandir = @mandir@ | |
64 mansubdir ?= man1 | |
65 | |
66 OBJS1 = ${SRCS:.c=.o} | |
67 OBJS2 = ${OBJS1:.cc=.o} | |
68 OBJS3 = ${OBJS2:.cxx=.o} | |
69 OBJS4 = ${OBJS3:.d=.o} | |
70 OBJS5 = ${OBJS4:.erl=.beam} | |
71 OBJS += ${OBJS5:.m=.o} | |
72 | |
73 .SILENT: | |
74 .SUFFIXES: .beam .c .cc .cxx .d .erl .m | |
75 .PHONY: all subdirs depend install uninstall clean distclean | |
76 | |
1826
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
77 all: |
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
78 for i in subdirs depend ${OBJS} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${LIB} ${LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST}; do \ |
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
79 ${MAKE} ${MFLAGS} $$i; \ |
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
80 done |
1763 | 81 |
82 subdirs: | |
83 for i in ${SUBDIRS}; do \ | |
84 ${DIR_ENTER}; \ | |
85 ${MAKE} ${MFLAGS} || exit 1; \ | |
86 ${DIR_LEAVE}; \ | |
87 done | |
88 | |
89 depend: pre-depend ${SRCS} | |
90 regen=0; \ | |
91 for i in ${SRCS}; do [ $$i -nt .deps ] && regen=1; done; \ | |
1831
5665b04a6cfd
Always prefix comparisons with x.
Jonathan Schleifer <js@h3c.de>
parents:
1826
diff
changeset
|
92 if [ x"$$regen" = x"1" ]; then \ |
1826
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
93 error=0; \ |
1815 | 94 ${DEPEND_STATUS}; \ |
1763 | 95 rm -f .deps; \ |
96 for i in ${SRCS}; do \ | |
97 case $${i##*.} in \ | |
98 c|cc|cxx|m) \ | |
1826
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
99 ${CPP} ${CPPFLAGS} -M $$i >>.deps || error=1; \ |
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
100 ;; \ |
1763 | 101 esac; \ |
102 done; \ | |
1831
5665b04a6cfd
Always prefix comparisons with x.
Jonathan Schleifer <js@h3c.de>
parents:
1826
diff
changeset
|
103 if [ x"$$error" = x"0" ]; then \ |
1826
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
104 ${DEPEND_OK}; \ |
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
105 else \ |
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
106 ${DEPEND_FAILED}; \ |
d7709de0882c
Fix dependencies and other parallel stuff.
Jonathan Schleifer <js@h3c.de>
parents:
1815
diff
changeset
|
107 fi; \ |
1763 | 108 fi |
109 | |
110 pre-depend: | |
111 | |
1815 | 112 ${PROG} ${PROG_NOINST}: ${EXT_DEPS} ${OBJS} |
1763 | 113 ${LINK_STATUS} |
114 if ${LD} -o $@ ${OBJS} ${LDFLAGS} ${LIBS}; then \ | |
115 ${LINK_OK}; \ | |
116 else \ | |
117 ${LINK_FAILED}; \ | |
118 fi | |
119 | |
120 ${LIB} ${LIB_NOINST}: ${EXT_DEPS} ${OBJS} | |
121 ${LINK_STATUS} | |
122 if ${LD} -o $@ ${OBJS} ${LIB_LDFLAGS} ${LDFLAGS} ${LIBS}; then \ | |
123 ${LINK_OK}; \ | |
124 else \ | |
125 ${LINK_FAILED}; \ | |
126 fi | |
127 | |
128 ${PLUGIN} ${PLUGIN_NONST}: ${EXT_DEPS} ${OBJS} | |
129 ${LINK_STATUS} | |
130 if ${LD} -o $@ ${OBJS} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}; then \ | |
131 ${LINK_OK}; \ | |
132 else \ | |
133 ${LINK_FAILED}; \ | |
134 fi | |
135 | |
136 ${STATIC_LIB} ${STATIC_LIB_NOINST}: ${EXT_DEPS} ${OBJS} | |
137 ${LINK_STATUS} | |
138 if ${AR} cr $@ ${OBJS}; then \ | |
139 ${LINK_OK}; \ | |
140 else \ | |
141 ${LINK_FAILED}; \ | |
142 fi | |
143 | |
144 .c.o: | |
145 ${COMPILE_STATUS} | |
146 if ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<; then \ | |
147 ${COMPILE_OK}; \ | |
148 else \ | |
149 ${COMPILE_FAILED}; \ | |
150 fi | |
151 | |
152 .cc.o .cxx.o: | |
153 ${COMPILE_STATUS} | |
154 if ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c -o $@ $<; then \ | |
155 ${COMPILE_OK}; \ | |
156 else \ | |
157 ${COMPILE_FAILED}; \ | |
158 fi | |
159 | |
160 .d.o: | |
161 ${COMPILE_STATUS} | |
1831
5665b04a6cfd
Always prefix comparisons with x.
Jonathan Schleifer <js@h3c.de>
parents:
1826
diff
changeset
|
162 if [ x"$(basename ${DC})" = x"dmd" ]; then \ |
1763 | 163 if ${DC} ${DFLAGS} -c -of$@ $<; then \ |
164 ${COMPILE_OK}; \ | |
165 else \ | |
166 ${COMPILE_FAILED}; \ | |
167 fi \ | |
168 else \ | |
169 if ${DC} ${DFLAGS} -c -o $@ $<; then \ | |
170 ${COMPILE_OK}; \ | |
171 else \ | |
172 ${COMPILE_FAILED}; \ | |
173 fi \ | |
174 fi | |
175 | |
176 .erl.beam: | |
177 ${COMPILE_STATUS} | |
178 if ${ERLC} ${ERLCFLAGS} -o $@ $<; then \ | |
179 ${COMPILE_OK}; \ | |
180 else \ | |
181 ${COMPILE_FAILED}; \ | |
182 fi | |
183 | |
184 .m.o: | |
185 ${COMPILE_STATUS} | |
186 if ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c -o $@ $<; then \ | |
187 ${COMPILE_OK}; \ | |
188 else \ | |
189 ${COMPILE_FAILED}; \ | |
190 fi | |
191 | |
192 install: ${LIB} ${STATIC_LIB} ${PLUGIN} ${PROG} install-extra | |
193 for i in ${SUBDIRS}; do \ | |
194 ${DIR_ENTER}; \ | |
195 ${MAKE} ${MFLAGS} install || exit 1; \ | |
196 ${DIR_LEAVE}; \ | |
197 done | |
198 | |
199 for i in ${LIB}; do \ | |
200 ${INSTALL_STATUS}; \ | |
201 if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL_LIB}; then \ | |
202 ${INSTALL_OK}; \ | |
203 else \ | |
204 ${INSTALL_FAILED}; \ | |
205 fi \ | |
206 done | |
207 | |
208 for i in ${STATIC_LIB}; do \ | |
209 ${INSTALL_STATUS}; \ | |
210 if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i; then \ | |
211 ${INSTALL_OK}; \ | |
212 else \ | |
213 ${INSTALL_FAILED}; \ | |
214 fi \ | |
215 done | |
216 | |
217 for i in ${PLUGIN}; do \ | |
218 ${INSTALL_STATUS}; \ | |
219 if ${MKDIR_P} ${DESTDIR}${libdir}/${plugindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/${plugindir}/$$i; then \ | |
220 ${INSTALL_OK}; \ | |
221 else \ | |
222 ${INSTALL_FAILED}; \ | |
223 fi \ | |
224 done | |
225 | |
226 for i in ${DATA}; do \ | |
227 ${INSTALL_STATUS}; \ | |
228 if ${MKDIR_P} $$(dirname ${DESTDIR}${datadir}/${PACKAGE}/$$i) && ${INSTALL} -m 644 $$i ${DESTDIR}${datadir}/${PACKAGE}/$$i; then \ | |
229 ${INSTALL_OK}; \ | |
230 else \ | |
231 ${INSTALL_FAILED}; \ | |
232 fi \ | |
233 done | |
234 | |
235 for i in ${PROG}; do \ | |
236 ${INSTALL_STATUS}; \ | |
237 if ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 -s $$i ${DESTDIR}${bindir}/$$i; then \ | |
238 ${INSTALL_OK}; \ | |
239 else \ | |
240 ${INSTALL_FAILED}; \ | |
241 fi \ | |
242 done | |
243 | |
244 for i in ${INCLUDES}; do \ | |
245 ${INSTALL_STATUS}; \ | |
246 if ${MKDIR_P} ${DESTDIR}${includedir}/${includesubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${includedir}/${includesubdir}/$$i; then \ | |
247 ${INSTALL_OK}; \ | |
248 else \ | |
249 ${INSTALL_FAILED}; \ | |
250 fi \ | |
251 done | |
252 | |
253 for i in ${MAN}; do \ | |
254 ${INSTALL_STATUS}; \ | |
255 if ${MKDIR_P} ${DESTDIR}${mandir}/${mansubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${mandir}/${mansubdir}/$$i; then \ | |
256 ${INSTALL_OK}; \ | |
257 else \ | |
258 ${INSTALL_FAILED}; \ | |
259 fi \ | |
260 done | |
261 | |
262 install-extra: | |
263 | |
264 uninstall: uninstall-extra | |
265 for i in ${SUBDIRS}; do \ | |
266 ${DIR_ENTER}; \ | |
267 ${MAKE} ${MFLAGS} uninstall || exit 1; \ | |
268 ${DIR_LEAVE}; \ | |
269 done | |
270 | |
271 for i in ${LIB}; do \ | |
272 if [ -f ${DESTDIR}${libdir}/$$i ]; then \ | |
273 if ${UNINSTALL_LIB}; then \ | |
274 ${DELETE_OK}; \ | |
275 else \ | |
276 ${DELETE_FAILED}; \ | |
277 fi \ | |
278 fi; \ | |
279 done | |
280 | |
281 for i in ${STATIC_LIB}; do \ | |
282 if [ -f ${DESTDIR}${libdir}/$$i ]; then \ | |
283 if rm -f ${DESTDIR}${libdir}/$$i; then \ | |
284 ${DELETE_OK}; \ | |
285 else \ | |
286 ${DELETE_FAILED}; \ | |
287 fi \ | |
288 fi \ | |
289 done | |
290 | |
291 for i in ${PLUGIN}; do \ | |
292 if [ -f ${DESTDIR}${libdir}/${plugindir}/$$i ]; then \ | |
293 if rm -f ${DESTDIR}${libdir}/${plugindir}/$$i; then \ | |
294 ${DELETE_OK}; \ | |
295 else \ | |
296 ${DELETE_FAILED}; \ | |
297 fi \ | |
298 fi \ | |
299 done | |
300 -rmdir ${DESTDIR}${libdir}/${plugindir} >/dev/null 2>&1 | |
301 | |
302 for i in ${DATA}; do \ | |
303 if [ -f ${DESTDIR}${datadir}/${PACKAGE}/$$i ]; then \ | |
304 if rm -f ${DESTDIR}${datadir}/${PACKAGE}/$$i; then \ | |
305 ${DELETE_OK}; \ | |
306 else \ | |
307 ${DELETE_FAILED}; \ | |
308 fi \ | |
309 fi \ | |
310 done | |
311 | |
312 for i in ${PROG}; do \ | |
313 if [ -f ${DESTDIR}${bindir}/$$i ]; then \ | |
314 if rm -f ${DESTDIR}${bindir}/$$i; then \ | |
315 ${DELETE_OK}; \ | |
316 else \ | |
317 ${DELETE_FAILED}; \ | |
318 fi \ | |
319 fi \ | |
320 done | |
321 | |
322 for i in ${INCLUDES}; do \ | |
323 if [ -f ${DESTDIR}${includedir}/${includesubdir}/$$i ]; then \ | |
324 if rm -f ${DESTDIR}${includedir}/${includesubdir}/$$i; then \ | |
325 ${DELETE_OK}; \ | |
326 else \ | |
327 ${DELETE_FAILED}; \ | |
328 fi \ | |
329 fi \ | |
330 done | |
331 -rmdir ${DESTDIR}${includedir}/${includesubdir} >/dev/null 2>&1 | |
332 | |
333 for i in ${MAN}; do \ | |
334 if [ -f ${DESTDIR}${mandir}/${mansubdir}/$$i ]; then \ | |
335 if rm -f ${DESTDIR}${mandir}/${mansubdir}/$$i; then \ | |
336 ${DELETE_OK}; \ | |
337 else \ | |
338 ${DELETE_FAILED}; \ | |
339 fi \ | |
340 fi \ | |
341 done | |
342 | |
343 uninstall-extra: | |
344 | |
345 clean: | |
346 for i in ${SUBDIRS}; do \ | |
347 ${DIR_ENTER}; \ | |
348 ${MAKE} ${MFLAGS} clean || exit 1; \ | |
349 ${DIR_LEAVE}; \ | |
350 done | |
351 | |
352 for i in ${OBJS} ${CLEAN} ${CLEAN_LIB} .deps *~; do \ | |
353 if [ -f $$i -o -d $$i ]; then \ | |
354 if rm -fr $$i; then \ | |
355 ${DELETE_OK}; \ | |
356 else \ | |
357 ${DELETE_FAILED}; \ | |
358 fi \ | |
359 fi \ | |
360 done | |
361 | |
362 distclean: clean | |
363 for i in ${SUBDIRS}; do \ | |
364 ${DIR_ENTER}; \ | |
365 ${MAKE} ${MFLAGS} distclean || exit 1; \ | |
366 ${DIR_LEAVE}; \ | |
367 done | |
368 | |
369 for i in ${PROG} ${PROG_NOINST} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${DISTCLEAN}; do \ | |
370 if [ -f $$i -o -d $$i ]; then \ | |
371 if rm -fr $$i; then \ | |
372 ${DELETE_OK}; \ | |
373 else \ | |
374 ${DELETE_FAILED}; \ | |
375 fi \ | |
376 fi \ | |
377 done | |
378 | |
379 DIR_ENTER = printf "\033[0;36mEntering directory \033[1;36m$$i\033[0;36m.\033[0m\n"; cd $$i || exit 1 | |
380 DIR_LEAVE = printf "\033[0;36mLeaving directory \033[1;36m$$i\033[0;36m.\033[0m\n"; cd .. || exit 1 | |
1815 | 381 DEPEND_STATUS = printf "\033[0;33mGenerating dependencies...\033[0m\r" |
382 DEPEND_OK = printf "\033[0;32mSuccessfully generated dependencies.\033[0m\n" | |
383 DEPEND_FAILED = printf "\033[0;31mFailed to generate dependencies!\033[0m\n"; exit 1 | |
384 COMPILE_STATUS = printf "\033[0;33mCompiling \033[1;33m$<\033[0;33m...\033[0m\r" | |
385 COMPILE_OK = printf "\033[0;32mSuccessfully compiled \033[1;32m$<\033[0;32m.\033[0m\n" | |
386 COMPILE_FAILED = printf "\033[0;31mFailed to compile \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1 | |
1763 | 387 LINK_STATUS = printf "\033[0;33mLinking \033[1;33m$@\033[0;33m...\033[0m\r" |
388 LINK_OK = printf "\033[0;32mSuccessfully linked \033[1;32m$@\033[0;32m.\033[0m\n" | |
389 LINK_FAILED = printf "\033[0;31mFailed to link \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1 | |
390 INSTALL_STATUS = printf "\033[0;33mInstalling \033[1;33m$$i\033[0;33m...\033[0m\r" | |
391 INSTALL_OK = printf "\033[0;32mSuccessfully installed \033[1;32m$$i\033[0;32m.\033[0m\n" | |
392 INSTALL_FAILED = printf "\033[0;31mFailed to install \033[1;31m$$i\033[0;31m!\033[0m\n"; exit 1 | |
393 DELETE_OK = printf "\033[0;34mDeleted \033[1;34m$$i\033[0;34m.\033[0m\n" | |
394 DELETE_FAILED = printf "\033[0;31mFailed to delete \033[1;31m$$i\033[0;31m!\033[0m\n"; exit 1 | |
395 | |
396 -include .deps |