asterisk / Makefile

#
# Asterisk -- A telephony toolkit for Linux.
# 
# Top level Makefile
#
# Copyright (C) 1999, Mark Spencer
#
# Mark Spencer <markster@linux-support.net>
#
# This program is free software, distributed under the terms of
# the GNU General Public License
#


.EXPORT_ALL_VARIABLES:

MODULES_DIR=/usr/lib/asterisk/modules

# Pentium Pro Optimize
#PROC=i686
# Pentium Optimize
PROC=i586

DEBUG=-g #-pg
INCLUDE=-Iinclude -I../include
CFLAGS=-pipe -Wall -Werror -Wmissing-prototypes -Wmissing-declarations -O6 $(DEBUG) $(INCLUDE) -D_REENTRANT
CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
SUBDIRS=channels pbx apps codecs formats
LIBS=-ldl -lpthread -lreadline -lncurses # -lefence
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
CC=gcc
INSTALL=install

_all: all
	@echo " +--------- Asterisk Build Complete ---------+"  
	@echo " + Asterisk has successfully been built, but +"  
	@echo " + cannot be run before being installed by   +"  
	@echo " + running:                                  +"  
	@echo " +                                           +"
	@echo " +               make install                +"  
	@echo " +                                           +"
	@echo " +-------------------------------------------+"  

all: asterisk subdirs

asterisk: $(OBJS)
	gcc -o asterisk -rdynamic $(OBJS) $(LIBS)

subdirs: 
	for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done

clean:
	for x in $(SUBDIRS); do $(MAKE) -C $$x clean || exit 1 ; done
	rm -f *.o *.so asterisk

datafiles: all
	mkdir -p /var/lib/asterisk/sounds/digits
	for x in sounds/digits/*; do \
		install $$x /var/lib/asterisk/sounds/digits ; \
	done
	for x in sounds/vm-* sounds/transfer* ; do \
		install $$x /var/lib/asterisk/sounds ; \
	done

install: all
	mkdir -p $(MODULES_DIR)
	for x in $(SUBDIRS); do $(MAKE) -C $$x install || exit 1 ; done
	install -d /usr/include/asterisk
	install include/asterisk/*.h /usr/include/asterisk
	rm -f /var/lib/asterisk/sounds/vm
	mkdir -p /var/spool/asterisk/vm
	rm -f /usr/lib/asterisk/modules/chan_ixj.so
	mkdir -p /var/lib/asterisk/sounds
	( cd /var/lib/asterisk/sounds  ; ln -s ../../../spool/asterisk/vm . )
	@echo " +---- Asterisk Installation Complete -------+"  
	@echo " + Asterisk has successfully been installed. +"  
	@echo " + If you would like to install the sample   +"  
	@echo " + configuration files (overwriting any      +"
	@echo " + existing config files), run:              +"  
	@echo " +                                           +"
	@echo " +               make samples                +"
	@echo " +                                           +"
	@echo " +-------------------------------------------+"  

samples: all datafiles
	mkdir -p /etc/asterisk
	for x in configs/*.sample; do \
		if [ -f /etc/asterisk/`basename $$x .sample` ]; then \
			mv -f /etc/asterisk/`basename $$x .sample` /etc/asterisk/`basename $$x .sample`.old ; \
		fi ; \
		install $$x /etc/asterisk/`basename $$x .sample` ;\
	done
	for x in sounds/demo-*; do \
		install $$x /var/lib/asterisk/sounds; \
	done
	mkdir -p /var/spool/asterisk/vm/1234/INBOX
	:> /var/lib/asterisk/sounds/vm/1234/unavail.gsm
	for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
		cat /var/lib/asterisk/sounds/$$x.gsm >> /var/lib/asterisk/sounds/vm/1234/unavail.gsm ; \
	done
	:> /var/lib/asterisk/sounds/vm/1234/busy.gsm
	for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
		cat /var/lib/asterisk/sounds/$$x.gsm >> /var/lib/asterisk/sounds/vm/1234/busy.gsm ; \
	done
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.