Allows for user to uninstall asterisk binaries
[asterisk/asterisk.git] / utils / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Various utilities
5 #
6 # Copyright (C) 1999-2005, 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 #
15 # Don't use ast mm routines
16 #
17 CFLAGS+=-DNO_AST_MM
18
19 TARGET=stereorize streamplayer
20
21 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/popt.h)$(wildcard -f $(CROSS_COMPILE_TARGET)/usr/local/include/popt.h),)
22   TARGET+=smsq
23 endif
24
25 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/newt.h)$(wildcard -f $(CROSS_COMPILE_TARGET)/usr/local/include/newt.h),)
26   TARGET+=astman
27 endif
28
29 ifeq (${OSARCH},SunOS)
30   SOL=../strcompat.o
31   SOLLIBS=-lsocket -lnsl
32 endif
33
34 all: depend $(TARGET)
35
36 install:
37         for x in $(TARGET); do \
38                 if [ "$$x" != "none" ]; then \
39                         $(INSTALL) -m 755 $$x $(DESTDIR)$(ASTSBINDIR)/$$x; \
40                 fi; \
41         done 
42
43 uninstall:
44         for x in $(TARGET); do rm -f $$x $(DESTDIR)$(ASTSBINDIR)/$$x; done
45
46 clean:
47         rm -f *.o astman smsq stereorize streamplayer check_expr .depend
48         rm -f ast_expr2.o ast_expr2f.o
49
50 astman: astman.o ../md5.o
51         $(CC) $(CFLAGS) -o astman astman.o ../md5.o -lnewt
52
53 stereorize: stereorize.o frame.o
54         $(CC) $(CFLAGS) -o stereorize stereorize.o frame.o -lm
55
56 ast_expr2.o: ../ast_expr2.c
57         gcc -g -c -o $@ $<
58
59 ast_expr2f.o: ../ast_expr2f.c
60         gcc -g -c -DSTANDALONE -o $@ $<
61
62 check_expr: check_expr.c ast_expr2.o ast_expr2f.o
63         $(CC) $(CFLAGS) -o $@ $^
64
65 smsq: smsq.o
66         $(CC) $(CFLAGS) -o smsq ${SOL} smsq.o -lpopt
67
68 streamplayer: streamplayer.o
69         $(CC) $(CFLAGS) -o streamplayer ${SOL} streamplayer.o ${SOLLIBS}
70
71 ifneq ($(wildcard .depend),)
72   include .depend
73 endif
74
75 depend: .depend
76
77 .depend:
78         ../build_tools/mkdep $(CFLAGS) `ls *.c`
79