aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-08-16 22:41:53 +0200
committerGitHub <noreply@github.com>2016-08-16 22:41:53 +0200
commit1419f3983ef28cf8c9ec8837010bef498f085b63 (patch)
treeaf6dcf4248b2fba5e4e67ae3241fa1715a7c6b86
parent5767e4bc4db8d70bd02945769b6784618f7d003a (diff)
parent5299b170568bd1de71c906eeb8929a053febc039 (diff)
downloadyosys-1419f3983ef28cf8c9ec8837010bef498f085b63.tar.gz
yosys-1419f3983ef28cf8c9ec8837010bef498f085b63.tar.bz2
yosys-1419f3983ef28cf8c9ec8837010bef498f085b63.zip
Merge pull request #203 from cr1901/master
Add MSYS2-compatible build.
-rw-r--r--Makefile18
-rw-r--r--kernel/yosys.cc3
2 files changed, 17 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 77279494e..7054bf55d 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@ CONFIG := clang
# CONFIG := gcc-4.8
# CONFIG := emcc
# CONFIG := mxe
+CONFIG := msys2
# features (the more the better)
ENABLE_TCL := 1
@@ -172,8 +173,19 @@ ABCMKARGS += ARCHFLAGS="-DSIZEOF_VOID_P=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4 -DWIN32
ABCMKARGS += LIBS="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE=1 CC="$(CXX)" CXX="$(CXX)"
EXE = .exe
+else ifeq ($(CONFIG),msys2)
+CXX = i686-w64-mingw32-gcc
+LD = i686-w64-mingw32-gcc
+CXXFLAGS += -std=c++11 -Os -D_POSIX_SOURCE -DYOSYS_WIN32_UNIX_DIR
+CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
+LDFLAGS := $(filter-out -rdynamic,$(LDFLAGS)) -s
+LDLIBS := $(filter-out -lrt,$(LDLIBS))
+ABCMKARGS += ARCHFLAGS="-DSIZEOF_VOID_P=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4 -DWIN32_NO_DLL -DHAVE_STRUCT_TIMESPEC -x c++ -fpermissive -w"
+ABCMKARGS += LIBS="lib/x86/pthreadVC2.lib -s" ABC_USE_NO_READLINE=0 CC="$(CXX)" CXX="$(CXX)"
+EXE = .exe
+
else ifneq ($(CONFIG),none)
-$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, gcc-4.8, emcc, none)
+$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, gcc-4.8, emcc, mxe, msys2)
endif
ifeq ($(ENABLE_LIBYOSYS),1)
@@ -514,6 +526,9 @@ config-mxe: clean
echo 'ENABLE_PLUGINS := 0' >> Makefile.conf
echo 'ENABLE_READLINE := 0' >> Makefile.conf
+config-msys2: clean
+ echo 'CONFIG := msys2' > Makefile.conf
+
config-gprof: clean
echo 'CONFIG := gcc' > Makefile.conf
echo 'ENABLE_GPROF := 1' >> Makefile.conf
@@ -536,4 +551,3 @@ echo-git-rev:
.PHONY: all top-all abc test install install-abc manual clean mrproper qtcreator
.PHONY: config-clean config-clang config-gcc config-gcc-4.8 config-gprof config-sudo
-
diff --git a/kernel/yosys.cc b/kernel/yosys.cc
index 42ccf13f7..17f6847b5 100644
--- a/kernel/yosys.cc
+++ b/kernel/yosys.cc
@@ -687,7 +687,7 @@ std::string proc_share_dirname()
std::string proc_share_dirname()
{
std::string proc_self_path = proc_self_dirname();
-# ifdef _WIN32
+# if defined(_WIN32) && !defined(YOSYS_WIN32_UNIX_DIR)
std::string proc_share_path = proc_self_path + "share\\";
if (check_file_exists(proc_share_path, true))
return proc_share_path;
@@ -1130,4 +1130,3 @@ struct ScriptCmdPass : public Pass {
} ScriptCmdPass;
YOSYS_NAMESPACE_END
-