Merged revisions 43996-43997,44008,44011-44012 via svnmerge from
[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+=-lsocket -lnsl
20   UTILS:=$(filter-out muted,$(UTILS))
21 endif
22
23 ifeq ($(POPT_LIB),)
24   UTILS:=$(filter-out smsq,$(UTILS))
25 endif
26
27 ifeq ($(NEWT_LIB),)
28   UTILS:=$(filter-out astman,$(UTILS))
29 endif
30
31 ifneq ($(filter pbx_ael,$(MENUSELECT_PBX)),)
32   UTILS:=$(filter-out aelparse,$(UTILS))
33 endif
34
35 include $(ASTTOPDIR)/Makefile.rules
36
37 all: $(UTILS)
38
39 install:
40         for x in $(UTILS); do \
41                 if [ "$$x" != "none" ]; then \
42                         $(INSTALL) -m 755 $$x $(DESTDIR)$(ASTSBINDIR)/$$x; \
43                 fi; \
44         done 
45
46 uninstall:
47         for x in $(UTILS); do rm -f $$x $(DESTDIR)$(ASTSBINDIR)/$$x; done
48
49 clean-depend:
50         rm -f .depend
51
52 clean: clean-depend
53         rm -f *.o $(UTILS) check_expr
54
55 $(eval $(call ast_make_final,astman,astman.o ../main/md5.o))
56 astman: LIBS+=-lnewt -lslang -ldl
57
58 $(eval $(call ast_make_final,stereorize,stereorize.o frame.o))
59 stereorize: LIBS+=-lm
60
61 $(eval $(call ast_make_o_c,strcompat.o,../main/strcompat.c))
62
63 ../main/ast_expr2.c:
64         @echo "   [BISON] ../main/ast_expr2.y -> $@"
65         @bison -o $@ -d --name-prefix=ast_yy ../main/ast_expr2.y
66
67 ../main/ast_expr2f.c:
68         @echo "   [FLEX] ../main/ast_expr2.fl -> $@"
69         @flex -o $@ --full ../main/ast_expr2.fl
70
71 $(eval $(call ast_make_o_c,ast_expr2.o,../main/ast_expr2.c))
72
73 $(eval $(call ast_make_o_c,ast_expr2f.o,../main/ast_expr2f.c))
74 ast_expr2f.o: ASTCFLAGS+=-DSTANDALONE_AEL
75
76 $(eval $(call ast_make_final,check_expr,check_expr.c ast_expr2.o ast_expr2f.o))
77
78 $(eval $(call ast_make_o_c,aelflex.o,../pbx/ael/ael_lex.c ../include/asterisk/ael_structs.h ../pbx/ael/ael.tab.h))
79 aelflex.o: ASTCFLAGS+=-I../pbx -DSTANDALONE_AEL
80
81 $(eval $(call ast_make_o_c,aelbison.o,../pbx/ael/ael.tab.c ../pbx/ael/ael.tab.h ../include/asterisk/ael_structs.h))
82 aelbison.o: ASTCFLAGS+=-I../pbx
83
84 $(eval $(call ast_make_o_c,pbx_ael.o,../pbx/pbx_ael.c))
85 pbx_ael.o: ASTCFLAGS+=-DSTANDALONE_AEL
86
87 $(eval $(call ast_make_final,aelparse,aelflex.o aelbison.o pbx_ael.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o))
88
89 $(eval $(call ast_make_o_c,ael_main.o,ael_main.c ../include/asterisk/ael_structs.h))
90
91 testexpr2s: ../main/ast_expr2f.c ../main/ast_expr2.c ../main/ast_expr2.h
92         $(CC) -g -c -I../include -DSTANDALONE_AEL ../main/ast_expr2f.c -o ast_expr2f.o
93         $(CC) -g -c -I../include -DSTANDALONE_AEL ../main/ast_expr2.c -o ast_expr2.o
94         $(CC) -g -o testexpr2s ast_expr2f.o ast_expr2.o
95         rm ast_expr2.o ast_expr2f.o 
96         ./testexpr2s expr2.testinput
97
98 smsq: smsq.o strcompat.o
99 smsq: LIBS+=$(POPT_LIB)
100
101 streamplayer: streamplayer.o
102
103 muted: muted.o
104 muted: LIBS+=$(AUDIO_LIBS)
105
106 ifneq ($(wildcard .depend),)
107   include .depend
108 endif
109
110 depend: .depend
111
112 .depend:
113         ../build_tools/mkdep $(ASTCFLAGS) `ls *.c`