## soundio library and test file GNU makefile for linux.
##
## Programmer:    Craig Stuart Sapp <craig@ccrma.stanford.edu>
## Creation Date: Sun Jan 20 12:40:05 PST 2002
## Last Modified: Wed Jan 23 20:25:04 PST 2002
## Filename:      ...soundio/Makefile
##
## To run this makefile, type (without quotes) "make".
##


# Use LINUX  for linux computers
# Use VISUAL for Windows computers
# Use SUN    for Sun computers
OSTYPE = LINUX


INCDIR     = ../
LIBDIR     = ../
COMPILER   = g++
DEFINES    = $(addprefix -D,$(OSTYPE))
LIBFLAGS   = -Wall -c -g -O6 $(DEFINES) -I$(INCDIR)
PROGFLAGS  = -Wall -O6 $(DEFINES) -I$(INCDIR)


#########################################################################

all:
	@echo "make examples  = create all test programs"
	@echo "make runtest   = run a basic test of soundio library"
	@echo "make runloop   = test the looping of SoundFileRead class"
	@echo "make clean     = remove all compiled example programs"
	@echo "make fullrange = make amplitude level testing soundfile"


clean:
	-rm -f writetest readtest sndcopy sndinfo extractChannel
	-rm -f multi2mono makemulti sndsubtract looptest

runtest: writetest readtest
	rm -f z.wav
	./writetest -d -n 10 -s -5 z.wav
	./readtest z.wav
	rm -f z.wav

runloop: writetest looptest
	rm -f z.wav
	./writetest -n 100 -s 0 z.wav
	./looptest z.wav
	rm -f z.wav

fullrange: writetest
	-rm -f fullrange.wav
	./writetest -n 65536 -s -32768 fullrange.wav


# Example programs:

examples: writetest readtest sndcopy extractChannel multi2mono makemulti sndinfo sndsubtract looptest

writetest: 
	g++ $(PROGFLAGS) -o writetest writetest.cpp -L$(LIBDIR) -lsoundio \
		&& strip writetest
	
readtest: 
	g++ $(PROGFLAGS) -o readtest readtest.cpp -L$(LIBDIR) -lsoundio \
		&& strip readtest

sndcopy:
	g++ $(PROGFLAGS) -o sndcopy sndcopy.cpp -L$(LIBDIR) -lsoundio \
		&& strip sndcopy

extractChannel:
	g++ $(PROGFLAGS) -o extractChannel extractChannel.cpp -L$(LIBDIR) \
            -lsoundio && strip extractChannel

multi2mono:
	g++ $(PROGFLAGS) -o multi2mono multi2mono.cpp -L$(LIBDIR) \
            -lsoundio && strip multi2mono

makemulti:
	g++ $(PROGFLAGS) -o makemulti makemulti.cpp -L$(LIBDIR) \
            -lsoundio && strip makemulti

sndinfo:
	g++ $(PROGFLAGS) -o sndinfo sndinfo.cpp -L$(LIBDIR) \
            -lsoundio && strip sndinfo

sndsubtract:
	g++ $(PROGFLAGS) -o sndsubtract sndsubtract.cpp -L$(LIBDIR) \
            -lsoundio && strip sndsubtract

looptest:
	g++ $(PROGFLAGS) -o looptest looptest.cpp -L$(LIBDIR) \
            -lsoundio && strip looptest
