-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.win
47 lines (36 loc) · 1.15 KB
/
Makefile.win
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#cross-compile for windows 32/64 bit platforms
#on ubuntu, the packages needed are mingw32, g++-mingw-w64-i686
#invoke with make -f Makefile.win
#for a clean build, always make clean before using other targets
CC = i686-w64-mingw32-gcc
BUILD = build
ARCHIVE = archive
OPTS= $ -I $(BUILD)/zlib-1.2.5 $(BUILD)/zlib-1.2.5/zlib_.a -O3
SRC = src
BUILD = build
PREFIX = /usr/local
INSTALLDIR = $(PREFIX)/bin
$(shell mkdir -p $(BUILD))
default: all
all: osmconvert.exe osmfilter.exe
zlib.a:
mkdir -p $(BUILD) \
&& cp $(ARCHIVE)/zlib-1.2.5.tar.gz $(BUILD) \
&& cd $(BUILD) \
&& tar xf zlib-1.2.5.tar.gz \
&& cd zlib-1.2.5 \
&& export CC=/usr/bin/i686-w64-mingw32-gcc \
&& ./configure --static \
&& cat Makefile | sed 's/all: static all64/all: static/g' > Makefile_ \
&& mv Makefile_ Makefile \
&& make \
&& ar rcs zlib_.a *.o
@echo "successfully built zlib_.a"
osmconvert.exe: $(SRC)/osmconvert.c zlib.a
$(CC) $(SRC)/osmconvert.c -o $(BUILD)/osmconvert.exe $(OPTS)
@echo "successfully built osmconvert.exe"
osmfilter.exe: $(SRC)/osmfilter.c
$(CC) $(SRC)/osmfilter.c -o $(BUILD)/osmfilter.exe -O3
@echo "successfully built osmfilter.exe"
clean:
-rm -rf $(BUILD)