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

#
# 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

CFLAGS+=-ggdb

all: sayit app_say_number.so

sayit: say_number.o main.o
	$(CC) $(CFLAGS) say_number.o main.o -o sayit

CFLAGS+=-D_GNU_SOURCE -fPIC -I$(ASTERISKINC) -DAST_CONFIG_DIR=\"$(AST_CONFIG_DIR)\"

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


#app_say_number.o: app_say_number.c
#	$(CC) $(CFLAGS) app_say_number.c -o app_say_number.o


install: app_say_number.so
	cp app_say_number.so $(INSTALL_MODPATH)/
	if [ ! -f $(AST_CONFIG_DIR)/saynumber.cfg ]; then cp sample.cfg $(AST_CONFIG_DIR)/saynumber.cfg; fi 
	@echo 
	@echo INSTALLATION SUCCEEDED


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