-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
64 lines (48 loc) · 2.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Makefile.local must define the following variables
# LIBDIR install dir for C++ libraries
# INCDIR install dir for C++ headers
# PYDIR install dir for python/cython modules
# CPP C++ compiler command line, including all flags
#
# Some optional variables which I only use for osx/clang:
# CPP_LFLAGS extra linker flags when creating a .so or executable file from .o files
# LIBS_PYMODULE any extra libraries needed to link a python extension module (osx needs -lPython)
#
# Note that CPP must include -I<dir> flags which point to the python and numpy include
# directories. These directories can be determined from python as follows:
# print distutils.sysconfig.get_python_inc() # python includes
# print numpy.get_include() # numpy includes
#
# See site/Makefile.local.* for examples.
include Makefile.local
ifndef CPP
$(error Fatal: Makefile.local must define CPP variable)
endif
ifndef INCDIR
$(error Fatal: Makefile.local must define INCDIR variable)
endif
ifndef LIBDIR
$(error Fatal: Makefile.local must define LIBDIR variable)
endif
ifndef PYDIR
$(error Fatal: Makefile.local must define PYDIR variable)
endif
####################################################################################################
all: libsimpulse.so cython/simpulse.so
install: libsimpulse.so cython/simpulse.so
mkdir -p $(INCDIR) $(LIBDIR) $(PYDIR)
cp -f simpulse.hpp simpulse_internals.hpp $(INCDIR)/
cp -f libsimpulse.so $(LIBDIR)/
cp -f cython/simpulse.so $(PYDIR)/
uninstall:
rm -f $(INCDIR)/simpulse.hpp $(INCDIR)/simpulse_internals.hpp $(LIBDIR)/libsimpulse.so $(PYDIR)/simpulse.so
clean:
rm -f *~ *.o *.so cython/*~ cython/*.so cython/simpulse.cpp visual_check/*~ visual_check/plot*.png site/*~
%.o: %.cpp simpulse.hpp simpulse_internals.hpp
$(CPP) -c -o $@ $<
libsimpulse.so: constant_acceleration_phase_model.o single_pulse.o von_mises_profile.o
$(CPP) $(CPP_LFLAGS) -o $@ -shared $^ -lfftw3
cython/simpulse.cpp: cython/simpulse.pyx cython/simpulse_pxd.pxd cython/simpulse_cython.hpp simpulse.hpp
cython --cplus $<
cython/simpulse.so: cython/simpulse.cpp libsimpulse.so
$(CPP) $(CPP_LFLAGS) -Wno-unused-function -shared -o $@ $< -lsimpulse $(LIBS_PYMODULE)