86cbd3c70b03866d04aeb5f3dd3b71dfb8b2feab
[asterisk/asterisk.git] / utils / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Various utilities
5 #
6 # Copyright (C) 1999-2006, Digium
7 #
8 # Mark Spencer <markster@digium.com>
9 #
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
12 #
13
14 .PHONY: clean clean-depend all depend uninstall
15
16 UTILS:=astman smsq stereorize streamplayer aelparse muted
17
18 ifeq (${OSARCH},SunOS)
19   LIBS+=../main/strcompat.o -lsocket -lnsl
20 endif
21
22 ifeq ($(POPT_LIB),)
23   UTILS:=$(filter-out smsq,$(UTILS))
24 endif
25
26 ifeq ($(NEWT_LIB),)
27   UTILS:=$(filter-out astman,$(UTILS))
28 endif
29
30 ifneq ($(filter pbx_ael,$(MENUSELECT_PBX)),)
31   UTILS:=$(filter-out aelparse,$(UTILS))
32 endif
33
34 include $(ASTTOPDIR)/Makefile.rules
35
36 all: $(UTILS)
37
38 install:
39         for x in $(UTILS); do \
40                 if [ "$$x" != "none" ]; then \
41                         $(INSTALL) -m 755 $$x $(DESTDIR)$(ASTSBINDIR)/$$x; \
42                 fi; \
43         done 
44
45 uninstall:
46         for x in $(UTILS); do rm -f $$x $(DESTDIR)$(ASTSBINDIR)/$$x; done
47
48 clean-depend:
49         rm -f .depend
50
51 clean: clean-depend
52         rm -f *.o $(UTILS) check_expr
53
54 $(eval $(call ast_make_final,astman,astman.o ../main/md5.o))
55 astman: LIBS+=-lnewt -lslang -ldl
56
57 $(eval $(call ast_make_final,stereorize,stereorize.o frame.o))
58 stereorize: LIBS+=-lm
59
60 ../main/ast_expr2.c:
61         @echo "   [BISON] ../main/ast_expr2.y -> $@"
62         @bison -o $@ -d --name-prefix=ast_yy ../main/ast_expr2.y
63
64 ../main/ast_expr2f.c:
65         @echo "   [FLEX] ../main/ast_expr2.fl -> $@"
66         @flex -o $@ --full ../main/ast_expr2.fl
67
68 $(eval $(call ast_make_o_c,ast_expr2.o,../main/ast_expr2.c))
69
70 $(eval $(call ast_make_o_c,ast_expr2f.o,../main/ast_expr2f.c))
71 ast_expr2f.o: CFLAGS+=-DSTANDALONE_AEL
72
73 $(eval $(call ast_make_final,check_expr,check_expr.c ast_expr2.o ast_expr2f.o))
74
75 $(eval $(call ast_make_o_c,aelflex.o,../pbx/ael/ael_lex.c ../include/asterisk/ael_structs.h ../pbx/ael/ael.tab.h))
76 aelflex.o: CFLAGS+=-I../pbx -DSTANDALONE_AEL
77
78 $(eval $(call ast_make_o_c,aelbison.o,../pbx/ael/ael.tab.c ../pbx/ael/ael.tab.h ../include/asterisk/ael_structs.h))
79 aelbison.o: CFLAGS+=-I../pbx
80
81 $(eval $(call ast_make_o_c,pbx_ael.o,../pbx/pbx_ael.c))
82 pbx_ael.o: CFLAGS+=-DSTANDALONE_AEL
83
84 $(eval $(call ast_make_final,aelparse,aelflex.o aelbison.o pbx_ael.o ael_main.o ast_expr2f.o ast_expr2.o))
85
86 $(eval $(call ast_make_o_c,ael_main.o,ael_main.c ../include/asterisk/ael_structs.h))
87
88 testexpr2s: ../main/ast_expr2f.c ../main/ast_expr2.c ../main/ast_expr2.h
89         $(CC) -g -c -I../include -DSTANDALONE_AEL ../main/ast_expr2f.c -o ast_expr2f.o
90         $(CC) -g -c -I../include -DSTANDALONE_AEL ../main/ast_expr2.c -o ast_expr2.o
91         $(CC) -g -o testexpr2s ast_expr2f.o ast_expr2.o
92         rm ast_expr2.o ast_expr2f.o 
93         ./testexpr2s expr2.testinput
94
95 smsq: smsq.o
96 smsq: LIBS+=$(POPT_LIB)
97
98 streamplayer: streamplayer.o
99
100 muted: muted.o
101 muted: LIBS+=$(AUDIO_LIBS)
102
103 -include .depend
104
105 depend: .depend
106
107 .depend:
108         ../build_tools/mkdep $(CFLAGS) `ls *.c`