From ccf7b2e342cd4212ca2c2c94735a3f916b7d790f Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 9 Oct 2014 10:50:44 +0200 Subject: [PATCH] Added mxe-based cross build for win32 --- Makefile | 24 +++++++++++++++++++++--- passes/techmap/Makefile.inc | 6 +++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 00979c464..6faeeb4ce 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ CONFIG := clang # CONFIG := gcc # CONFIG := gcc-4.6 # CONFIG := emcc +# CONFIG := mxe # features (the more the better) ENABLE_TCL := 1 @@ -17,10 +18,11 @@ ENABLE_GPROF := 0 DESTDIR := /usr/local INSTALL_SUDO := +EXE = OBJS = GENFILES = EXTRA_TARGETS = -TARGETS = yosys yosys-config +TARGETS = yosys$(EXE) yosys-config PRETTY = 1 SMALL = 0 @@ -83,6 +85,15 @@ else ifeq ($(CONFIG),emcc) CXX = emcc CXXFLAGS += -std=c++11 -Os -Wno-warn-absolute-paths CXXFLAGS := $(filter-out -ggdb,$(CXXFLAGS)) +EXE = .html + +else ifeq ($(CONFIG),mxe) +CXX = /usr/local/src/mxe/usr/bin/i686-pc-mingw32-gcc +CXXFLAGS += -std=gnu++0x -Os -D_POSIX_SOURCE +CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS)) +LDFLAGS := $(filter-out -rdynamic,$(LDFLAGS)) +LDLIBS := $(filter-out -lrt,$(LDLIBS)) +EXE = .exe else ifneq ($(CONFIG),none) $(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, gcc-4.6, emcc, none) @@ -192,8 +203,8 @@ top-all: $(TARGETS) $(EXTRA_TARGETS) @echo " Build successful." @echo "" -yosys: $(OBJS) - $(P) $(CXX) -o yosys $(LDFLAGS) $(OBJS) $(LDLIBS) +yosys$(EXE): $(OBJS) + $(P) $(CXX) -o yosys$(EXE) $(LDFLAGS) $(OBJS) $(LDLIBS) %.o: %.cc $(P) $(CXX) -o $@ -c $(CXXFLAGS) $< @@ -314,6 +325,13 @@ config-emcc: clean echo 'ENABLE_PLUGINS := 0' >> Makefile.conf echo 'ENABLE_READLINE := 0' >> Makefile.conf +config-mxe: clean + echo 'CONFIG := mxe' > Makefile.conf + echo 'ENABLE_TCL := 0' >> Makefile.conf + echo 'ENABLE_ABC := 0' >> Makefile.conf + echo 'ENABLE_PLUGINS := 0' >> Makefile.conf + echo 'ENABLE_READLINE := 0' >> Makefile.conf + config-gprof: clean echo 'CONFIG := gcc' > Makefile.conf echo 'ENABLE_GPROF := 1' >> Makefile.conf diff --git a/passes/techmap/Makefile.inc b/passes/techmap/Makefile.inc index 72998f87b..9152ff22d 100644 --- a/passes/techmap/Makefile.inc +++ b/passes/techmap/Makefile.inc @@ -23,9 +23,9 @@ passes/techmap/techmap.inc: techlibs/common/techmap.v passes/techmap/techmap.o: passes/techmap/techmap.inc -TARGETS += yosys-filterlib +TARGETS += yosys-filterlib$(EXE) GENFILES += passes/techmap/filterlib.o -yosys-filterlib: passes/techmap/filterlib.o - $(P) $(CXX) -o yosys-filterlib $(LDFLAGS) $^ $(LDLIBS) +yosys-filterlib$(EXE): passes/techmap/filterlib.o + $(P) $(CXX) -o yosys-filterlib$(EXE) $(LDFLAGS) $^ $(LDLIBS) -- 2.30.2