ifndef MATLABROOT
  $(warning MATLABROOT variable is undefined. Using default MATLABROOT="/Applications/MATLAB_R2013a.app/")
  MATLABROOT=/Applications/MATLAB_R2013a.app/
endif

ifndef EXT
  $(warning EXT variable is undefined. Using default EXT=mexmaci64)
  EXT=mexmaci64
endif

ifndef ARCH
  $(warning ARCH variable is undefined. Using default ARCH=maci64 )
  ARCH=maci64
endif

ifndef PORTAUDIO
  PORTAUDIO=-lportaudio
endif

include ../../libltfat/ostools.mk

MEXTGT=playrec.$(EXT)
MEXSRC=mex_dll_core.c pa_dll_playrec.c ltfatresample.c
LIBS= -L. -L"$(MATLABROOT)/bin/$(ARCH)" -lmex -lmx -lm $(PORTAUDIO) 
	  
INCLUDES= -I"$(MATLABROOT)/extern/include" -I.
CFLAGS=-fPIC -std=c99 -O3 -Wall -shared -DMATLAB_MEX_FILE -DHAVE_PORTAUDIO -DMATLAB_MEXCMD_RELEASE=R2017b

all:
	$(CC) $(CFLAGS) $(INCLUDES) $(MEXSRC) $(LIBS) -o $(MEXTGT) 

clean:
	$(RM) $(MEXTGT)

.PHONY: all clean
