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 > { 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::f = Fp2MulNF::func; } } // mcl::fp -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning(pop) #endif