2 # Asterisk -- A telephony toolkit for Linux.
4 # Makefile for dialplan functions
6 # Copyright (C) 2005, Digium
8 # Kevin P. Fleming <kpfleming@digium.com>
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
14 FUNCS=pbx_functions.so
28 STANDALONE_FUNCS=$(filter-out $(BUILTINS),$(patsubst %.c,%.o,$(wildcard func*.c)))
30 FUNCS+=$(STANDALONE_FUNCS:.o=.so)
32 FUNC_SOURCES=$(BUILTINS:.o=.c)
34 FUNC_STRUCTS=$(shell grep 'struct ast_custom_function' $(FUNC_SOURCES) | awk '{print $$3};')
36 ifeq (${OSARCH},CYGWIN)
37 CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
38 CYGSOLIB=-L.. -L. -lasterisk.dll
43 ifeq ($(findstring BSD,${OSARCH}),BSD)
44 CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
50 rm -f *.so *.o .depend pbx_functions.h
53 $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
55 #$(BUILTINS) : CFLAGS += -DBUILTIN_FUNC
57 pbx_functions.h: $(FUNC_SOURCES)
58 @echo "/* Automatically generated - do not edit */" > $@
59 @for f in $(FUNC_SOURCES); do echo "#include \"$$f\"" >> $@; done
60 @echo "static struct ast_custom_function *builtins[] = {" >> $@
61 @for f in $(FUNC_STRUCTS); do echo "&$$f," >> $@; done
64 pbx_functions.o: pbx_functions.h
66 pbx_functions.so: pbx_functions.o #$(BUILTINS)
67 $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
69 func_odbc.so: func_odbc.o
70 $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc
73 for x in $(FUNCS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
75 ifneq ($(wildcard .depend),)
81 .depend: pbx_functions.h
82 ../build_tools/mkdep $(CFLAGS) `ls *.c`