make the build output less noisy (optional, can be controlled by the NOISY_BUILD...
[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
17
18 ifeq (${OSARCH},SunOS)
19   LDFLAGS+=../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 astman: astman.o ../md5.o
55 astman: LDFLAGS+=-lnewt
56
57 stereorize: stereorize.o frame.o
58 stereorize: LDFLAGS+=-lm
59
60 ../ast_expr2.c:
61         @echo "   [BISON] ../ast_expr2.y -> $@"
62         @bison -o $@ -d --name-prefix=ast_yy ../ast_expr2.y
63
64 ../ast_expr2f.c:
65         @echo "   [FLEX] ../ast_expr2.fl -> $@"
66         @flex -o $@ --full ../ast_expr2.fl
67
68 $(eval $(call ast_make_o_c,ast_expr2.o,../ast_expr2.c))
69
70 $(eval $(call ast_make_o_c,ast_expr2f.o,../ast_expr2f.c))
71 ast_expr2f.o: CFLAGS+=-DSTANDALONE
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
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
83 $(eval $(call ast_make_final,aelparse,aelflex.o aelbison.o pbx_ael.o ael_main.o ast_expr2f.o ast_expr2.o))
84
85 $(eval $(call ast_make_o_c,ael_main.o,ael_main.c ../include/asterisk/ael_structs.h))
86
87 testexpr2s: ../ast_expr2f.c ../ast_expr2.c ../ast_expr2.h
88         $(CC) -g -c -I../include -DSTANDALONE ../ast_expr2f.c -o ast_expr2f.o
89         $(CC) -g -c -I../include -DSTANDALONE ../ast_expr2.c -o ast_expr2.o
90         $(CC) -g -o testexpr2s ast_expr2f.o ast_expr2.o
91         rm ast_expr2.o ast_expr2f.o 
92         ./testexpr2s expr2.testinput
93
94 smsq: smsq.o
95 smsq: LDFLAGS+=-lpopt
96
97 streamplayer: streamplayer.o
98
99 ifneq ($(wildcard .depend),)
100   include .depend
101 endif
102
103 depend: .depend
104
105 .depend:
106         ../build_tools/mkdep $(CFLAGS) `ls *.c`
107