Make ADPCM frames standard
[asterisk/asterisk.git] / Makefile
index caacc70..da0aab9 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,10 @@ OSARCH=$(shell uname -s)
 
 ifeq (${OSARCH},Linux)
 PROC=$(shell uname -m)
+else
+ifeq (${OSARCH},FreeBSD)
+PROC=$(shell uname -m)
+endif
 endif
 # Pentium Pro Optimize
 #PROC=i686
@@ -105,11 +109,15 @@ CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null
 CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
 ifeq (${OSARCH},FreeBSD)
 CFLAGS+=-pthread
+INCLUDE+=-I/usr/local/include
 endif
 ifeq (${OSARCH},OpenBSD)
 CFLAGS+=-pthread
 endif
 
+#Uncomment this to use the older DSP routines
+#CFLAGS+=-DOLD_DSP_ROUTINES
+
 CFLAGS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "-DZAPTEL_OPTIMIZATIONS"; fi)
 
 LIBEDIT=editline/libedit.a
@@ -161,7 +169,7 @@ OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
        ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
        cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \
        dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
-       astmm.o enum.o srv.o dns.o
+       astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o
 ifeq (${OSARCH},Darwin)
 OBJS+=poll.o dlfcn.o
 ASTLINK=-Wl,-dynamic
@@ -255,7 +263,7 @@ datafiles: all
        mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
        for x in sounds/digits/*.gsm; do \
                if grep -q "^%`basename $$x`%" sounds.txt; then \
-                       install $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
+                       install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits ; \
                else \
                        echo "No description for $$x"; \
                        exit 1; \
@@ -263,7 +271,7 @@ datafiles: all
        done
        for x in sounds/vm-* sounds/transfer* sounds/pbx-* sounds/ss-* sounds/beep* sounds/dir-* sounds/conf-* sounds/agent-* sounds/invalid* sounds/tt-* sounds/auth-* sounds/privacy-*; do \
                if grep -q "^%`basename $$x`%" sounds.txt; then \
-                       install $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
+                       install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
                else \
                        echo "No description for $$x"; \
                        exit 1; \
@@ -272,7 +280,7 @@ datafiles: all
        mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/mohmp3
        mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/images
        for x in images/*.jpg; do \
-               install $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \
+               install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/images ; \
        done
        mkdir -p $(DESTDIR)$(AGI_DIR)
 
@@ -294,11 +302,13 @@ bininstall: all
        mkdir -p $(DESTDIR)$(ASTVARRUNDIR)
        mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail
        install -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/
-       install -m 755 astgenkey $(DESTDIR)$(ASTSBINDIR)/
-       install -m 755 safe_asterisk $(DESTDIR)$(ASTSBINDIR)/
+       install -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
+       if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ]; then \
+               install -m 755 contrib/scripts/safe_asterisk $(DESTDIR)$(ASTSBINDIR)/ ;\
+       fi
        for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
        install -d $(DESTDIR)$(ASTHEADERDIR)
-       install include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
+       install -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
        rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/vm
        rm -f $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail
        if [ ! -h $(DESTDIR)$(ASTSPOOLDIR)/vm ] && [ -d $(DESTDIR)$(ASTSPOOLDIR)/vm ]; then \
@@ -311,11 +321,21 @@ bininstall: all
        rm -f $(DESTDIR)$(MODULES_DIR)/chan_ixj.so
        rm -f $(DESTDIR)$(MODULES_DIR)/chan_tor.so
        rm -f $(DESTDIR)$(MODULES_DIR)/cdr_mysql.so
+       rm -f $(DESTDIR)$(MODULES_DIR)/cdr_unixodbc.so
        rm -f $(DESTDIR)$(MODULES_DIR)/codec_mp3_d.so
+       rm -f $(DESTDIR)$(MODULES_DIR)/format_mp3.so
+       rm -f $(DESTDIR)$(MODULES_DIR)/app_voicemail2.so
        mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds
        mkdir -p $(DESTDIR)$(ASTLOGDIR)/cdr-csv
        mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/keys
+       mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware
+       mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax
        install -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTVARLIBDIR)/keys
+       if [ -d contrib/firmware/iax ]; then \
+               install -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTVARLIBDIR)/firmware/iax/iaxy.conf ; \
+       else \
+               echo "You need to do cvs update -d not just cvs update" ; \
+       fi 
        ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/vm . )
        ( cd $(DESTDIR)$(ASTVARLIBDIR)/sounds  ; ln -s $(ASTSPOOLDIR)/voicemail . )
        @echo " +---- Asterisk Installation Complete -------+"  
@@ -358,7 +378,7 @@ samples: all datafiles adsi
                if [ -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ]; then \
                        mv -f $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample`.old ; \
                fi ; \
-               install $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
+               install -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`basename $$x .sample` ;\
        done
        echo "[directories]" > $(DESTDIR)$(ASTETCDIR)/asterisk.conf
        echo "astetcdir => $(ASTETCDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
@@ -370,30 +390,30 @@ samples: all datafiles adsi
        echo "astlogdir => $(ASTLOGDIR)" >> $(DESTDIR)$(ASTETCDIR)/asterisk.conf
        for x in sounds/demo-*; do \
                if grep -q "^%`basename $$x`%" sounds.txt; then \
-                       install $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
+                       install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/sounds ; \
                else \
                        echo "No description for $$x"; \
                        exit 1; \
                fi; \
        done
        for x in sounds/*.mp3; do \
-               install $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
+               install -m 644 $$x $(DESTDIR)$(ASTVARLIBDIR)/mohmp3 ; \
        done
        mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
-       :> $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail/default/1234/unavail.gsm
+       :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm
        for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
-               cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail/default/1234/unavail.gsm ; \
+               cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
        done
-       :> $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail/default/1234/busy.gsm
+       :> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
        for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
-               cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail/default/1234/busy.gsm ; \
+               cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
        done
 
 webvmail:
        @[ -d $(DESTDIR)$(HTTPDIR) ] || ( echo "No HTTP directory" && exit 1 )
        @[ -d $(DESTDIR)$(HTTPDIR)/html ] || ( echo "No http directory" && exit 1 )
        @[ -d $(DESTDIR)$(HTTPDIR)/cgi-bin ] || ( echo "No cgi-bin directory" && exit 1 )
-       install -m 4755 -o root -g root vmail.cgi $(DESTDIR)$(HTTPDIR)/cgi-bin/vmail.cgi
+       install -m 4755 -o root -g root contrib/scripts/vmail.cgi $(DESTDIR)$(HTTPDIR)/cgi-bin/vmail.cgi
        mkdir -p $(DESTDIR)$(HTTPDIR)/html/_asterisk
        for x in images/*.gif; do \
                install -m 644 $$x $(DESTDIR)$(HTTPDIR)/html/_asterisk/; \
@@ -408,7 +428,7 @@ webvmail:
        @echo " +-------------------------------------------+"  
 
 mailbox:
-       ./addmailbox 
+       ./contrib/scripts/addmailbox 
        
 
 rpm: __rpm
@@ -420,19 +440,15 @@ __rpm: _version
        $(MAKE) DESTDIR=/tmp/asterisk samples ; \
        mkdir -p /tmp/asterisk/etc/rc.d/init.d ; \
        cp -f redhat/asterisk /tmp/asterisk/etc/rc.d/init.d/ ; \
-       cp -f redhat/rpmrc /tmp/asterisk/ ; \
-       cp -f redhat/rpmmacros /tmp/asterisk/ ; \
-       sed "s/Version:/Version: $(RPMVERSION)/g" redhat/asterisk.spec > /tmp/asterisk/asterisk.spec ; \
-       rpm --rcfile /usr/lib/rpm/rpmrc:/tmp/asterisk/rpmrc -bb /tmp/asterisk/asterisk.spec ; \
-       mv /tmp/asterisk/redhat/RPMS/i386/asterisk* ./ ; \
-       rm -rf /tmp/asterisk
-
+       sed "s/^Version:.*/Version: $(RPMVERSION)/g" redhat/asterisk.spec > asterisk.spec ; \
+       rpmbuild --rcfile /usr/lib/rpm/rpmrc:redhat/rpmrc -bb asterisk.spec
+       
 progdocs:
-       doxygen asterisk-ng-doxygen
+       doxygen contrib/asterisk-ng-doxygen
 
 config:
        if [ -d /etc/rc.d/init.d ]; then \
-               install -m 755 init.asterisk /etc/rc.d/init.d/asterisk; \
+               install -m 755 contrib/init.d/rc.redhat.asterisk /etc/rc.d/init.d/asterisk; \
                /sbin/chkconfig --add asterisk; \
        elif [ -d /etc/init.d ]; then \
                install -m 755 init.asterisk /etc/init.d/asterisk; \