--- /dev/null
+++ b/PsychSourceGL/Cohorts/PortAudio/Makefile
@@ -0,0 +1,34 @@
+# PIC should be enabled to allow mixin while building resultant .mex
+CFLAGS+=-fPIC
+
+all: patch-stamp build
+
+configure-stamp:
+	cd portaudio; cp -f /usr/share/misc/config.sub .; cp -f /usr/share/misc/config.guess .; mkdir -p lib; \
+	CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --disable-shared --without-jack --without-asiodir
+	$(MAKE) -C portaudio clean || :
+	touch $@
+
+build: configure-stamp
+	make -C portaudio || :
+	: #  It is "ok" to fail for full build -- we just need a static library
+	: # So it is important that file is present -- if not -- fail
+	cp -p portaudio/lib/.libs/libportaudio.a .
+
+patch-stamp: portaudio-stamp
+	# Propagate patched files into the tree
+	# cp -p pa_unix_util.c portaudio/src/os/unix/pa_unix_util.c
+	# cp -p pa_process.c 	 portaudio/src/common/pa_process.c
+	# cp -p pa_front_linux.c 	 portaudio/src/common/pa_front.c
+	#: Use patches without relying on quilt patch-queue manager
+	cat patches/series | while read pname; do patch -p1 < patches/$$pname; done
+	touch $@
+
+portaudio-stamp:
+	#unzip portaudio_unpatched_except4OSX.zip \
+	#		'portaudio/*' -x 'portaudio/bin/*' -x 'portaudio/lib/*' -x '*.o'
+	tar -xzvf pa_stable_v19_061121.tar.gz
+	touch $@
+
+clean:
+	rm -rf portaudio *-stamp libportaudio.a
