-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Possible breaking changes with previous version: Uses latest SPM vers…
…ion of MB OBS: Now contains some MEX files that requires compilation.
- Loading branch information
Showing
19 changed files
with
3,434 additions
and
4,419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
#!/usr/bin/env make -f | ||
# Makefile to compile SPM MB GMM lib C-MEX files (hacked together by MB) | ||
# | ||
# Copyright (C) 1991-2021 Wellcome Centre for Human Neuroimaging | ||
# | ||
# $Id: Makefile 8058 2021-02-10 10:38:31Z guillaume $ | ||
# | ||
############################################################################### | ||
# | ||
# This Makefile has been tested under Linux, Windows and MacOS. | ||
# | ||
# If you have to tweak this Makefile or Makefile.var to compile the SPM | ||
# mex-files for your platform, please send the details to <[email protected]> | ||
# so they can be included here. | ||
# | ||
# To compile and install SPM, type the following in a Unix console: | ||
# > make distclean && make && make install | ||
# | ||
# You can specify a particular platform with the following syntax: | ||
# > make PLATFORM=Your_Platform | ||
# The standard targets are 'all', 'clean', 'distclean', 'doc' and 'install'. | ||
# | ||
# For a list of compatible compilers, see | ||
# https://www.mathworks.com/support/compilers.html | ||
# | ||
############################################################################### | ||
|
||
include Makefile.var | ||
|
||
############################################################################### | ||
# Objects to go in the archive and mexfiles | ||
############################################################################### | ||
|
||
SPMMEX =\ | ||
spm_gmmlib.$(MEXEXT) | ||
|
||
############################################################################### | ||
# Public make targets | ||
############################################################################### | ||
|
||
all: verb.$(MEXEXT) main-all verb.all.end | ||
|
||
clean: verb.distclean main-distclean verb.distclean.end | ||
|
||
############################################################################### | ||
# Private make targets | ||
############################################################################### | ||
|
||
main-all: $(SPMMEX) | ||
|
||
main-distclean: | ||
$(DEL) $(SPMMEX) | ||
|
||
############################################################################### | ||
# Compile the mex files themselves | ||
############################################################################### | ||
|
||
spm_gmmlib.$(MEXEXT): spm_gmmlib.c gmmlib.c gmmlib.h | ||
$(MEX) spm_gmmlib.c gmmlib.c $(MEXEND) | ||
|
||
############################################################################### | ||
# Display Messages | ||
############################################################################### | ||
|
||
verb.clean: | ||
$(call verb, "Deleting object (.o) files") | ||
|
||
verb.distclean: | ||
$(call verb, "Deleting MEX (.$(MEXEXT)) and archive (.a) files") | ||
|
||
verb.install: | ||
$(call verb, "Installing MEX files") | ||
|
||
verb.tarball: | ||
$(call verb, "Creating archive spm_mex.tar.gz") | ||
|
||
verb.mexw32: | ||
$(call verb, "Windows compilation (32 bit)") | ||
|
||
verb.mexw64: | ||
$(call verb, "Windows compilation (64 bit)") | ||
|
||
verb.mexglx: | ||
$(call verb, "Linux compilation (x86-32)") | ||
|
||
verb.mexa64: | ||
$(call verb, "Linux compilation (x86-64)") | ||
|
||
verb.mexmaci: | ||
$(call verb, "MacOS compilation (Intel 32 bit)") | ||
|
||
verb.mexmaci64: | ||
$(call verb, "MacOS compilation (Intel 64 bit)") | ||
|
||
verb.mex: | ||
$(call verb, "${PLATFORM} compilation (`${MEXBIN} -v | head -n 1`)") | ||
|
||
verb.all.end: | ||
$(call verb, "Compilation: done") | ||
|
||
verb.distclean.end: | ||
$(call verb, "Distclean: done") | ||
|
||
verb.install.end: | ||
$(call verb, "Installation: done") | ||
|
||
verb.external: | ||
$(call verb, "In external") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# Makefile default variables | ||
# | ||
# Copyright (C) 1991-2020 Wellcome Centre for Human Neuroimaging | ||
# | ||
# $Id: Makefile.var 8020 2020-11-26 15:00:31Z 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 <[email protected]> so they can be | ||
# included here. | ||
# | ||
# You can find some more help online on the SPM wikibook: | ||
# * Linux: | ||
# https://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Linux | ||
# * Windows: | ||
# https://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Windows | ||
# MinGW: http://www.mingw.org/ | ||
# * macOS: | ||
# https://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Mac_OS_(Intel) | ||
# | ||
############################################################################### | ||
|
||
SHELL = /bin/sh | ||
MAKE = make | ||
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 | ||
OMPFLAG = -fopenmp | ||
WARNFLAG = -Wall -Wextra -Wpedantic | ||
USE_OPENMP ?= 0 | ||
|
||
ifndef PLATFORM | ||
PLATFORM = $(shell $(UNAME)) | ||
endif | ||
|
||
##### Linux ##### | ||
ifeq (Linux,$(PLATFORM)) | ||
MEXEXT = mexa64 | ||
MEXBIN ?= /usr/local/MATLAB/R2018a/bin/mex | ||
#MEXOPTS += CFLAGS='$$CFLAGS $(WARNFLAG)' | ||
endif | ||
|
||
##### MacOS ##### | ||
ifeq (Darwin,$(PLATFORM)) | ||
MEXEXT = mexmaci64 | ||
MEXBIN ?= mex | ||
# https://stackoverflow.com/questions/37362414/ | ||
OMPFLAG = -fopenmp=libiomp5 | ||
endif | ||
|
||
##### Windows ##### | ||
ifeq (MINGW32,$(word 1,$(subst _, ,$(PLATFORM)))) # MSVC | ||
override PLATFORM = windows | ||
MEXEXT = mexw64 | ||
MEXBIN ?= cmd /c "mex.bat | ||
MEXOPTS += -DSPM_WIN32 | ||
MEXEND = " | ||
MOSUF = obj | ||
AR = lib.exe /out: | ||
OMPFLAG = /openmp | ||
endif | ||
ifeq (MSYS,$(word 1,$(subst _, ,$(PLATFORM)))) # GCC | ||
MEXEXT = mexw64 | ||
MEXBIN ?= mex | ||
MEXOPTS += -DSPM_WIN32 | ||
MOSUF = obj | ||
endif | ||
|
||
#### Octave #### | ||
ifeq (octave,$(PLATFORM)) | ||
MEXEXT = mex | ||
MEXBIN ?= mkoctfile | ||
MEXOPTS = --mex -DOCTAVE_MEX_FILE | ||
#MEXOPTS += $(WARNFLAG) | ||
override PLATFORM = $(shell $(UNAME)) | ||
ifeq (MINGW64,$(word 1,$(subst _, ,$(PLATFORM)))) | ||
MEXOPTS += -DSPM_WIN32 | ||
endif | ||
OMPFLAG = | ||
endif | ||
|
||
#### Otherwise #### | ||
ifndef MEXEXT | ||
$(error Unknowm platform $(PLATFORM)) | ||
endif | ||
|
||
MATLABROOT = $(realpath $(shell which $(firstword $(MEXBIN)))) | ||
ifeq (1,$(USE_OPENMP)) | ||
ifneq ($(OMPFLAG),) | ||
MEXOPTS += CFLAGS='$$CFLAGS $(OMPFLAG)' LDFLAGS='$$LDFLAGS $(OMPFLAG)' | ||
endif | ||
endif | ||
MEX = $(MEXBIN) $(MEXOPTS) | ||
SUF = $(MEXEXT) | ||
|
||
define verb | ||
@ echo "_____________________________________________________________" | ||
@ echo "" | ||
@ echo " " $(1) | ||
@ echo "_____________________________________________________________" | ||
@ echo "" | ||
endef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.