Fix build of CVS head on Solaris (bug #5527)
[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 ifeq ($(findstring BSD,${OSARCH}),BSD)
20   CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
21 endif
22
23 TARGET=stereorize streamplayer
24
25 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/popt.h)$(wildcard -f $(CROSS_COMPILE_TARGET)/usr/local/include/popt.h),)
26   TARGET+=smsq
27 endif
28
29 ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/newt.h)$(wildcard -f $(CROSS_COMPILE_TARGET)/usr/local/include/newt.h),)
30   TARGET+=astman
31 endif
32
33 ifeq (${OSARCH},SunOS)
34   SOL=../strcompat.o
35   SOLLIBS=-lsocket -lnsl
36 endif
37
38 all: depend $(TARGET)
39
40 install:
41         for x in $(TARGET); do \
42                 if [ "$$x" != "none" ]; then \
43                         $(INSTALL) -m 755 $$x $(DESTDIR)$(ASTSBINDIR)/$$x; \
44                 fi; \
45         done 
46
47 clean:
48         rm -f *.o astman smsq stereorize streamplayer check_expr .depend
49         rm -f ast_expr2.o ast_expr2f.o
50
51 astman: astman.o ../md5.o
52         $(CC) $(CFLAGS) -o astman astman.o ../md5.o -lnewt
53
54 stereorize: stereorize.o frame.o
55         $(CC) $(CFLAGS) -o stereorize stereorize.o frame.o -lm
56
57 ast_expr2.o: ../ast_expr2.c
58         gcc -g -c -o $@ $<
59
60 ast_expr2f.o: ../ast_expr2f.c
61         gcc -g -c -DSTANDALONE -o $@ $<
62
63 check_expr: check_expr.c ast_expr2.o ast_expr2f.o
64         $(CC) $(CFLAGS) -o $@ $^
65
66 smsq: smsq.o
67         $(CC) $(CFLAGS) -o smsq ${SOL} smsq.o -lpopt
68
69 streamplayer: streamplayer.o
70         $(CC) $(CFLAGS) -o streamplayer ${SOL} streamplayer.o ${SOLLIBS}
71
72 ifneq ($(wildcard .depend),)
73   include .depend
74 endif
75
76 depend: .depend
77
78 .depend:
79         ../build_tools/mkdep $(CFLAGS) `ls *.c`
80