
#
#
#
ASTERISK_PREFIX=

#
# The following line tells the makefile where to install the module, 
# if necessary, please edit it 
#
INSTALL_MODPATH=$(ASTERISK_PREFIX)/usr/lib/asterisk/modules

#
# asterisk var dir
#
INSTALL_SCRIPT_PATH=$(ASTERISK_PREFIX)/var/lib/asterisk/scripts

#
# The following line tells the makefile where to find the asterisk src, so 
# please edit this one if necessary 
#
ASTERISKSRC=/usr/src/asterisk

#
# The following line tells the makefile where to put in the configfile 
# of this module
#
AST_CONFIG_DIR=/etc/asterisk/

#
# The Includes are Set appropriatly
#
ASTERISKINC=$(ASTERISKSRC)/include


#
# Spool Dir for ptywaiter
#

PTY_SPOOL_PATH=$(ASTERISK_PREFIX)/var/spool/asterisk/ptyspool

#
# ASTERISK Version
# If you are using a asterisk version above from stable than comment the 
# following line out
#
#CFLAGS+=-DASTERISK_STABLE

CFLAGS+=-ggdb -Wall -D_GNU_SOURCE

all: app_waitfordigits.so app_pipe.so app_v110.so #app_sample.so

CFLAGS+=-fPIC -DAST_CONFIG_DIR=\"$(AST_CONFIG_DIR)\" \
	-DPTYSPOOLDIR=\"$(PTY_SPOOL_PATH)\" \
	-DSCRIPTPATH=\"$(INSTALL_SCRIPT_PATH)\" -Wall

app_sample.so: app_sample.o 
	$(CC) -shared -Xlinker -x -o $@ app_sample.o

app_v110.so: app_v110.o 
	$(CC) -shared -Xlinker -x -o $@ app_v110.o

app_pipe.so: app_pipe.o ahdlc.o
	$(CC) -shared -Xlinker -x -o $@ app_pipe.o ahdlc.o 

app_waitfordigits.so: app_waitfordigits.o 
	$(CC) -shared -Xlinker -x -o $@ app_waitfordigits.o 

install: app_pipe.so app_v110.so app_waitfordigits.so #app_sample.so
	install -m 644 app_pipe.so $(INSTALL_MODPATH)/
	install -m 644 app_v110.so $(INSTALL_MODPATH)/
	install -m 644 app_waitfordigits.so $(INSTALL_MODPATH)/
#	install -m 644 app_sample.so $(INSTALL_MODPATH)/

	@echo 
	@echo INSTALLATION SUCCEEDED

clean: 
	rm -rf *.o *.so *~ 

# the files to include in the tar.gz
SRCS=*.h *.c Makefile README VERSION

snapshot:
	DIR=app_bundle ; \
	echo $$(date +"%d_%m_%y" | sed -e "s/\//_/g") > VERSION ; \
	mkdir /tmp/$$DIR ; \
	cp $(SRCS) /tmp/$$DIR ; \
	cd /tmp/; \
	tar czf $$DIR.tar.gz $$DIR

