# PyEPL: hardware/vr/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: avatar.so environment.so 

INCLUDEPY=$(shell python -c "import distutils.sysconfig;print distutils.sysconfig.get_config_var('INCLUDEPY')")

PLATFORM = $(shell uname)

ifeq ($(PLATFORM), Linux)

avatar.so: avatar.o
	gcc -shared avatar.o -o avatar.so

avatar.o: avatar.c
	gcc -c -fPIC -I$(INCLUDEPY) avatar.c

avatar.c: avatar.pyx
	pyrexc avatar.pyx

eyes.so: eyes.o
	gcc -shared eyes.o -o eyes.so

eyes.o: eyes.c
	gcc -c -fPIC -I$(INCLUDEPY) eyes.c

eyes.c: eyes.pyx
	pyrexc eyes.pyx

environment.so: environment.o
	gcc -shared environment.o -o environment.so

environment.o: environment.c
	gcc -c -fPIC -I$(INCLUDEPY) environment.c

environment.c: environment.pyx
	pyrexc environment.pyx

endif

ifeq ($(PLATFORM), Darwin)

avatar.so: avatar.o
	gcc -bundle -flat_namespace -undefined suppress avatar.o -lode -L/opt/local/lib -o avatar.so

avatar.o: avatar.c
	gcc -fPIC -c avatar.c -I$(INCLUDEPY)
avatar.c: avatar.pyx
	pyrexc avatar.pyx

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

eyes.o: eyes.c
	gcc -fPIC -c eyes.c -I$(INCLUDEPY)
eyes.c: eyes.pyx
	pyrexc eyes.pyx

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

environment.o: environment.c
	gcc -fPIC -c environment.c -I$(INCLUDEPY)
environment.c: environment.pyx
	pyrexc environment.pyx

endif
