Thanks to the fine work of Russell Bryant and Dancho Lazarov, we now have autoconf...
[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 #
15 # Don't use ast mm routines
16 #
17 UTILS:=astman smsq stereorize streamplayer
18
19 ifeq (${OSARCH},SunOS)
20   SOL=../strcompat.o
21   SOLLIBS=-lsocket -lnsl
22 endif
23
24 ifeq ($(POPT_LIB),)
25   UTILS:=$(filter-out smsq,$(UTILS))
26 endif
27
28 ifeq ($(NEWT_LIB),)
29   UTILS:=$(filter-out astman,$(UTILS))
30 endif
31
32 all: depend $(UTILS)
33
34 install:
35         for x in $(UTILS); do \
36                 if [ "$$x" != "none" ]; then \
37                         $(INSTALL) -m 755 $$x $(DESTDIR)$(ASTSBINDIR)/$$x; \
38                 fi; \
39         done 
40
41 uninstall:
42         for x in $(TARGET); do rm -f $$x $(DESTDIR)$(ASTSBINDIR)/$$x; done
43
44 clean-depend:
45         rm -f .depend
46
47 clean: clean-depend
48         rm -f *.o $(TARGET) check_expr
49         rm -f ast_expr2.o ast_expr2f.o
50
51 astman.o: astman.c
52         $(CC) $(CFLAGS) -include ../include/autoconfig.h -c -o $@ $<
53
54 astman: astman.o ../md5.o
55         $(CC) -D_GNU_SOURCE -o $@ $< ../md5.o -lnewt
56
57 stereorize: stereorize.o frame.o
58         $(CC) $(CFLAGS) -o stereorize stereorize.o frame.o -lm
59
60 ast_expr2.o: ../ast_expr2.c
61         gcc -g -c -o $@ $<
62
63 ast_expr2f.o: ../ast_expr2f.c
64         gcc -g -c -DSTANDALONE -o $@ $<
65
66 check_expr: check_expr.c ast_expr2.o ast_expr2f.o
67         $(CC) $(CFLAGS) -o $@ $^
68
69 smsq.o: smsq.c
70         $(CC) $(CFLAGS) -include ../include/autoconfig.h -c -o $@ $<
71
72 smsq: smsq.o
73         $(CC) $(CFLAGS) -o smsq ${SOL} smsq.o -lpopt
74
75 streamplayer: streamplayer.o
76         $(CC) $(CFLAGS) -o streamplayer ${SOL} streamplayer.o ${SOLLIBS}
77
78 ifneq ($(wildcard .depend),)
79   include .depend
80 endif
81
82 depend: .depend
83
84 .depend:
85         ../build_tools/mkdep $(CFLAGS) `ls *.c`
86