--- a/src/Makefile
+++ b/src/Makefile
@@ -1,83 +1,165 @@
-# Use GNU Make to process this file
-#CC = i686-pc-mingw32-gcc 
-CC = gcc
-
-
-CFLAGS=-O2 -Wall -g -fPIC -std=c99 -I../thirdparty -L../thirdparty
-#CFLAGS=-O2 -fPIC -std=c99 -I../thirdparty -L../thirdparty
-
-files = \
-	sdgt.o sdgt_fac.o sdgtreal_fac.o sidgt_fac.o sdgt_fb.o		\
-	sdgt_walnut.o ddgt.o ddgt_fac.o ddgtreal_fac.o didgt_fac.o	\
-	ddgt_ola.o sdgt_ola.o \
-	ddgt_fb.o ddgt_walnut.o \
-	swfac.o siwfac.o sidgt_fb.o didgt_fb.o \
-	sreassign.o swindows.o dwfac.o diwfac.o		\
-	dreassign.o dwindows.o sspread.o sheapint.o swinmanip.o		\
-	dspread.o dheapint.o dwinmanip.o \
-	sdwilt.o stfutil.o sfilterbank.o \
-	ddwilt.o dtfutil.o dfilterbank.o \
-	spfilt.o dpfilt.o \
-	sdgt_shear.o ddgt_shear.o \
-	sdgt_multi.o ddgt_multi.o \
-	integer_manip.o 
-
-files_blaslapack = \
-	sgabdual.o sgabtight.o sgabdual_fac.o sgabtight_fac.o \
-	dgabdual.o dgabtight.o dgabdual_fac.o dgabtight_fac.o 	
-
-files_unix = $(files) $(files_blaslapack) dltfat_blaslapack.o sltfat_blaslapack.o
-files_matlab = $(files) $(files_blaslapack) dltfat_blaslapack_matlab.o sltfat_blaslapack_matlab.o
-
-all: libltfat.a unixnomem
-
-win_ms: $(files) c-safe-memalloc.o
-	gcc -shared -o ltfat.dll -Wl,--output-def,ltfat.def,--out-implib,libltfat_dll.a \
-		-L../thirdparty -lfftw3-3 -lfftw3f-3 $(files) c-safe-memalloc.o
-	cp -f ltfat.dll ../mex/
-	cp -f ltfat.def ../mex/
-	echo "To finish the creation, please run the Microsoft lib tool on ltfat.dll and ltfat.def"
-
-wincrosscompile: $(files_matlab)
-	ar rvu libltfat-nomem.lib $(files_matlab)
-	ranlib libltfat-nomem.lib
-	cp -f libltfat-nomem.lib ../lib/
-
-winnomem: $(files_matlab)
-	ar rvu libltfat-nomem.lib $(files_matlab)
-	ranlib libltfat-nomem.lib
-	dlltool -z libltfat-nomem.def --export-all-symbols libltfat-nomem.lib
-	cp -f libltfat-nomem.lib ../lib/
-	cp -f libltfat-nomem.def ../lib/
-
-unixnomem: $(files_unix) 
-	ar rvu libltfat-nomem.a $(files_unix)
-	ranlib libltfat-nomem.a
-	cp -f libltfat-nomem.a ../lib
-
-libltfat.a: $(files_unix) c-safe-memalloc.o 
-	ar rvu libltfat.a $(files_unix) c-safe-memalloc.o
-	ranlib libltfat.a
-	cp -f libltfat.a ../lib
-
-libltfat.so: $(files_unix) c-safe-memalloc.o
-	gcc -shared -Wl,-soname,libltfat.so.1 -o libltfat.so.1.0 $(files_unix) c-safe-memalloc.o
-
-sltfat_blaslapack_matlab.o: ltfat_blaslapack.c config.h
-	$(CC) $(CFLAGS) -DLTFAT_SINGLE -DMATLABFORTRAN -c $< -o $*.o
-
-dltfat_blaslapack_matlab.o: ltfat_blaslapack.c config.h
-	$(CC) $(CFLAGS) -DLTFAT_DOUBLE -DMATLABFORTRAN -c $< -o $*.o
-
-
-s%.o: %.c config.h
-	$(CC) $(CFLAGS) -DLTFAT_SINGLE  -c $< -o s$*.o
-
-d%.o: %.c config.h
-	$(CC) $(CFLAGS) -DLTFAT_DOUBLE  -c $< -o d$*.o
-
-%.o: %.c Makefile config.h
-	$(CC) $(CFLAGS) -I../thirdparty -c $<
-
-clean:
-	rm *.o *.a 
+# CMAKE generated file: DO NOT EDIT!
+# Generated by "MinGW Makefiles" Generator, CMake Version 2.8
+
+# Default target executed when no arguments are given to make.
+default_target: all
+.PHONY : default_target
+
+#=============================================================================
+# Special targets provided by cmake.
+
+# Disable implicit rules so canonical targets will work.
+.SUFFIXES:
+
+# Remove some rules from gmake that .SUFFIXES does not remove.
+SUFFIXES =
+
+.SUFFIXES: .hpux_make_needs_suffix_list
+
+# Suppress display of executed commands.
+$(VERBOSE).SILENT:
+
+# A target that is always out of date.
+cmake_force:
+.PHONY : cmake_force
+
+#=============================================================================
+# Set environment variables for the build.
+
+SHELL = cmd.exe
+
+# The CMake executable.
+CMAKE_COMMAND = "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe"
+
+# The command to remove a file.
+RM = "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E remove -f
+
+# Escaping for special characters.
+EQUALS = =
+
+# The program to use to edit the cache.
+CMAKE_EDIT_COMMAND = "C:\Program Files (x86)\CMake 2.8\bin\cmake-gui.exe"
+
+# The top-level source directory on which CMake was run.
+CMAKE_SOURCE_DIR = D:\LTFAT\ltfat\src
+
+# The top-level build directory on which CMake was run.
+CMAKE_BINARY_DIR = D:\LTFAT\ltfat\src
+
+#=============================================================================
+# Targets provided globally by CMake.
+
+# Special rule for the target edit_cache
+edit_cache:
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
+	"C:\Program Files (x86)\CMake 2.8\bin\cmake-gui.exe" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : edit_cache
+
+# Special rule for the target edit_cache
+edit_cache/fast: edit_cache
+.PHONY : edit_cache/fast
+
+# Special rule for the target rebuild_cache
+rebuild_cache:
+	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
+	"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : rebuild_cache
+
+# Special rule for the target rebuild_cache
+rebuild_cache/fast: rebuild_cache
+.PHONY : rebuild_cache/fast
+
+# The main all target
+all: cmake_check_build_system
+	$(CMAKE_COMMAND) -E cmake_progress_start D:\LTFAT\ltfat\src\CMakeFiles D:\LTFAT\ltfat\src\CMakeFiles\progress.marks
+	$(MAKE) -f CMakeFiles\Makefile2 all
+	$(CMAKE_COMMAND) -E cmake_progress_start D:\LTFAT\ltfat\src\CMakeFiles 0
+.PHONY : all
+
+# The main clean target
+clean:
+	$(MAKE) -f CMakeFiles\Makefile2 clean
+.PHONY : clean
+
+# The main clean target
+clean/fast: clean
+.PHONY : clean/fast
+
+# Prepare targets for installation.
+preinstall: all
+	$(MAKE) -f CMakeFiles\Makefile2 preinstall
+.PHONY : preinstall
+
+# Prepare targets for installation.
+preinstall/fast:
+	$(MAKE) -f CMakeFiles\Makefile2 preinstall
+.PHONY : preinstall/fast
+
+# clear depends
+depend:
+	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 1
+.PHONY : depend
+
+#=============================================================================
+# Target rules for targets named block_interface
+
+# Build rule for target.
+block_interface: cmake_check_build_system
+	$(MAKE) -f CMakeFiles\Makefile2 block_interface
+.PHONY : block_interface
+
+# fast build rule for target.
+block_interface/fast:
+	$(MAKE) -f CMakeFiles\block_interface.dir\build.make CMakeFiles/block_interface.dir/build
+.PHONY : block_interface/fast
+
+block_interface.obj: block_interface.c.obj
+.PHONY : block_interface.obj
+
+# target to build an object file
+block_interface.c.obj:
+	$(MAKE) -f CMakeFiles\block_interface.dir\build.make CMakeFiles/block_interface.dir/block_interface.c.obj
+.PHONY : block_interface.c.obj
+
+block_interface.i: block_interface.c.i
+.PHONY : block_interface.i
+
+# target to preprocess a source file
+block_interface.c.i:
+	$(MAKE) -f CMakeFiles\block_interface.dir\build.make CMakeFiles/block_interface.dir/block_interface.c.i
+.PHONY : block_interface.c.i
+
+block_interface.s: block_interface.c.s
+.PHONY : block_interface.s
+
+# target to generate assembly for a file
+block_interface.c.s:
+	$(MAKE) -f CMakeFiles\block_interface.dir\build.make CMakeFiles/block_interface.dir/block_interface.c.s
+.PHONY : block_interface.c.s
+
+# Help Target
+help:
+	@echo The following are some of the valid targets for this Makefile:
+	@echo ... all (the default if no target is provided)
+	@echo ... clean
+	@echo ... depend
+	@echo ... block_interface
+	@echo ... edit_cache
+	@echo ... rebuild_cache
+	@echo ... block_interface.obj
+	@echo ... block_interface.i
+	@echo ... block_interface.s
+.PHONY : help
+
+
+
+#=============================================================================
+# Special targets to cleanup operation of make.
+
+# Special rule to run CMake to check the build system integrity.
+# No rule that depends on this can have commands that come from listfiles
+# because they might be regenerated.
+cmake_check_build_system:
+	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 0
+.PHONY : cmake_check_build_system
+