Skip to content

Commit a519d2a

Browse files
committed
Added/improved support for mxe-based win32 cross builds
1 parent 04e6143 commit a519d2a

File tree

14 files changed

+46
-18
lines changed

14 files changed

+46
-18
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
icestorm-win32.zip
2+
icestorm-win32/

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,12 @@ uninstall:
3232
$(MAKE) -C icepll uninstall
3333
$(MAKE) -C icetime uninstall
3434

35+
mxebin: clean
36+
$(MAKE) MXE=1
37+
rm -rf icestorm-win32 && mkdir icestorm-win32
38+
cp icebox/chipdb-*.txt icepack/*.exe iceprog/*.exe icestorm-win32/
39+
cp icemulti/*.exe icepll/*.exe icetime/*.exe icestorm-win32/
40+
zip -r icestorm-win32.zip icestorm-win32/
41+
3542
.PHONY: all clean install uninstall
3643

config.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ CXX = clang
22
CC = $(CXX)
33
DESTDIR ?=
44
PREFIX ?= /usr/local
5+
6+
ifeq ($(MXE),1)
7+
EXE = .exe
8+
CXX = /usr/local/src/mxe/usr/bin/i686-pc-mingw32-gcc
9+
endif

icemulti/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
icemulti
2+
icemulti.exe
23
icemulti.o
34
icemulti.d

icemulti/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ include ../config.mk
22
LDLIBS = -lm -lstdc++
33
CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11
44

5-
all: icemulti
5+
all: icemulti$(EXE)
66

7-
icemulti: icemulti.o
7+
icemulti$(EXE): icemulti.o
8+
$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS)
89

910
install: all
1011
mkdir -p $(DESTDIR)$(PREFIX)/bin
@@ -15,6 +16,7 @@ uninstall:
1516

1617
clean:
1718
rm -f icemulti
19+
rm -f icemulti.exe
1820
rm -f *.o *.d
1921

2022
-include *.d

icemulti/icemulti.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <memory>
2121

2222
#include <stdio.h>
23+
#include <stdlib.h>
2324

2425
#define log(...) fprintf(stderr, __VA_ARGS__);
2526
#define info(...) do { if (log_level > 0) fprintf(stderr, __VA_ARGS__); } while (0)

icepack/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
icepack
2+
icepack.exe
23
iceunpack
34
icepack.o
45
icepack.d

icepack/Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ LDLIBS = -lm -lstdc++
33
CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include
44
MXEGCC = /usr/local/src/mxe/usr/bin/i686-pc-mingw32-gcc
55

6-
all: icepack iceunpack
6+
all: icepack$(EXE) iceunpack$(EXE)
77

8-
icepack: icepack.o
9-
10-
icepack.exe: icepack.cc
11-
$(MXEGCC) -std=c++11 -o icepack.exe -Os icepack.cc -lm -lstdc++
8+
icepack$(EXE): icepack.o
9+
$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS)
1210

1311
iceunpack: icepack
1412
ln -sf icepack iceunpack
1513

14+
iceunpack.exe:
15+
# no iceunpack.exe, use icepack -u
16+
1617
install: all
1718
mkdir -p $(DESTDIR)$(PREFIX)/bin
1819
cp icepack $(DESTDIR)$(PREFIX)/bin/icepack

icepll/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
icepll
2+
icepll.exe
23
icepll.o
34
icepll.d

icepll/Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ include ../config.mk
22
LDLIBS = -lm -lstdc++
33
CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include
44

5-
all: icepll
5+
all: icepll$(EXE)
66

7-
icepll: icepll.o
7+
icepll$(EXE): icepll.o
8+
$(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS)
89

910
install: all
1011
mkdir -p $(DESTDIR)$(PREFIX)/bin
@@ -14,7 +15,9 @@ uninstall:
1415
rm -f $(DESTDIR)$(PREFIX)/bin/icepll
1516

1617
clean:
17-
rm -f icepll *.o *.d
18+
rm -f icepll
19+
rm -f icepll.exe
20+
rm -f *.o *.d
1821

1922
-include *.d
2023

0 commit comments

Comments
 (0)