From a519d2ab828517fda323f6421fd98cf73603fc0e Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 14 Feb 2016 13:47:27 +0100 Subject: Added/improved support for mxe-based win32 cross builds --- .gitignore | 2 ++ Makefile | 7 +++++++ config.mk | 5 +++++ icemulti/.gitignore | 1 + icemulti/Makefile | 6 ++++-- icemulti/icemulti.cc | 1 + icepack/.gitignore | 1 + icepack/Makefile | 11 ++++++----- icepll/.gitignore | 1 + icepll/Makefile | 9 ++++++--- iceprog/.gitignore | 1 + iceprog/Makefile | 11 ++++++----- icetime/.gitignore | 1 + icetime/Makefile | 7 ++++--- 14 files changed, 46 insertions(+), 18 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d6d9baf --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +icestorm-win32.zip +icestorm-win32/ diff --git a/Makefile b/Makefile index 5e23184..8c2bfd5 100644 --- a/Makefile +++ b/Makefile @@ -32,5 +32,12 @@ uninstall: $(MAKE) -C icepll uninstall $(MAKE) -C icetime uninstall +mxebin: clean + $(MAKE) MXE=1 + rm -rf icestorm-win32 && mkdir icestorm-win32 + cp icebox/chipdb-*.txt icepack/*.exe iceprog/*.exe icestorm-win32/ + cp icemulti/*.exe icepll/*.exe icetime/*.exe icestorm-win32/ + zip -r icestorm-win32.zip icestorm-win32/ + .PHONY: all clean install uninstall diff --git a/config.mk b/config.mk index fa17007..36c03c2 100644 --- a/config.mk +++ b/config.mk @@ -2,3 +2,8 @@ CXX = clang CC = $(CXX) DESTDIR ?= PREFIX ?= /usr/local + +ifeq ($(MXE),1) +EXE = .exe +CXX = /usr/local/src/mxe/usr/bin/i686-pc-mingw32-gcc +endif diff --git a/icemulti/.gitignore b/icemulti/.gitignore index 51ac8f9..9254c71 100644 --- a/icemulti/.gitignore +++ b/icemulti/.gitignore @@ -1,3 +1,4 @@ icemulti +icemulti.exe icemulti.o icemulti.d diff --git a/icemulti/Makefile b/icemulti/Makefile index 387549d..c901413 100644 --- a/icemulti/Makefile +++ b/icemulti/Makefile @@ -2,9 +2,10 @@ include ../config.mk LDLIBS = -lm -lstdc++ CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -all: icemulti +all: icemulti$(EXE) -icemulti: icemulti.o +icemulti$(EXE): icemulti.o + $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) install: all mkdir -p $(DESTDIR)$(PREFIX)/bin @@ -15,6 +16,7 @@ uninstall: clean: rm -f icemulti + rm -f icemulti.exe rm -f *.o *.d -include *.d diff --git a/icemulti/icemulti.cc b/icemulti/icemulti.cc index 9bf06df..7c20e0a 100644 --- a/icemulti/icemulti.cc +++ b/icemulti/icemulti.cc @@ -20,6 +20,7 @@ #include #include +#include #define log(...) fprintf(stderr, __VA_ARGS__); #define info(...) do { if (log_level > 0) fprintf(stderr, __VA_ARGS__); } while (0) diff --git a/icepack/.gitignore b/icepack/.gitignore index c531272..ef4173d 100644 --- a/icepack/.gitignore +++ b/icepack/.gitignore @@ -1,4 +1,5 @@ icepack +icepack.exe iceunpack icepack.o icepack.d diff --git a/icepack/Makefile b/icepack/Makefile index 256c339..78701db 100644 --- a/icepack/Makefile +++ b/icepack/Makefile @@ -3,16 +3,17 @@ LDLIBS = -lm -lstdc++ CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include MXEGCC = /usr/local/src/mxe/usr/bin/i686-pc-mingw32-gcc -all: icepack iceunpack +all: icepack$(EXE) iceunpack$(EXE) -icepack: icepack.o - -icepack.exe: icepack.cc - $(MXEGCC) -std=c++11 -o icepack.exe -Os icepack.cc -lm -lstdc++ +icepack$(EXE): icepack.o + $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) iceunpack: icepack ln -sf icepack iceunpack +iceunpack.exe: + # no iceunpack.exe, use icepack -u + install: all mkdir -p $(DESTDIR)$(PREFIX)/bin cp icepack $(DESTDIR)$(PREFIX)/bin/icepack diff --git a/icepll/.gitignore b/icepll/.gitignore index 385a169..418d25b 100644 --- a/icepll/.gitignore +++ b/icepll/.gitignore @@ -1,3 +1,4 @@ icepll +icepll.exe icepll.o icepll.d diff --git a/icepll/Makefile b/icepll/Makefile index 9a190f6..b47de3e 100644 --- a/icepll/Makefile +++ b/icepll/Makefile @@ -2,9 +2,10 @@ include ../config.mk LDLIBS = -lm -lstdc++ CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include -all: icepll +all: icepll$(EXE) -icepll: icepll.o +icepll$(EXE): icepll.o + $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) install: all mkdir -p $(DESTDIR)$(PREFIX)/bin @@ -14,7 +15,9 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/icepll clean: - rm -f icepll *.o *.d + rm -f icepll + rm -f icepll.exe + rm -f *.o *.d -include *.d diff --git a/iceprog/.gitignore b/iceprog/.gitignore index 2d50774..6c84476 100644 --- a/iceprog/.gitignore +++ b/iceprog/.gitignore @@ -1,3 +1,4 @@ iceprog +iceprog.exe iceprog.o iceprog.d diff --git a/iceprog/Makefile b/iceprog/Makefile index 4ffb9a5..b9f00d9 100644 --- a/iceprog/Makefile +++ b/iceprog/Makefile @@ -1,14 +1,15 @@ include ../config.mk LDLIBS = -L/usr/local/lib -lftdi -lm CFLAGS = -MD -O0 -ggdb -Wall -std=c99 -I/usr/local/include -MXEGCC = /usr/local/src/mxe/usr/bin/i686-pc-mingw32-gcc -all: iceprog +ifeq ($(MXE),1) +LDLIBS += -lusb +endif -iceprog: iceprog.o +all: iceprog$(EXE) -iceprog.exe: iceprog.c - $(MXEGCC) -std=c99 -o iceprog.exe -Os iceprog.c -lftdi -lusb -lm +iceprog$(EXE): iceprog.o + $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) install: all mkdir -p $(DESTDIR)$(PREFIX)/bin diff --git a/icetime/.gitignore b/icetime/.gitignore index fd24fa8..5c1b012 100644 --- a/icetime/.gitignore +++ b/icetime/.gitignore @@ -1,4 +1,5 @@ icetime +icetime.exe timings.inc test[0-9]* *.d diff --git a/icetime/Makefile b/icetime/Makefile index 15e635f..6355f06 100644 --- a/icetime/Makefile +++ b/icetime/Makefile @@ -2,9 +2,10 @@ include ../config.mk LDLIBS = -lm -lstdc++ CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include -DPREFIX='"$(PREFIX)"' -all: icetime +all: icetime$(EXE) -icetime: icetime.o +icetime$(EXE): icetime.o + $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) icetime.o: icetime.cc timings.inc @@ -41,7 +42,7 @@ test: test0 test1 test2 test3 test4 test5 test6 test7 test8 test9 show: show0 show1 show2 show3 show4 show5 show6 show7 show8 show9 clean: - rm -f icetime timings.inc *.o *.d + rm -f icetime icetime.exe timings.inc *.o *.d rm -rf test[0-9]* -include *.d -- cgit v1.2.3