Merge another change from team/russell/events ...
[asterisk-bristuff.git] / utils / Makefile
blobd84907710c32985a6be66dede46303733736f3ba
2 # Asterisk -- A telephony toolkit for Linux.
3 #
4 # Various utilities
6 # Copyright (C) 1999-2006, Digium
8 # Mark Spencer <markster@digium.com>
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
14 ASTTOPDIR?=..
15 -include $(ASTTOPDIR)/menuselect.makeopts
17 .PHONY: clean all uninstall
19 # to get check_expr, add it to the ALL_UTILS list
20 ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted check_expr conf2ael hashtest2 hashtest astcanary refcounter
21 UTILS:=$(ALL_UTILS)
23 LIBS += $(BKTR_LIB) # astobj2 with devmode uses backtrace
25 include $(ASTTOPDIR)/Makefile.rules
27 ifeq ($(OSARCH),SunOS)
28 LIBS+=-lsocket -lnsl
29 UTILS:=$(filter-out muted,$(UTILS))
30 endif
32 ifeq ($(OSARCH),OpenBSD)
33 UTILS:=$(filter-out muted,$(UTILS))
34 endif
36 ifeq ($(OSARCH),cygwin)
37 UTILS:=$(filter-out muted,$(UTILS))
38 endif
40 ifeq ($(OSARCH),mingw32)
41 UTILS:=
42 endif
44 ifneq ($(findstring darwin,$(OSARCH)),)
45 AUDIO_LIBS=-framework CoreAudio
46 endif
48 ifeq ($(POPT_LIB),)
49 UTILS:=$(filter-out smsq,$(UTILS))
50 endif
52 ifeq ($(NEWT_LIB),)
53 UTILS:=$(filter-out astman,$(UTILS))
54 endif
56 ifneq ($(filter pbx_ael,$(MENUSELECT_PBX)),)
57 UTILS:=$(filter-out aelparse,$(UTILS))
58 UTILS:=$(filter-out conf2ael,$(UTILS))
59 endif
61 all: $(UTILS)
63 install:
64 for x in $(UTILS); do \
65 if [ "$$x" != "none" ]; then \
66 $(INSTALL) -m 755 $$x $(DESTDIR)$(ASTSBINDIR)/$$x; \
67 fi; \
68 done
70 uninstall:
71 for x in $(ALL_UTILS); do rm -f $$x $(DESTDIR)$(ASTSBINDIR)/$$x; done
73 clean:
74 rm -f *.o $(ALL_UTILS) check_expr
75 rm -f .*.o.d .*.oo.d
76 rm -f *.s *.i
77 rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c pval.c hashtab.c
78 rm -f aelparse.c aelbison.c conf2ael
79 rm -f utils.c threadstorage.c sha1.c astobj2.c hashtest2 hashtest refcounter
81 md5.c: $(ASTTOPDIR)/main/md5.c
82 @cp $< $@
83 astman.o: astman.i
84 astman: astman.o md5.o
85 astman: LIBS+=$(NEWT_LIB)
87 stereorize: stereorize.o frame.o
88 stereorize: LIBS+=-lm
90 hashtab.c: $(ASTTOPDIR)/main/hashtab.c
91 @cp $< $@
93 strcompat.c: $(ASTTOPDIR)/main/strcompat.c
94 @cp $< $@
96 $(ASTTOPDIR)/main/ast_expr2.c:
97 @echo " [BISON] $(ASTTOPDIR)/main/ast_expr2.y -> $@"
98 @bison -o $@ -d --name-prefix=ast_yy $(ASTTOPDIR)/main/ast_expr2.y
100 $(ASTTOPDIR)/main/ast_expr2f.c:
101 @echo " [FLEX] $(ASTTOPDIR)/main/ast_expr2.fl -> $@"
102 @flex -o $@ --full $(ASTTOPDIR)/main/ast_expr2.fl
104 pval.c: $(ASTTOPDIR)/res/ael/pval.c
105 @cp $< $@
107 ast_expr2.c: $(ASTTOPDIR)/main/ast_expr2.c
108 @cp $< $@
110 ast_expr2f.c: $(ASTTOPDIR)/main/ast_expr2f.c
111 @cp $< $@
113 ast_expr2f.o: ASTCFLAGS+=-DSTANDALONE_AEL -I$(ASTTOPDIR)/main -Wno-unused
115 pval.o : ASTCFLAGS+=-DSTANDALONE
117 check_expr: check_expr.o ast_expr2.o ast_expr2f.o strcompat.o threadstorage.o clicompat.o
119 aelbison.c: $(ASTTOPDIR)/res/ael/ael.tab.c
120 @cp $< $@
122 aelbison.o: ASTCFLAGS+=-I$(ASTTOPDIR)/res/ael -DYYENABLE_NLS=0
124 pbx_ael.c: $(ASTTOPDIR)/pbx/pbx_ael.c
125 @cp $< $@
127 pbx_ael.o: ASTCFLAGS+=-DSTANDALONE_AEL
129 aelparse.c: $(ASTTOPDIR)/res/ael/ael_lex.c
130 @cp $< $@
132 aelparse.o: ASTCFLAGS+=-I$(ASTTOPDIR)/res -DSTANDALONE_AEL -Wno-unused
134 aelparse: aelparse.o aelbison.o pbx_ael.o hashtab.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o pval.o extconf.o
136 astobj2.c: $(ASTTOPDIR)/main/astobj2.c
137 @cp $< $@
139 utils.c: $(ASTTOPDIR)/main/utils.c
140 @cp $< $@
142 sha1.c: $(ASTTOPDIR)/main/sha1.c
143 @cp $< $@
145 threadstorage.c: $(ASTTOPDIR)/main/threadstorage.c
146 @cp $< $@
148 hashtest2.o: ASTCFLAGS+=-O0
150 hashtest2: hashtest2.o md5.o utils.o astobj2.o sha1.o strcompat.o threadstorage.o clicompat.o
152 hashtest: hashtest.o md5.o hashtab.o utils.o sha1.o strcompat.o threadstorage.o clicompat.o
154 hashtest.o: ASTCFLAGS+=-O0
156 refcounter: refcounter.o md5.o hashtab.o utils.o sha1.o strcompat.o threadstorage.o clicompat.o
158 refcounter.o: ASTCFLAGS+=-O0
160 extconf.o: extconf.c
162 conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o hashtab.o aelbison.o aelparse.o pbx_ael.o pval.o extconf.o strcompat.o
164 testexpr2s: $(ASTTOPDIR)/main/ast_expr2f.c $(ASTTOPDIR)/main/ast_expr2.c $(ASTTOPDIR)/main/ast_expr2.h
165 $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE_AEL $(ASTTOPDIR)/main/ast_expr2f.c -o ast_expr2f.o
166 $(CC) -g -c -I$(ASTTOPDIR)/include -DSTANDALONE_AEL $(ASTTOPDIR)/main/ast_expr2.c -o ast_expr2.o
167 $(CC) -g -o testexpr2s ast_expr2f.o ast_expr2.o
168 rm ast_expr2.o ast_expr2f.o
169 ./testexpr2s expr2.testinput
171 smsq: smsq.o strcompat.o
172 smsq: LIBS+=$(POPT_LIB)
174 streamplayer: streamplayer.o
176 muted: muted.o
177 muted: LIBS+=$(AUDIO_LIBS)
179 ifneq ($(wildcard .*.d),)
180 include .*.d
181 endif