Version 0.1.7 from FTP
[asterisk/asterisk.git] / Makefile
1 #
2 # Asterisk -- A telephony toolkit for Linux.
3
4 # Top level Makefile
5 #
6 # Copyright (C) 1999, Mark Spencer
7 #
8 # Mark Spencer <markster@linux-support.net>
9 #
10 # This program is free software, distributed under the terms of
11 # the GNU General Public License
12 #
13
14
15 .EXPORT_ALL_VARIABLES:
16
17 MODULES_DIR=/usr/lib/asterisk/modules
18
19 # Pentium Pro Optimize
20 #PROC=i686
21 # Pentium Optimize
22 PROC=i586
23
24 DEBUG=-g #-pg
25 INCLUDE=-Iinclude -I../include
26 CFLAGS=-pipe -Wall -Werror -Wmissing-prototypes -Wmissing-declarations -fomit-frame-pointer -O6 $(DEBUG) $(INCLUDE) -D_REENTRANT
27 CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
28 CFLAGS += -DDO_CRASH
29 SUBDIRS=channels pbx apps codecs formats
30 LIBS=-ldl -lpthread -lreadline -lncurses -lm # -lefence
31 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
32         translate.o file.o say.o pbx.o cli.o md5.o \
33         ulaw.o callerid.o fskmodem.o asterisk.o 
34 CC=gcc
35 INSTALL=install
36
37 _all: all
38         @echo " +--------- Asterisk Build Complete ---------+"  
39         @echo " + Asterisk has successfully been built, but +"  
40         @echo " + cannot be run before being installed by   +"  
41         @echo " + running:                                  +"  
42         @echo " +                                           +"
43         @echo " +               make install                +"  
44         @echo " +                                           +"
45         @echo " +-------------------------------------------+"  
46
47 all: asterisk subdirs
48
49 asterisk: $(OBJS)
50         gcc -o asterisk -rdynamic $(OBJS) $(LIBS)
51
52 subdirs: 
53         for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done
54
55 clean:
56         for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
57         rm -f *.o *.so asterisk
58
59 datafiles: all
60         mkdir -p /var/lib/asterisk/sounds/digits
61         for x in sounds/digits/*; do \
62                 install $$x /var/lib/asterisk/sounds/digits ; \
63         done
64         for x in sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-*; do \
65                 install $$x /var/lib/asterisk/sounds ; \
66         done
67 install: all datafiles
68         mkdir -p $(MODULES_DIR)
69         for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
70         install -d /usr/include/asterisk
71         install include/asterisk/*.h /usr/include/asterisk
72         rm -f /var/lib/asterisk/sounds/vm
73         mkdir -p /var/spool/asterisk/vm
74         rm -f /usr/lib/asterisk/modules/chan_ixj.so
75         mkdir -p /var/lib/asterisk/sounds
76         ( cd /var/lib/asterisk/sounds  ; ln -s ../../../spool/asterisk/vm . )
77         @echo " +---- Asterisk Installation Complete -------+"  
78         @echo " + Asterisk has successfully been installed. +"  
79         @echo " + If you would like to install the sample   +"  
80         @echo " + configuration files (overwriting any      +"
81         @echo " + existing config files), run:              +"  
82         @echo " +                                           +"
83         @echo " +               make samples                +"
84         @echo " +                                           +"
85         @echo " +-------------------------------------------+"  
86
87 samples: all datafiles
88         mkdir -p /etc/asterisk
89         for x in configs/*.sample; do \
90                 if [ -f /etc/asterisk/`basename $$x .sample` ]; then \
91                         mv -f /etc/asterisk/`basename $$x .sample` /etc/asterisk/`basename $$x .sample`.old ; \
92                 fi ; \
93                 install $$x /etc/asterisk/`basename $$x .sample` ;\
94         done
95         for x in sounds/demo-*; do \
96                 install $$x /var/lib/asterisk/sounds; \
97         done
98         mkdir -p /var/spool/asterisk/vm/1234/INBOX
99         :> /var/lib/asterisk/sounds/vm/1234/unavail.gsm
100         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
101                 cat /var/lib/asterisk/sounds/$$x.gsm >> /var/lib/asterisk/sounds/vm/1234/unavail.gsm ; \
102         done
103         :> /var/lib/asterisk/sounds/vm/1234/busy.gsm
104         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
105                 cat /var/lib/asterisk/sounds/$$x.gsm >> /var/lib/asterisk/sounds/vm/1234/busy.gsm ; \
106         done