Mercurial > audlegacy
annotate buildsys.mk.in @ 3571:cfb56cc47f9f trunk
append rpath on linking audacious when prefix is specified.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Wed, 19 Sep 2007 18:41:39 +0900 |
parents | 1f75259a1cac |
children | 625af2797f35 |
rev | line source |
---|---|
3535 | 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 LN_S = @LN_S@ | |
50 MKDIR_P = mkdir -p | |
51 INSTALL = @INSTALL@ | |
52 SHELL = @SHELL@ | |
53 prefix = @prefix@ | |
54 exec_prefix = @exec_prefix@ | |
55 bindir = @bindir@ | |
56 libdir = @libdir@ | |
57 plugindir ?= ${PACKAGE} | |
58 datarootdir = @datarootdir@ | |
59 datadir = @datadir@ | |
60 includedir = @includedir@ | |
61 includesubdir ?= ${PACKAGE} | |
62 mandir = @mandir@ | |
63 mansubdir ?= man1 | |
3538 | 64 pkgdatadir = ${datadir}/${PACKAGE} |
3535 | 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 | |
3571
cfb56cc47f9f
append rpath on linking audacious when prefix is specified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3538
diff
changeset
|
73 ifneq ($(strip $(prefix)),) |
cfb56cc47f9f
append rpath on linking audacious when prefix is specified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3538
diff
changeset
|
74 RPATH = -Wl,-rpath=${libdir} |
cfb56cc47f9f
append rpath on linking audacious when prefix is specified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3538
diff
changeset
|
75 endif |
cfb56cc47f9f
append rpath on linking audacious when prefix is specified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3538
diff
changeset
|
76 |
3535 | 77 .SILENT: |
78 .SUFFIXES: .beam .c .cc .cxx .d .erl .m | |
79 .PHONY: all subdirs depend install uninstall clean distclean | |
80 | |
81 all: subdirs depend ${OBJS} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${LIB} ${LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST} | |
82 | |
83 subdirs: | |
84 for i in ${SUBDIRS}; do \ | |
85 ${DIR_ENTER}; \ | |
86 ${MAKE} || exit 1; \ | |
87 ${DIR_LEAVE}; \ | |
88 done | |
89 | |
90 depend-hook: | |
91 | |
92 depend: depend-hook | |
93 regen=0; \ | |
94 for i in ${SRCS}; do [ $$i -nt .deps ] && regen=1; done; \ | |
95 if [ $$regen = 1 ]; then \ | |
96 rm -f .deps; \ | |
97 for i in ${SRCS}; do \ | |
98 case $${i##*.} in \ | |
99 c|cc|cxx|m) \ | |
100 ${CPP} ${CPPFLAGS} -M $$i >>.deps; \ | |
101 esac; \ | |
102 done; \ | |
103 fi | |
104 | |
105 ${PROG} ${PROG_NOINST}: ${EXT_DEPS} ${OBJS} | |
106 ${LINK_STATUS} | |
3571
cfb56cc47f9f
append rpath on linking audacious when prefix is specified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
3538
diff
changeset
|
107 if ${LD} -o $@ ${OBJS} ${LDFLAGS} ${LIBS} ${RPATH}; then \ |
3535 | 108 ${LINK_OK}; \ |
109 else \ | |
110 ${LINK_FAILED}; \ | |
111 fi | |
112 | |
113 ${LIB} ${LIB_NOINST}: ${EXT_DEPS} ${OBJS} | |
114 ${LINK_STATUS} | |
115 if ${LD} -o $@ ${OBJS} ${LIB_LDFLAGS} ${LDFLAGS} ${LIBS}; then \ | |
116 ${LINK_OK}; \ | |
117 else \ | |
118 ${LINK_FAILED}; \ | |
119 fi | |
120 | |
121 ${PLUGIN} ${PLUGIN_NONST}: ${EXT_DEPS} ${OBJS} | |
122 ${LINK_STATUS} | |
123 if ${LD} -o $@ ${OBJS} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}; then \ | |
124 ${LINK_OK}; \ | |
125 else \ | |
126 ${LINK_FAILED}; \ | |
127 fi | |
128 | |
129 ${STATIC_LIB} ${STATIC_LIB_NOINST}: ${EXT_DEPS} ${OBJS} | |
130 ${LINK_STATUS} | |
131 if ${AR} cq $@ ${OBJS}; then \ | |
132 ${LINK_OK}; \ | |
133 else \ | |
134 ${LINK_FAILED}; \ | |
135 fi | |
136 | |
137 ${EXT_DEPS}: subdirs | |
138 | |
139 .c.o: | |
140 ${COMPILE_STATUS} | |
141 if ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<; then \ | |
142 ${COMPILE_OK}; \ | |
143 else \ | |
144 ${COMPILE_FAILED}; \ | |
145 fi | |
146 | |
147 .cc.o .cxx.o: | |
148 ${COMPILE_STATUS} | |
149 if ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c -o $@ $<; then \ | |
150 ${COMPILE_OK}; \ | |
151 else \ | |
152 ${COMPILE_FAILED}; \ | |
153 fi | |
154 | |
155 .d.o: | |
156 ${COMPILE_STATUS} | |
157 if test x"$(basename ${DC})" = x"dmd"; then \ | |
158 if ${DC} ${DFLAGS} -c -of$@ $<; then \ | |
159 ${COMPILE_OK}; \ | |
160 else \ | |
161 ${COMPILE_FAILED}; \ | |
162 fi \ | |
163 else \ | |
164 if ${DC} ${DFLAGS} -c -o $@ $<; then \ | |
165 ${COMPILE_OK}; \ | |
166 else \ | |
167 ${COMPILE_FAILED}; \ | |
168 fi \ | |
169 fi | |
170 | |
171 .erl.beam: | |
172 ${COMPILE_STATUS} | |
173 if ${ERLC} ${ERLCFLAGS} -o $@ $<; then \ | |
174 ${COMPILE_OK}; \ | |
175 else \ | |
176 ${COMPILE_FAILED}; \ | |
177 fi | |
178 | |
179 .m.o: | |
180 ${COMPILE_STATUS} | |
181 if ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c -o $@ $<; then \ | |
182 ${COMPILE_OK}; \ | |
183 else \ | |
184 ${COMPILE_FAILED}; \ | |
185 fi | |
186 | |
187 install: ${LIB} ${STATIC_LIB} ${PLUGIN} ${PROG} install-extra | |
188 for i in ${SUBDIRS}; do \ | |
189 ${DIR_ENTER}; \ | |
190 ${MAKE} install || exit 1; \ | |
191 ${DIR_LEAVE}; \ | |
192 done | |
193 | |
194 for i in ${LIB}; do \ | |
195 ${INSTALL_STATUS}; \ | |
196 if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL_LIB}; then \ | |
197 ${INSTALL_OK}; \ | |
198 else \ | |
199 ${INSTALL_FAILED}; \ | |
200 fi \ | |
201 done | |
202 | |
203 for i in ${STATIC_LIB}; do \ | |
204 ${INSTALL_STATUS}; \ | |
205 if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/$$i; then \ | |
206 ${INSTALL_OK}; \ | |
207 else \ | |
208 ${INSTALL_FAILED}; \ | |
209 fi \ | |
210 done | |
211 | |
212 for i in ${PLUGIN}; do \ | |
213 ${INSTALL_STATUS}; \ | |
214 if ${MKDIR_P} ${DESTDIR}${libdir}/${plugindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${libdir}/${plugindir}/$$i; then \ | |
215 ${INSTALL_OK}; \ | |
216 else \ | |
217 ${INSTALL_FAILED}; \ | |
218 fi \ | |
219 done | |
220 | |
221 for i in ${DATA}; do \ | |
222 ${INSTALL_STATUS}; \ | |
223 if ${MKDIR_P} ${DESTDIR}${datadir} && ${INSTALL} -m 644 $$i ${DESTDIR}${datadir}/${PACKAGE}/$$i; then \ | |
224 ${INSTALL_OK}; \ | |
225 else \ | |
226 ${INSTALL_FAILED}; \ | |
227 fi \ | |
228 done | |
229 | |
230 for i in ${PROG}; do \ | |
231 ${INSTALL_STATUS}; \ | |
232 if ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 -s $$i ${DESTDIR}${bindir}/$$i; then \ | |
233 ${INSTALL_OK}; \ | |
234 else \ | |
235 ${INSTALL_FAILED}; \ | |
236 fi \ | |
237 done | |
238 | |
239 for i in ${INCLUDES}; do \ | |
240 ${INSTALL_STATUS}; \ | |
241 if ${MKDIR_P} ${DESTDIR}${includedir}/${includesubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${includedir}/${includesubdir}/$$i; then \ | |
242 ${INSTALL_OK}; \ | |
243 else \ | |
244 ${INSTALL_FAILED}; \ | |
245 fi \ | |
246 done | |
247 | |
248 for i in ${MAN}; do \ | |
249 ${INSTALL_STATUS}; \ | |
250 if ${MKDIR_P} ${DESTDIR}${mandir}/${mansubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${mandir}/${mansubdir}/$$i; then \ | |
251 ${INSTALL_OK}; \ | |
252 else \ | |
253 ${INSTALL_FAILED}; \ | |
254 fi \ | |
255 done | |
256 | |
257 install-extra: | |
258 | |
259 uninstall: uninstall-extra | |
260 for i in ${SUBDIRS}; do \ | |
261 ${DIR_ENTER}; \ | |
262 ${MAKE} uninstall || exit 1; \ | |
263 ${DIR_LEAVE}; \ | |
264 done | |
265 | |
266 for i in ${LIB}; do \ | |
267 if [ -f ${DESTDIR}${libdir}/$$i ]; then \ | |
268 if ${UNINSTALL_LIB}; then \ | |
269 ${DELETE_OK}; \ | |
270 else \ | |
271 ${DELETE_FAILED}; \ | |
272 fi \ | |
273 fi; \ | |
274 done | |
275 | |
276 for i in ${STATIC_LIB}; do \ | |
277 if [ -f ${DESTDIR}${libdir}/$$i ]; then \ | |
278 if rm -f ${DESTDIR}${libdir}/$$i; then \ | |
279 ${DELETE_OK}; \ | |
280 else \ | |
281 ${DELETE_FAILED}; \ | |
282 fi \ | |
283 fi \ | |
284 done | |
285 | |
286 for i in ${PLUGIN}; do \ | |
287 if [ -f ${DESTDIR}${libdir}/${plugindir}/$$i ]; then \ | |
288 if rm -f ${DESTDIR}${libdir}/${plugindir}/$$i; then \ | |
289 ${DELETE_OK}; \ | |
290 else \ | |
291 ${DELETE_FAILED}; \ | |
292 fi \ | |
293 fi \ | |
294 done | |
295 -rmdir ${DESTDIR}${libdir}/${plugindir} >/dev/null 2>&1 | |
296 | |
297 for i in ${DATA}; do \ | |
298 if [ -f ${DESTDIR}${datadir}/${PACKAGE}/$$i ]; then \ | |
299 if rm -f ${DESTDIR}${datadir}/${PACKAGE}/$$i; then \ | |
300 ${DELETE_OK}; \ | |
301 else \ | |
302 ${DELETE_FAILED}; \ | |
303 fi \ | |
304 fi \ | |
305 done | |
306 | |
307 for i in ${PROG}; do \ | |
308 if [ -f ${DESTDIR}${bindir}/$$i ]; then \ | |
309 if rm -f ${DESTDIR}${bindir}/$$i; then \ | |
310 ${DELETE_OK}; \ | |
311 else \ | |
312 ${DELETE_FAILED}; \ | |
313 fi \ | |
314 fi \ | |
315 done | |
316 | |
317 for i in ${INCLUDES}; do \ | |
318 if [ -f ${DESTDIR}${includedir}/${includesubdir}/$$i ]; then \ | |
319 if rm -f ${DESTDIR}${includedir}/${includesubdir}/$$i; then \ | |
320 ${DELETE_OK}; \ | |
321 else \ | |
322 ${DELETE_FAILED}; \ | |
323 fi \ | |
324 fi \ | |
325 done | |
326 -rmdir ${DESTDIR}${includedir}/${includesubdir} >/dev/null 2>&1 | |
327 | |
328 for i in ${MAN}; do \ | |
329 if [ -f ${DESTDIR}${mandir}/${mansubdir}/$$i ]; then \ | |
330 if rm -f ${DESTDIR}${mandir}/${mansubdir}/$$i; then \ | |
331 ${DELETE_OK}; \ | |
332 else \ | |
333 ${DELETE_FAILED}; \ | |
334 fi \ | |
335 fi \ | |
336 done | |
337 | |
338 uninstall-extra: | |
339 | |
340 clean: | |
341 for i in ${SUBDIRS}; do \ | |
342 ${DIR_ENTER}; \ | |
343 ${MAKE} clean || exit 1; \ | |
344 ${DIR_LEAVE}; \ | |
345 done | |
346 | |
347 for i in ${OBJS} ${CLEAN} .deps *~; do \ | |
348 if [ -f $$i -o -d $$i ]; then \ | |
349 if rm -fr $$i; then \ | |
350 ${DELETE_OK}; \ | |
351 else \ | |
352 ${DELETE_FAILED}; \ | |
353 fi \ | |
354 fi \ | |
355 done | |
356 | |
357 distclean: clean | |
358 for i in ${SUBDIRS}; do \ | |
359 ${DIR_ENTER}; \ | |
360 ${MAKE} distclean || exit 1; \ | |
361 ${DIR_LEAVE}; \ | |
362 done | |
363 | |
364 for i in ${PROG} ${PROG_NOINST} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${DISTCLEAN}; do \ | |
365 if [ -f $$i -o -d $$i ]; then \ | |
366 if rm -fr $$i; then \ | |
367 ${DELETE_OK}; \ | |
368 else \ | |
369 ${DELETE_FAILED}; \ | |
370 fi \ | |
371 fi \ | |
372 done | |
373 | |
374 DIR_ENTER = printf "\033[0;36mEntering directory \033[1;36m$$i\033[0;36m.\033[0m\n"; cd $$i || exit 1 | |
375 DIR_LEAVE = printf "\033[0;36mLeaving directory \033[1;36m$$i\033[0;36m.\033[0m\n"; cd .. || exit 1 | |
376 LINK_STATUS = printf "\033[0;33mLinking \033[1;33m$@\033[0;33m...\033[0m\r" | |
377 LINK_OK = printf "\033[0;32mSuccessfully linked \033[1;32m$@\033[0;32m.\033[0m\n" | |
378 LINK_FAILED = printf "\033[0;31mFailed to link \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1 | |
379 COMPILE_STATUS = printf "\033[0;33mCompiling \033[1;33m$<\033[0;33m...\033[0m\r" | |
380 COMPILE_OK = printf "\033[0;32mSuccessfully compiled \033[1;32m$<\033[0;32m.\033[0m\n" | |
381 COMPILE_FAILED = printf "\033[0;31mFailed to compile \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1 | |
382 INSTALL_STATUS = printf "\033[0;33mInstalling \033[1;33m$$i\033[0;33m...\033[0m\r" | |
383 INSTALL_OK = printf "\033[0;32mSuccessfully installed \033[1;32m$$i\033[0;32m.\033[0m\n" | |
384 INSTALL_FAILED = printf "\033[0;31mFailed to install \033[1;31m$$i\033[0;31m!\033[0m\n"; exit 1 | |
385 DELETE_OK = printf "\033[0;34mDeleted \033[1;34m$$i\033[0;34m.\033[0m\n" | |
386 DELETE_FAILED = printf "\033[0;31mFailed to delete \033[1;31m$$i\033[0;31m!\033[0m\n"; exit 1 | |
387 | |
388 -include .deps |