This repository was archived by the owner on Jun 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
61 lines (47 loc) · 1.37 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
PYTHON ?= python2.6
MATLAB_SCRIPT ?= matlab
TMW_ROOT ?= $(shell ${MATLAB_SCRIPT} -e | grep MATLAB= | sed s/^MATLAB=//)
CFLAGS=$(shell ${PYTHON}-config --cflags)
CLIBS=
#CLIBS=$(shell ${PYTHON}-config --libs)
LDFLAGS=$(shell ${PYTHON}-config --ldflags)
#-L$(shell ${PYTHON}-config --prefix)/lib
#CFLAGS=%CFLAGS%
#CLIBS=%CLIBS%
#LDFLAGS=%LDFLAGS%
BUILDBRANCH = $(shell git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
ifeq ($(BUILDBRANCH),)
BUILDBRANCH = unknown
endif
BUILDTAG = $(shell git describe)
ifeq ($(BUILDTAG),)
BUILDTAG = unknown
endif
BUILDNAME = $(BUILDBRANCH)/$(BUILDTAG)
MEXEXT ?= $(shell ${TMW_ROOT}/bin/mexext)
DEBUG ?= $(if $(wildcard .debug_1),1,0)
TARGET = pymex.${MEXEXT}
MEXFLAGS ?=
MEXENV = CFLAGS="\$$CFLAGS ${CFLAGS}" CLIBS="\$$CLIBS ${CLIBS}" LDFLAGS="\$$LDFLAGS ${LDFLAGS}"
MEX = ${TMW_ROOT}/bin/mex
all: ${TARGET}
${TARGET}: pymex.c sharedfuncs.c commands.c *module.c pymex.h .debug_${DEBUG}
@echo building $(BUILDNAME)
$(MEX) $(MEXFLAGS) $(MEXENV) \
-DPYMEX_DEBUG_FLAG=$(DEBUG) \
-DPYMEX_BUILD="$(BUILDNAME)" \
pymex.c sharedfuncs.c *module.c
.debug_0:
@echo "Debug disabled."
@rm -f .debug_1
@touch .debug_0
.debug_1:
@echo "Debug enabled."
@rm -f .debug_0
@touch .debug_1
test: $(TARGET) *.py
${MATLAB_SCRIPT} -nojvm -nodisplay \
-r "pyimport nose; exit(unpy(~nose.run()));"
.PHONY: clean test
clean:
rm -f .debug_* pymex.mex*