UNAME:=	$(shell uname)
include ../template.$(UNAME)

# ---------------------------------------------------------------------
# RCSID		: 	$Id: Makefile,v 1.9 2001/02/19 21:41:16 cmalek Exp $
# Project	:	synth
# Filename	:	Makefile
# Desc		:	Makefile for synth Matlab files
# ---------------------------------------------------------------------


DEBUG = -g

#-------------------------------------------------------------------------
# Includes
#-------------------------------------------------------------------------
SYNTHINC = -I..

INCLUDES = $(SYNTHINC)

#-------------------------------------------------------------------------
# Libraries
#-------------------------------------------------------------------------
# Note: mex stuff is linked against the static lib
#-------------------------------------------------------------------------
SYNTHLIB = ../$(UNAME)/.libs/libsynth.a 

LIBS = $(SYNTHLIB) -L$(NRLIB) -l$(NRVER)

#-------------------------------------------------------------------------
# Defines
#-------------------------------------------------------------------------
EXTRA =
DEFINES      = -DNR $(WORDS) $(OS) $(TEST) $(EXTRA) $(DEBUG)


MFILES = synthesize.m  \
	 click.m \
	 twosound.m \
	 syn_init.m \
	 syn_info.m \
	 set_calib.m \
	 get_calib.m

#-------------------------------------------------------------------------
# Targets
#-------------------------------------------------------------------------
all: synth.mex$(MATEXT)

synth.mex$(MATEXT): 
	cmex $(DEFINES) $(INCLUDES) -DMATLAB $(LIBS) syn-matlab.c -output synth
ifeq "$(MATEXT)" "4"
	mv synth synth.mex4
endif

clean:
	$(RM) synth.mex$(MATEXT)

distclean: clean

synth.mex$(MATEXT): syn-matlab.c $(SYNTHLIB)

install: synth.mex$(MATEXT)
	$(INSTALL) -m 755 synth.mex$(MATEXT) $(INSTALL_MATDIR)
	for x in $(MFILES);\
		do\
			$(INSTALL) -m 0444 $$x $(INSTALL_MATDIR);\
		done 
