# Makefile for synthesizer

LIB=midi_lib
START=.
CFILES= bpf.c parse_cmd.c to_audio.c \
	sines.c synth.c set_alaw.c reverb.c

HFILES=synth.h bpf.h reverb.h

TCLFILES= send.tcl synth.tcl test.tcl voice.tcl reverb.tcl

OTHER= config Makefile README synth.1 sparcOmatic.1 

FLAG=-O -fsingle
CFLAGS= $(FLAG) -I. -I./$(LIB)

synth:	lib synth.o parse_cmd.o to_audio.o sines.o bpf.o set_alaw.o reverb.o
		$(CC) $(CFLAGS) -o synth synth.o to_audio.o parse_cmd.o sines.o \
					bpf.o set_alaw.o reverb.o $(LIB)/mpulib.a -lm

lib:
		cd $(LIB); make mpulib.a

purify:
		PURIFYCACHEDIR=$(HOME)/.purify && make CC="purify -v cc" synth

do_reverb:
		$(MAKE) reverb FLAG="-g -DMAIN"
		
reverb:	reverb.o $(LIB)/b2i.o reverb.h
		$(CC) $(CFLAGS) -o reverb reverb.o $(LIB)/b2i.o
		
test_resp:	test_resp.o bpf.o
		$(CC) $(CFLAGS) -o test_resp test_resp.o bpf.o -lm
		
test_tuning:	test_tuning.o sines.o bpf.o
		$(CC) $(CFLAGS) -o test_tuning test_tuning.o sines.o bpf.o -lm
		
parse_cmd.o sines.o synth.o to_audio.o: synth.h

list:
	@/bin/ls -1 $(CFILES) $(HFILES) $(TCLFILES) $(OTHER)
	@cd $(LIB); make -s list START=./$(LIB)

clean:
	rm -f *.o
	cd $(LIB); $(MAKE) clean
