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