2
# Copyright (c) 2007, Jonathan Schleifer <js@h3c.de>
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.
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.
34
ERLCFLAGS = @ERLCFLAGS@
35
OBJCFLAGS = @OBJCFLAGS@
38
PROG_IMPLIB_NEEDED = @PROG_IMPLIB_NEEDED@
39
PROG_IMPLIB_LDFLAGS = @PROG_IMPLIB_LDFLAGS@
40
PROG_SUFFIX = @EXEEXT@
41
LIB_CPPFLAGS = @LIB_CPPFLAGS@
42
LIB_CFLAGS = @LIB_CFLAGS@
43
LIB_LDFLAGS = @LIB_LDFLAGS@
44
LIB_PREFIX = @LIB_PREFIX@
45
LIB_SUFFIX = @LIB_SUFFIX@
46
PLUGIN_CPPFLAGS = @PLUGIN_CPPFLAGS@
47
PLUGIN_CFLAGS = @PLUGIN_CFLAGS@
48
PLUGIN_LDFLAGS = @PLUGIN_LDFLAGS@
49
PLUGIN_SUFFIX = @PLUGIN_SUFFIX@
50
INSTALL_LIB = @INSTALL_LIB@
51
UNINSTALL_LIB = @UNINSTALL_LIB@
52
CLEAN_LIB = @CLEAN_LIB@
58
exec_prefix = @exec_prefix@
61
plugindir ?= ${libdir}/${PACKAGE}
62
datarootdir = @datarootdir@
64
includedir = @includedir@
65
includesubdir ?= ${PACKAGE}
70
OBJS2 = ${OBJS1:.cc=.o}
71
OBJS3 = ${OBJS2:.cxx=.o}
72
OBJS4 = ${OBJS3:.d=.o}
73
OBJS5 = ${OBJS4:.erl=.beam}
74
OBJS += ${OBJS5:.m=.o}
77
.SUFFIXES: .beam .c .cc .cxx .d .erl .m
78
.PHONY: all subdirs pre-depend depend install install-extra uninstall uninstall-extra clean distclean
81
for i in subdirs depend ${STATIC_LIB} ${STATIC_LIB_NOINST} ${LIB} ${LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${PROG} ${PROG_NOINST}; do \
82
${MAKE} ${MFLAGS} $$i || exit 1; \
86
for i in ${SUBDIRS}; do \
88
${MAKE} ${MFLAGS} || exit 1; \
92
depend: pre-depend ${SRCS}
94
test -f .deps || regen=1; \
95
for i in ${SRCS}; do test $$i -nt .deps && regen=1; done; \
96
if test x"$$regen" = x"1"; then \
99
for i in ${SRCS}; do \
106
if test x"$$list" != "x"; then \
107
if ${CPP} ${CPPFLAGS} -M $$list >.deps; then \
117
${PROG} ${PROG_NOINST}: ${EXT_DEPS} ${OBJS}
119
if ${LD} -o $@ ${OBJS} ${LDFLAGS} ${LIBS}; then \
125
${LIB} ${LIB_NOINST}: ${EXT_DEPS} ${OBJS}
127
if ${LD} -o $@ ${OBJS} ${LIB_LDFLAGS} ${LDFLAGS} ${LIBS}; then \
133
${PLUGIN} ${PLUGIN_NONST}: ${EXT_DEPS} ${OBJS}
135
if ${LD} -o $@ ${OBJS} ${PLUGIN_LDFLAGS} ${LDFLAGS} ${LIBS}; then \
141
${STATIC_LIB} ${STATIC_LIB_NOINST}: ${EXT_DEPS} ${OBJS}
143
if ${AR} cr $@ ${OBJS}; then \
151
if ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<; then \
159
if ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c -o $@ $<; then \
167
if test x"$(basename ${DC})" = x"dmd"; then \
168
if ${DC} ${DFLAGS} -c -of$@ $<; then \
174
if ${DC} ${DFLAGS} -c -o $@ $<; then \
183
if ${ERLC} ${ERLCFLAGS} -o $@ $<; then \
191
if ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c -o $@ $<; then \
197
install: ${LIB} ${STATIC_LIB} ${PLUGIN} ${PROG} install-extra
198
for i in ${SUBDIRS}; do \
200
${MAKE} ${MFLAGS} install || exit 1; \
204
for i in ${LIB}; do \
206
if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL_LIB}; then \
213
for i in ${STATIC_LIB}; do \
215
if ${MKDIR_P} ${DESTDIR}${libdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${libdir}/$$i; then \
222
for i in ${PLUGIN}; do \
224
if ${MKDIR_P} ${DESTDIR}${plugindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${plugindir}/$$i; then \
231
for i in ${DATA}; do \
233
if ${MKDIR_P} $$(dirname ${DESTDIR}${datadir}/${PACKAGE}/$$i) && ${INSTALL} -m 644 $$i ${DESTDIR}${datadir}/${PACKAGE}/$$i; then \
240
for i in ${PROG}; do \
242
if ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i; then \
249
for i in ${INCLUDES}; do \
251
if ${MKDIR_P} ${DESTDIR}${includedir}/${includesubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${includedir}/${includesubdir}/$$i; then \
258
for i in ${MAN}; do \
260
if ${MKDIR_P} ${DESTDIR}${mandir}/${mansubdir} && ${INSTALL} -m 644 $$i ${DESTDIR}${mandir}/${mansubdir}/$$i; then \
269
uninstall: uninstall-extra
270
for i in ${SUBDIRS}; do \
272
${MAKE} ${MFLAGS} uninstall || exit 1; \
276
for i in ${LIB}; do \
277
if test -f ${DESTDIR}${libdir}/$$i; then \
278
if ${UNINSTALL_LIB}; then \
286
for i in ${STATIC_LIB}; do \
287
if test -f ${DESTDIR}${libdir}/$$i; then \
288
if rm -f ${DESTDIR}${libdir}/$$i; then \
296
for i in ${PLUGIN}; do \
297
if test -f ${DESTDIR}${plugindir}/$$i; then \
298
if rm -f ${DESTDIR}${plugindir}/$$i; then \
305
-rmdir ${DESTDIR}${plugindir} >/dev/null 2>&1
307
for i in ${DATA}; do \
308
if test -f ${DESTDIR}${datadir}/${PACKAGE}/$$i; then \
309
if rm -f ${DESTDIR}${datadir}/${PACKAGE}/$$i; then \
317
for i in ${PROG}; do \
318
if test -f ${DESTDIR}${bindir}/$$i; then \
319
if rm -f ${DESTDIR}${bindir}/$$i; then \
327
for i in ${INCLUDES}; do \
328
if test -f ${DESTDIR}${includedir}/${includesubdir}/$$i; then \
329
if rm -f ${DESTDIR}${includedir}/${includesubdir}/$$i; then \
336
-rmdir ${DESTDIR}${includedir}/${includesubdir} >/dev/null 2>&1
338
for i in ${MAN}; do \
339
if test -f ${DESTDIR}${mandir}/${mansubdir}/$$i; then \
340
if rm -f ${DESTDIR}${mandir}/${mansubdir}/$$i; then \
351
for i in ${SUBDIRS}; do \
353
${MAKE} ${MFLAGS} clean || exit 1; \
357
for i in ${OBJS} ${CLEAN} ${CLEAN_LIB} .deps; do \
358
if test -f $$i -o -d $$i; then \
359
if rm -fr $$i; then \
368
for i in ${SUBDIRS}; do \
370
${MAKE} ${MFLAGS} distclean || exit 1; \
374
for i in ${PROG} ${PROG_NOINST} ${LIB} ${LIB_NOINST} ${STATIC_LIB} ${STATIC_LIB_NOINST} ${PLUGIN} ${PLUGIN_NOINST} ${DISTCLEAN} *~; do \
375
if test -f $$i -o -d $$i; then \
376
if rm -fr $$i; then \
384
DIR_ENTER = printf "\033[K\033[0;36mEntering directory \033[1;36m$$i\033[0;36m.\033[0m\n"; cd $$i || exit 1
385
DIR_LEAVE = printf "\033[K\033[0;36mLeaving directory \033[1;36m$$i\033[0;36m.\033[0m\n"; cd .. || exit 1
386
DEPEND_STATUS = printf "\033[K\033[0;33mGenerating dependencies...\033[0m\r"
387
DEPEND_OK = printf "\033[K\033[0;32mSuccessfully generated dependencies.\033[0m\n"
388
DEPEND_FAILED = printf "\033[K\033[0;31mFailed to generate dependencies!\033[0m\n"; exit 1
389
COMPILE_STATUS = printf "\033[K\033[0;33mCompiling \033[1;33m$<\033[0;33m...\033[0m\r"
390
COMPILE_OK = printf "\033[K\033[0;32mSuccessfully compiled \033[1;32m$<\033[0;32m.\033[0m\n"
391
COMPILE_FAILED = printf "\033[K\033[0;31mFailed to compile \033[1;31m$<\033[0;31m!\033[0m\n"; exit 1
392
LINK_STATUS = printf "\033[K\033[0;33mLinking \033[1;33m$@\033[0;33m...\033[0m\r"
393
LINK_OK = printf "\033[K\033[0;32mSuccessfully linked \033[1;32m$@\033[0;32m.\033[0m\n"
394
LINK_FAILED = printf "\033[K\033[0;31mFailed to link \033[1;31m$@\033[0;31m!\033[0m\n"; exit 1
395
INSTALL_STATUS = printf "\033[K\033[0;33mInstalling \033[1;33m$$i\033[0;33m...\033[0m\r"
396
INSTALL_OK = printf "\033[K\033[0;32mSuccessfully installed \033[1;32m$$i\033[0;32m.\033[0m\n"
397
INSTALL_FAILED = printf "\033[K\033[0;31mFailed to install \033[1;31m$$i\033[0;31m!\033[0m\n"; exit 1
398
DELETE_OK = printf "\033[K\033[0;34mDeleted \033[1;34m$$i\033[0;34m.\033[0m\n"
399
DELETE_FAILED = printf "\033[K\033[0;31mFailed to delete \033[1;31m$$i\033[0;31m!\033[0m\n"; exit 1