aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2018-07-26 10:55:09 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2018-07-26 10:55:09 +0800
commit9b8a4bbd9951932f7b9afd12e67b0ebcf42515af (patch)
tree0fad014da608d3c4efa5a5383b21f6cc455f2203
parent1b913a60e6b15554fec6ef67503b7c961aaacf1f (diff)
downloadtangerine-mcl-9b8a4bbd9951932f7b9afd12e67b0ebcf42515af.tar.gz
tangerine-mcl-9b8a4bbd9951932f7b9afd12e67b0ebcf42515af.tar.zst
tangerine-mcl-9b8a4bbd9951932f7b9afd12e67b0ebcf42515af.zip
makefile to support cygwin/mingw
-rw-r--r--Makefile14
-rw-r--r--common.mk9
-rw-r--r--include/mcl/fp.hpp2
-rw-r--r--src/fp.cpp2
-rw-r--r--src/fp_generator.hpp2
-rw-r--r--src/low_func.hpp2
6 files changed, 21 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 0b86c40..8c2fdec 100644
--- a/Makefile
+++ b/Makefile
@@ -74,10 +74,18 @@ SHE256_OBJ=$(OBJ_DIR)/she_c256.o
SHE384_OBJ=$(OBJ_DIR)/she_c384.o
ECDSA_OBJ=$(OBJ_DIR)/ecdsa_c.o
FUNC_LIST=src/func.list
-MCL_USE_LLVM?=1
+ifeq ($(findstring $(OS),mingw64/cygwin),)
+ MCL_USE_LLVM?=1
+else
+ MCL_USE_LLVM=0
+endif
ifeq ($(MCL_USE_LLVM),1)
CFLAGS+=-DMCL_USE_LLVM=1
LIB_OBJ+=$(ASM_OBJ)
+ # special case for intel with bmi2
+ ifeq ($(INTEL),1)
+ LIB_OBJ+=$(OBJ_DIR)/$(CPU).bmi2.o
+ endif
endif
LLVM_SRC=src/base$(BIT).ll
@@ -95,10 +103,6 @@ ifeq ($(USE_LOW_ASM),1)
LOW_ASM_OBJ=$(LOW_ASM_SRC:.asm=.o)
LIB_OBJ+=$(LOW_ASM_OBJ)
endif
-# special case for intel with bmi2
-ifeq ($(INTEL),1)
- LIB_OBJ+=$(OBJ_DIR)/$(CPU).bmi2.o
-endif
ifeq ($(UPDATE_ASM),1)
ASM_SRC_DEP=$(LLVM_SRC)
diff --git a/common.mk b/common.mk
index 3cf8638..aefa516 100644
--- a/common.mk
+++ b/common.mk
@@ -3,6 +3,13 @@ UNAME_S=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS=Linux
endif
+ifeq ($(findstring MINGW64,$(UNAME_S)),MINGW64)
+ OS=mingw64
+ CFLAGS+=-D__USE_MINGW_ANSI_STDIO=1
+endif
+ifeq ($(findstring CYGWIN,$(UNAME_S)),CYGWIN)
+ OS=cygwin
+endif
ifeq ($(UNAME_S),Darwin)
OS=mac
ARCH=x86_64
@@ -44,7 +51,7 @@ ifeq ($(ARCH),aarch64)
CPU=aarch64
BIT=64
endif
-ifneq ($(UNAME_S),Darwin)
+ifeq ($(findstring $(OS),Darwin/mingw64),)
LDFLAGS+=-lrt
endif
diff --git a/include/mcl/fp.hpp b/include/mcl/fp.hpp
index 0faa181..c2b0cc8 100644
--- a/include/mcl/fp.hpp
+++ b/include/mcl/fp.hpp
@@ -590,6 +590,6 @@ struct hash<mcl::FpT<tag, maxBitSize> > {
CYBOZU_NAMESPACE_TR1_END } // std::tr1
#endif
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/src/fp.cpp b/src/fp.cpp
index aa8924c..dfa6e11 100644
--- a/src/fp.cpp
+++ b/src/fp.cpp
@@ -648,7 +648,7 @@ int64_t getInt64(bool *pb, fp::Block& b, const fp::Op& op)
return 0;
}
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/src/fp_generator.hpp b/src/fp_generator.hpp
index ab829c8..1f6af7c 100644
--- a/src/fp_generator.hpp
+++ b/src/fp_generator.hpp
@@ -2894,7 +2894,7 @@ private:
} } // mcl::fp
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif
diff --git a/src/low_func.hpp b/src/low_func.hpp
index 232f9eb..57c63cf 100644
--- a/src/low_func.hpp
+++ b/src/low_func.hpp
@@ -701,6 +701,6 @@ const void4u Fp2MulNF<N, Tag>::f = Fp2MulNF<N, Tag>::func;
} } // mcl::fp
-#ifdef _WIN32
+#ifdef _MSC_VER
#pragma warning(pop)
#endif