Many Solaris fixes - this moves some of the stuff from utils.c to strcompat.c
[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 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 $(eval $(call ast_make_o_c,strcompat.o,../main/strcompat.c))
61
62 ../main/ast_expr2.c:
63         @echo "   [BISON] ../main/ast_expr2.y -> $@"
64         @bison -o $@ -d --name-prefix=ast_yy ../main/ast_expr2.y
65
66 ../main/ast_expr2f.c:
67         @echo "   [FLEX] ../main/ast_expr2.fl -> $@"
68         @flex -o $@ --full ../main/ast_expr2.fl
69
70 $(eval $(call ast_make_o_c,ast_expr2.o,../main/ast_expr2.c))
71
72 $(eval $(call ast_make_o_c,ast_expr2f.o,../main/ast_expr2f.c))
73 ast_expr2f.o: CFLAGS+=-DSTANDALONE_AEL
74
75 $(eval $(call ast_make_final,check_expr,check_expr.c ast_expr2.o ast_expr2f.o))
76
77 $(eval $(call ast_make_o_c,aelflex.o,../pbx/ael/ael_lex.c ../include/asterisk/ael_structs.h ../pbx/ael/ael.tab.h))
78 aelflex.o: CFLAGS+=-I../pbx -DSTANDALONE_AEL
79
80 $(eval $(call ast_make_o_c,aelbison.o,../pbx/ael/ael.tab.c ../pbx/ael/ael.tab.h ../include/asterisk/ael_structs.h))
81 aelbison.o: CFLAGS+=-I../pbx
82
83 $(eval $(call ast_make_o_c,pbx_ael.o,../pbx/pbx_ael.c))
84 pbx_ael.o: CFLAGS+=-DSTANDALONE_AEL
85
86 $(eval $(call ast_make_final,aelparse,aelflex.o aelbison.o pbx_ael.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o))
87
88 $(eval $(call ast_make_o_c,ael_main.o,ael_main.c ../include/asterisk/ael_structs.h))
89
90 testexpr2s: ../main/ast_expr2f.c ../main/ast_expr2.c ../main/ast_expr2.h
91         $(CC) -g -c -I../include -DSTANDALONE_AEL ../main/ast_expr2f.c -o ast_expr2f.o
92         $(CC) -g -c -I../include -DSTANDALONE_AEL ../main/ast_expr2.c -o ast_expr2.o
93         $(CC) -g -o testexpr2s ast_expr2f.o ast_expr2.o
94         rm ast_expr2.o ast_expr2f.o 
95         ./testexpr2s expr2.testinput
96
97 smsq: smsq.o strcompat.o
98 smsq: LIBS+=$(POPT_LIB)
99
100 streamplayer: streamplayer.o
101
102 muted: muted.o
103 muted: LIBS+=$(AUDIO_LIBS)
104
105 ifneq ($(wildcard .depend),)
106   include .depend
107 endif
108
109 depend: .depend
110
111 .depend:
112         ../build_tools/mkdep $(CFLAGS) `ls *.c`