File size: 3,090 Bytes
0b58803
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Makefile default variables
#
# Copyright (C) 1991-2014 Wellcome Trust Centre for Neuroimaging
#
# $Id: Makefile.var 6099 2014-07-11 12:21:35Z guillaume $
#
###############################################################################
#
# This file defines variables used in Makefile and has been tested under 
# Linux, Windows and MacOS.
# 
# If you have to tweak this file to compile the SPM MEX-files for your 
# platform, please send the details to <fil.spm@ucl.ac.uk> so they can be 
# included here. 
#
# You can find some more help online on the SPM wikibook:
#  * Linux:
#      http://en.wikibooks.org/wiki/SPM/Installation_on_Linux
#      http://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Linux 
#  * Windows:
#      http://en.wikibooks.org/wiki/SPM/Installation_on_Windows
#      http://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Windows
#      MinGW: http://www.mingw.org/
#  * MacOS:
#      http://en.wikibooks.org/wiki/SPM/Installation_on_Mac_OS_(Intel)
#      http://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Mac_OS_(Intel)
#
###############################################################################

SHELL          = /bin/sh
MAKE           = make
MEXBIN         = mex
MEXOPTS        = -O -largeArrayDims
MEXEND         = 
MOSUF          = o # mex output object suffix
UNAME          = uname
AR             = ar rcs
COPY           = cp -f
DEL            = rm -f
MOVE           = mv -f
TAR            = tar
ZIP            = gzip -f

ifndef SUF
  ifndef PLATFORM
    PLATFORM   = $(shell $(UNAME))
  endif
  ##### Linux #####
  ifeq (Linux,$(PLATFORM))
    HARDWARE   = $(shell $(UNAME) -m)
    ifeq (i386,$(HARDWARE))
      SUF      = mexglx
    endif
    ifeq (i686,$(HARDWARE))
      SUF      = mexglx
    endif
    ifeq (x86_64,$(HARDWARE))
      SUF      = mexa64
    endif
    ifndef SUF
      $(error Unknowm platform $(PLATFORM)-$(HARDWARE))
    endif
  endif
  ##### MacOS #####
  ifeq (Darwin,$(PLATFORM))
    HARDWARE   = $(shell $(UNAME) -p)
    ifeq (i386,$(HARDWARE))
      SUF      = mexmaci64
    endif
    ifndef SUF
      $(error Unknowm platform $(PLATFORM)-$(HARDWARE))
    endif
  endif
  ##### Windows #####
  ifeq (MINGW32,$(word 1,$(subst _, ,$(PLATFORM))))
    override PLATFORM = windows
  endif
  ifeq (windows,$(PLATFORM))
    ifeq (x86,$(PROCESSOR_ARCHITECTURE))
      SUF      = mexw32
    else
      SUF      = mexw64
    endif
    MEXBIN     = cmd /c "mex.bat
    MEXOPTS   += -DSPM_WIN32
    MEXEND     = "
    MOSUF      = obj
    AR         = lib.exe /out:
  endif
  #### Octave ####
  ifeq (octave,$(PLATFORM))
    MEXBIN     = mkoctfile
    MEXOPTS    = --mex
    SUF        = mex
    override PLATFORM = $(shell $(UNAME))
  endif
  ifndef SUF
    $(error Unknowm platform $(PLATFORM))
  endif
endif

MEX            = $(MEXBIN) $(MEXOPTS)

MATLABROOT     = $(realpath $(shell which $(firstword $(MEXBIN))))

define verb
	@ echo "_____________________________________________________________"
	@ echo ""
	@ echo "        " $(1)
	@ echo "_____________________________________________________________"
	@ echo ""
endef