ensure that dependencies are rebuilt after 'make update' so that builds don't break...
[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-depend:
47         rm -f .depend
48
49 clean: clean-depend
50         rm -f *.o astman smsq stereorize streamplayer check_expr
51         rm -f ast_expr2.o ast_expr2f.o
52
53 astman: astman.o ../md5.o
54         $(CC) $(CFLAGS) -o astman astman.o ../md5.o -lnewt
55
56 stereorize: stereorize.o frame.o
57         $(CC) $(CFLAGS) -o stereorize stereorize.o frame.o -lm
58
59 ast_expr2.o: ../ast_expr2.c
60         gcc -g -c -o $@ $<
61
62 ast_expr2f.o: ../ast_expr2f.c
63         gcc -g -c -DSTANDALONE -o $@ $<
64
65 check_expr: check_expr.c ast_expr2.o ast_expr2f.o
66         $(CC) $(CFLAGS) -o $@ $^
67
68 smsq: smsq.o
69         $(CC) $(CFLAGS) -o smsq ${SOL} smsq.o -lpopt
70
71 streamplayer: streamplayer.o
72         $(CC) $(CFLAGS) -o streamplayer ${SOL} streamplayer.o ${SOLLIBS}
73
74 ifneq ($(wildcard .depend),)
75   include .depend
76 endif
77
78 depend: .depend
79
80 .depend:
81         ../build_tools/mkdep $(CFLAGS) `ls *.c`
82