Version 0.1.2 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 -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 SUBDIRS=channels pbx apps codecs formats
29 LIBS=-ldl -lpthread -lreadline #-lefence
30 OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o translate.o file.o say.o pbx.o cli.o md5.o asterisk.o
31 CC=gcc
32 INSTALL=install
33
34 _all: all
35         @echo " +--------- Asterisk Build Complete ---------+"  
36         @echo " + Asterisk has successfully been built, but +"  
37         @echo " + cannot be run before being installed by   +"  
38         @echo " + running:                                  +"  
39         @echo " +                                           +"
40         @echo " +               make install                +"  
41         @echo " +                                           +"
42         @echo " +-------------------------------------------+"  
43
44 all: asterisk subdirs
45
46 asterisk: $(OBJS)
47         gcc -o asterisk -rdynamic $(OBJS) $(LIBS)
48
49 subdirs: 
50         for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done
51
52 clean:
53         for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
54         rm -f *.o *.so asterisk
55
56 datafiles: all
57         mkdir -p /var/lib/asterisk/sounds/digits
58         for x in sounds/digits/*; do \
59                 install $$x /var/lib/asterisk/sounds/digits ; \
60         done
61         for x in sounds/vm-* sounds/transfer* ; do \
62                 install $$x /var/lib/asterisk/sounds ; \
63         done
64
65 install: all
66         mkdir -p $(MODULES_DIR)
67         for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
68         install -d /usr/include/asterisk
69         install include/asterisk/*.h /usr/include/asterisk
70         rm -f /var/lib/asterisk/sounds/vm
71         mkdir -p /var/spool/asterisk/vm
72         rm -f /usr/lib/asterisk/modules/chan_ixj.so
73         ( cd /var/lib/asterisk/sounds  ; ln -s ../../../spool/asterisk/vm . )
74         @echo " +---- Asterisk Installation Complete -------+"  
75         @echo " + Asterisk has successfully been installed. +"  
76         @echo " + If you would like to install the sample   +"  
77         @echo " + configuration files (overwriting any      +"
78         @echo " + existing config files), run:              +"  
79         @echo " +                                           +"
80         @echo " +               make samples                +"
81         @echo " +                                           +"
82         @echo " +-------------------------------------------+"  
83
84 samples: all datafiles
85         mkdir -p /etc/asterisk
86         for x in configs/*.sample; do \
87                 if [ -f /etc/asterisk/`basename $$x .sample` ]; then \
88                         mv -f /etc/asterisk/`basename $$x .sample` /etc/asterisk/`basename $$x .sample`.old ; \
89                 fi ; \
90                 install $$x /etc/asterisk/`basename $$x .sample` ;\
91         done
92         for x in sounds/demo-*; do \
93                 install $$x /var/lib/asterisk/sounds; \
94         done
95         mkdir -p /var/lib/asterisk/sounds/vm/1234
96         :> /var/lib/asterisk/sounds/vm/1234/unavail.gsm
97         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
98                 cat /var/lib/asterisk/sounds/$$x.gsm >> /var/lib/asterisk/sounds/vm/1234/unavail.gsm ; \
99         done
100         :> /var/lib/asterisk/sounds/vm/1234/busy.gsm
101         for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
102                 cat /var/lib/asterisk/sounds/$$x.gsm >> /var/lib/asterisk/sounds/vm/1234/busy.gsm ; \
103         done