-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
64 lines (45 loc) · 1.98 KB
/
makefile
File metadata and controls
64 lines (45 loc) · 1.98 KB
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
# clear all the implicit rules
.SUFFIXES :
# determine the correct matlab root
MATLABROOT:=$(wildcard /usr/local/matlab/bin /opt/matlab/bin /local/share/matlab/bin /Applications/MATLAB*/bin)
MATLABROOT:=$(firstword $(MATLABROOT))
MEX:=$(MATLABROOT)/mex
#MEXEXT:=mexa64
MEXEXT:=mexglx # N.B. override in the call with MEXEXT=`mexext` for macs etc.
# alternative which finds the extension automatically, when mexext exists
# MEXEXT:=$(shell $(MATLABROOT)/mexext)
FLAGS:=-g -ansi -pedantic -Wall
#FLAGS:=-O -g
OPS=plus minus times rdivide ldivide power eq ne lt gt le ge
.PHONY: all
all: tprod repop
.PHONY: tprod
tprod : tprod.$(MEXEXT)
.PHONY: repop
repop : repop.$(MEXEXT)
.PHONY: repops
repops : $(OPS:%=r%.$(MEXEXT))
# sompe dependency information
repop.$(MEXEXT) : repop_mex.c repop_util.c ddrepop.c dsrepop.c sdrepop.c ssrepop.c repop.def repop.h mxInfo.c mxInfo_mex.c
tprod.$(MEXEXT) : tprod_mex.c tprod_util.c ddtprod.c dstprod.c sdtprod.c sstprod.c tprod.h tprod.def mxInfo.c mxInfo_mex.c
tprod_testcases : tprod_testcases.c mxInfo.c mxInfo.h mxUtils.c mxUtils.h tprod_util.c ddtprod.c dstprod.c sdtprod.c sstprod.c tprod.h tprod.def
$(CC) $(filter %.c,$^) $(FLAGS) -o $@
# general rule to make utility object codes
%.o : %.c %.h
$(MEX) -c $< $(FLAGS)
# general rule to make mex files
# ordered in decreasing specificity so the first one which matches fires
%.$(MEXEXT) : mxInfo.c %.def %.h
$(MEX) $(filter %.c,$^) $(FLAGS) -output $* $(filter %.o,$^)
%.$(MEXEXT) : mxInfo.c %.def
$(MEX) $(filter %.c,$^) $(FLAGS) -output $* $(filter %.o,$^)
%.$(MEXEXT) : %.c mxInfo.c
$(MEX) $(filter %.c,$^) $(FLAGS) $(filter %.o,$^)
%.$(MEXEXT) : %.c
$(MEX) $(filter %.c,$^) $(FLAGS) $(filter %.o,$^)
# repops are special cases like genops
r%.$(MEXEXT) : repop_ind.c repop.c repop.def repop.h mxInfo.c
$(MEX) $(filter %.c,$^) $(FLAGS) -D_`echo $* | tr a-z A-Z`_ -output r$* $(filter %.o,$^)
# $(MEX) $< $(FLAGS) -D_`echo $* | sed -e 's/^.//' | tr a-z A-Z`_ -output $*
clean:
rm -f *.$(MEXEXT) *.o