about summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 36 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index f8bacbf..bdb58b2 100644
--- a/Makefile
+++ b/Makefile
@@ -41,7 +41,19 @@
 GEMMA_VERSION = $(shell cat ./VERSION)
 
 # Set this variable to either LNX or MAC
-SYS                    = LNX # LNX|MAC (Linux is the default)
+ifeq ($(OS),Windows_NT)
+  SYS = WIN
+  VGEN = scripts/gen_version_info.cmd
+else
+  UNAME_S := $(shell uname -s)
+  ifeq ($(UNAME_S),Darwin)
+    SYS = MAC
+  else
+    SYS = LNX # default to linux
+  endif
+  VGEN = scripts/gen_version_info.sh
+endif
+
 # Leave blank after "=" to disable; put "= 1" to enable
 DIST_NAME              = gemma-$(GEMMA_VERSION)
 DEBUG                  = 1                # DEBUG mode, set DEBUG=0 for a release
@@ -53,8 +65,20 @@ OPENBLAS_LEGACY        =                  # Using older OpenBlas
 FORCE_STATIC           =                  # Static linking of libraries
 GCC_FLAGS              = -Wall -O3 -std=gnu++11 # extra flags -Wl,--allow-multiple-definition
 TRAVIS_CI              =                  # used by TRAVIS for testing
-EIGEN_INCLUDE_PATH     = /usr/include/eigen3
-OPENBLAS_INCLUDE_PATH  = /usr/local/opt/openblas/include
+
+GSL_INCLUDE_PATH =
+ifeq ($(SYS), WIN)
+  GSL_INCLUDE_PATH = -isystemc:/MinGW/include -LC:/MinGW/lib
+  EIGEN_INCLUDE_PATH = ../eigen-git-mirror
+  OPENBLAS_INCLUDE_PATH = ../OpenBLAS-v0.2.19-Win64-int32/include -L../OpenBLAS-v0.2.19-Win64-int32/lib
+else
+  OPENBLAS_INCLUDE_PATH = /usr/local/opt/openblas/include
+  ifeq ($(SYS), MAC)
+  EIGEN_INCLUDE_PATH = /usr/local/include/eigen3
+  else
+  EIGEN_INCLUDE_PATH = /usr/include/eigen3
+  endif
+endif
 
 # --------------------------------------------------------------------
 # Edit below this line with caution
@@ -73,13 +97,13 @@ endif
 
 ifeq ($(CPP), clang++)
   # macOS Homebrew settings (as used on Travis-CI)
-  GCC_FLAGS=-O3 -std=c++11 -stdlib=libc++ -isystem/$(OPENBLAS_INCLUDE_PATH) -isystem//usr/local/include/eigen3 -Wl,-L/usr/local/opt/openblas/lib
+  GCC_FLAGS=-O3 -std=c++11 -stdlib=libc++ -isystem$(OPENBLAS_INCLUDE_PATH) -isystem$(EIGEN_INCLUDE_PATH) -Wl,-L/usr/local/opt/openblas/lib
 endif
 
 ifdef WITH_OPENBLAS
   OPENBLAS=1
   # WITH_LAPACK =  # OPENBLAS usually includes LAPACK
-  CPPFLAGS += -DOPENBLAS -isystem/$(OPENBLAS_INCLUDE_PATH)
+  CPPFLAGS += -DOPENBLAS -isystem$(OPENBLAS_INCLUDE_PATH)
   ifdef OPENBLAS_LEGACY
     # Legacy version (mostly for Travis-CI)
     CPPFLAGS += -DOPENBLAS_LEGACY
@@ -87,10 +111,14 @@ ifdef WITH_OPENBLAS
 endif
 
 ifdef DEBUG
-  CPPFLAGS += -g $(GCC_FLAGS) -isystem/$(EIGEN_INCLUDE_PATH) -Icontrib/catch-1.9.7 -Isrc
+  CPPFLAGS += -g $(GCC_FLAGS) $(GSL_INCLUDE_PATH) -isystem$(EIGEN_INCLUDE_PATH) -Icontrib/catch-1.9.7 -Isrc
 else
   # release mode
-  CPPFLAGS += -DNDEBUG $(GCC_FLAGS) -isystem/$(EIGEN_INCLUDE_PATH) -Icontrib/catch-1.9.7 -Isrc
+  CPPFLAGS += -DNDEBUG $(GCC_FLAGS) $(GSL_INCLUDE_PATH) -isystem$(EIGEN_INCLUDE_PATH) -Icontrib/catch-1.9.7 -Isrc
+endif
+
+ifeq ($(SYS), WIN)
+  CPPFLAGS += -Duint="unsigned int" -D__CRT__NO_INLINE -D__STRING="__STRINGIFY" -DWINDOWS -DWITH_GSLCBLAS=1
 endif
 
 ifdef SHOW_COMPILER_WARNINGS
@@ -149,7 +177,7 @@ OBJS = $(SOURCES:.cpp=.o)
 all: $(OUTPUT)
 
 ./src/version.h:
-	./scripts/gen_version_info.sh > src/version.h
+	$(VGEN) > src/version.h
 
 $(OUTPUT): $(OBJS)
 	$(CPP) $(CPPFLAGS) $(OBJS) $(LIBS) -o $(OUTPUT)