# PyEPL: hardware/Makefile
#
# Copyright (C) 2003-2005 Michael J. Kahana
# Authors: Ian Schleifer, Per Sederberg, Aaron Geller, Josh Jacobs
# URL: http://memory.psych.upenn.edu/programming/pyepl
#
# Distributed under the terms of the GNU Lesser General Public License
# (LGPL). See the license.txt that came with this file.

all: eeg sound vr rt eventpoll.so timing.so keyboard.so joystick.so mouse.so

eeg: FORCE
	$(MAKE) -C eeg

sound: FORCE
	$(MAKE) -C sound

vr: FORCE
	$(MAKE) -C vr

rt: FORCE
	$(MAKE) -C rt

FORCE:

PLATFORM = $(shell uname)

ifeq ($(PLATFORM), Linux)

eventpoll.so: eventpoll.o
	gcc -shared eventpoll.o -o eventpoll.so

eventpoll.o: eventpoll.c
	gcc -c -fPIC -I/usr/include/python2.3/ eventpoll.c

eventpoll.c: eventpoll.pyx
	pyrexc eventpoll.pyx

timing.so: timing.o
	gcc -shared timing.o -o timing.so

timing.o: timing.c
	gcc -c -fPIC -I/usr/include/python2.3/ timing.c

timing.c: timing.pyx
	pyrexc timing.pyx

keyboard.so: keyboard.o
	gcc -shared keyboard.o -o keyboard.so

keyboard.o: keyboard.c
	gcc -c -fPIC -I/usr/include/python2.3/ keyboard.c

keyboard.c: keyboard.pyx
	pyrexc keyboard.pyx

joystick.so: joystick.o
	gcc -shared joystick.o -o joystick.so

joystick.o: joystick.c
	gcc -c -fPIC -I/usr/include/python2.3/ joystick.c

joystick.c: joystick.pyx
	pyrexc joystick.pyx

mouse.so: mouse.o
	gcc -shared mouse.o -o mouse.so

mouse.o: mouse.c
	gcc -c -fPIC -I/usr/include/python2.3/ mouse.c

mouse.c: mouse.pyx
	pyrexc mouse.pyx

endif

ifeq ($(PLATFORM), Darwin)

eventpoll.so: eventpoll.o
	gcc -bundle -flat_namespace -undefined suppress eventpoll.o -o eventpoll.so

eventpoll.o: eventpoll.c
	gcc -fPIC -c eventpoll.c -I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3//

eventpoll.c: eventpoll.pyx
	pyrexc eventpoll.pyx

timing.so: timing.o
	gcc -bundle -flat_namespace -undefined suppress timing.o -o timing.so

timing.o: timing.c
	gcc -fPIC -c timing.c -I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3//

timing.c: timing.pyx
	pyrexc timing.pyx

keyboard.so: keyboard.o
	gcc -bundle -flat_namespace -undefined suppress keyboard.o -o keyboard.so

keyboard.o: keyboard.c
	gcc -fPIC -c keyboard.c -I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3//

keyboard.c: keyboard.pyx
	pyrexc keyboard.pyx

joystick.so: joystick.o
	gcc -bundle -flat_namespace -undefined suppress joystick.o -o joystick.so

joystick.o: joystick.c
	gcc -fPIC -c joystick.c -I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3//

joystick.c: joystick.pyx
	pyrexc joystick.pyx

mouse.so: mouse.o
	gcc -bundle -flat_namespace -undefined suppress mouse.o -o mouse.so

mouse.o: mouse.c
	gcc -fPIC -c mouse.c -I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3//

mouse.c: mouse.pyx
	pyrexc mouse.pyx

endif
