MODEMVER=	@VERSION@
DSPVER=		@DSPVER@
IAXVER=		@IAXVER@

CFLAGS:=	-DMODEMVER=\"${MODEMVER}\" -DDSPVER=\"${DSPVER}\" -DIAXVER=\"${IAXVER}\" \
		-Wall -g -DSTATICLIBS -DUSE_UNIX98_PTY \
		-std=c99 -Ilib/libiax2/src -Ilib/spandsp/src \
		${CFLAGS}
OUR_CFLAGS=	-Wall -g -DSTATICLIBS -DUSE_UNIX98_PTY \
		-std=c99 -Ilib/libiax2/src -Ilib/spandsp/src
OBJS=		iaxmodem.o lib/spandsp/src/.libs/libspandsp.a lib/libiax2/src/.libs/libiax.a
LDFLAGS+=	-lm -lutil -ltiff

all: iaxmodem

iaxmodem: build-libiax build-libspandsp iaxmodem.o
	${CC} ${CFLAGS} ${OBJS} -o iaxmodem ${LDFLAGS}

iaxmodem.o: iaxmodem.c
	${CC} ${CFLAGS} -c iaxmodem.c

build-libiax:
	cd lib/libiax2 && ${MAKE}

build-libspandsp:
	cd lib/spandsp && ${MAKE}

clean:
	rm -f *.o && \
	cd lib/libiax2 && ${MAKE} clean && \
	cd ../../lib/spandsp && ${MAKE} clean

distclean:
	rm -f *.o && \
	cd lib/libiax2 && ${MAKE} distclean && \
	cd ../../lib/spandsp && ${MAKE} distclean && \
	cd ../.. && rm -f iaxmodem && \
	rm -f Makefile

