# PyEPL: hardware/eeg/pulse/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: pulse.so

PLATFORM = $(shell uname)

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

ifeq ($(PLATFORM), Linux)

pulse.so: pulse.o eplPulse.o
	gcc -shared pulse.o eplPulse.o -o pulse.so

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

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

pulse.c: pulse.pyx
	pyrexc pulse.pyx

endif

ifeq ($(PLATFORM), Darwin)

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

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

pulse.c: pulse.pyx
	pyrexc pulse.pyx

endif
