Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[7c7a96]: mex / Makefile_mingw Maximize Restore History

Download this file

Makefile_mingw    58 lines (39 with data), 1.6 kB

# To run this makefile, you must provide your system specific EXT and MATLABROOT
# variables on the command line e.g.:
#
# make -f Makefile_mingw64 MATLABROOT="C:\Program Files\MATLAB\R2011b"  EXT=mexw64 ARCH=win64

ifndef MATLABROOT
  $(warning MATLABROOT variable is udefined. Using default MATLABROOT="C:\Program Files\MATLAB\R2011b" )
  MATLABROOT=C:\Program Files\MATLAB\R2011b
endif

ifndef EXT
  $(warning EXT variable is udefined. Using default EXT=mexw64 )
  EXT=mexw64
endif

ifndef ARCH
  $(warning ARCH variable is udefined. Using default ARCH=win64 )
  ARCH=win64
endif

CC=gcc
CFLAGS=-O3 -shared -Wall -s -std=c99 -I../src/thirdparty -I../src -fvisibility=hidden

include filedefs.mk

SHAREDEXT = dll

MEXBASE = $(MEXBASESAFE) $(MEXBASEMORE)
MEXS    = $(addsuffix .$(EXT),$(MEXBASE))
MEXLINKS  = $(addsuffix .$(SHAREDEXT),$(MEXSOFTLINKS))
MEXDEPEND = $(addsuffix .$(EXT),$(MEXDEPENDFILES))


MEXCOMPFLAGS=-I"$(MATLABROOT)\extern\include" -DMATLAB_MEX_FILE
MEXLIBS=-lmex -lmx 
MEXLINKFLAGS=-static-libgcc -Wl,--dll -L"$(MATLABROOT)\bin\$(ARCH)" $(MEXLIBS)



all: $(MEXS) $(MEXLINKS) $(MEXDEPEND) killlinks

$(MEXS): %.$(EXT): %.c 
	$(CC) $(CFLAGS) $(MEXCOMPFLAGS) $< -o $@ -L../lib -lltfat -lltfatf -L./ -lfftw3-3 -lfftw3f-3 $(MEXLINKFLAGS)

$(MEXLINKS): %.$(SHAREDEXT): %.$(EXT)
	copy /Y $< $(addprefix lib,$@)

$(MEXDEPEND): %.$(EXT): %.c
	$(CC) $(CFLAGS) $(MEXCOMPFLAGS) $< -o $@ -L../lib -lltfat -lltfatf -L./ $(addprefix -l,$(MEXSOFTLINKS)) -lfftw3-3 -lfftw3f-3 $(MEXLINKFLAGS) 

killlinks:
	del $(addprefix lib, $(MEXLINKS))
	
clean: killlinks
	del *.$(EXT)

.PHONY: all clean