
#   Make file for Netfone

#   Uncomment the appropriate LFLAGS statement below according
#   to your machine type.

#   Linker flags

# Silicon Graphics
#LFLAGS = -laudio -lcurses

# Sun
LFLAGS = -lcurses -ltermcap

#   Everything will probably work OK without any changes below
#   this line.

#   Internet socket port used by mike and speaker.  If you change this,
#   you will not be able to exchange sound with users who've built
#   NetFone with different values.

INTERNET_PORT = 2074

CARGS = -DInternet_Port=$(INTERNET_PORT)

#   Compiler flags

CFLAGS = -O -Igsm/inc -Imd5 -Iidea $(CARGS)

all:	speaker mike

SPKROBJS = speaker.o soundbyte.o ulaw.o

speaker: $(SPKROBJS) gsmlib.o deslib.o md5lib.o idealib.o
	cc $(SPKROBJS) des/des.o md5/md5.o idea/idea.o gsm/lib/libgsm.a $(LFLAGS) -o speaker

MIKEOBJS = mike.o soundbyte.o ulaw.o

mike:	$(MIKEOBJS) gsmlib.o deslib.o md5lib.o idealib.o
	cc $(MIKEOBJS) des/des.o md5/md5.o idea/idea.o -lm gsm/lib/libgsm.a $(LFLAGS) -o mike

gsmlib.o:
	( echo "Building GSM library."; cd gsm ; make )
	echo "GSM" >gsmlib.o

deslib.o:
	( echo "Building DES library."; cd des ; make )
	echo "DES" >deslib.o

md5lib.o:
	( echo "Building MD5 library."; cd md5 ; make )
	echo "MD5" >md5lib.o

idealib.o:
	( echo "Building IDEA library."; cd idea ; make )
	echo "IDEA" >idealib.o

speaker.o: speaker.c netfone.h

mike.o: mike.c netfone.h

testgsm:    testgsm.o gsmlib.o
	cc testgsm.o -lm gsm/lib/libgsm.a $(LFLAGS) -o testgsm

manpage:
	nroff -man netfone.1 | more

printman:
	ptroff -man netfone.1

clean:
	rm -f core *.out *.o *.bak speaker mike testgsm *.shar
	( cd gsm; make clean )
	( cd des; make clean )
	( cd md5; make clean )
	( cd idea; make clean )
