Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc-cf / packages / build.mingw-w64 / Makefile
blobca480b7fdf2534facea9f7ac786ac2faa57ca98b
1 include ../packages.mk
3 MINGW_W64_VERSION=1.0
4 MINGW_W64_BUILD_DATE=20120227
5 BINUTILS_VERSION=2.28
6 GCC_VERSION=4.9.4
8 TARGET=x86_64-w64-mingw32
9 PROGRAM_PREFIX=$(TARGET)-
10 PREFIX=$(LOCAL_DIR)/cross-tools-w64
12 .PHONY: all
13 all: mingw-w64-install.tag binutils-install.tag gcc-install.tag \
14 mingw-w64-clean binutils-clean gcc-clean
16 .PHONY: clean
17 clean: mingw-w64-clean binutils-clean gcc-clean
18 rm -rf download/*
20 .PHONY: real-clean
21 real-clean: clean
22 rm -rf $(PREFIX)
24 download/mingw-w64-$(MINGW_W64_VERSION)-bin_x86_64-linux_$(MINGW_W64_BUILD_DATE).tar.bz2:
25 ####download/mingw-w64-bin_x86_64-linux_$(MINGW_W64_BUILD_DATE).tar.bz2:
26 wget -nv -P download http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/mingw-w64-$(MINGW_W64_VERSION)-bin_x86_64-linux_$(MINGW_W64_BUILD_DATE).tar.bz2
28 mingw-w64-install.tag: download/mingw-w64-$(MINGW_W64_VERSION)-bin_x86_64-linux_$(MINGW_W64_BUILD_DATE).tar.bz2
29 #####mingw-w64-install.tag: download/mingw-w64-bin_x86_64-linux_$(MINGW_W64_BUILD_DATE).tar.bz2
30 mkdir -p $(LOCAL_DIR)/cross-tools-w64
31 tar -C $(LOCAL_DIR)/cross-tools-w64 -xjvf download/mingw-w64-$(MINGW_W64_VERSION)-bin_x86_64-linux_$(MINGW_W64_BUILD_DATE).tar.bz2
32 test -L $(LOCAL_DIR)/cross-tools-w64/x86_64-w64-mingw32/include/boost && rm $(LOCAL_DIR)/cross-tools-w64/x86_64-w64-mingw32/include/boost; true
33 ln -s /usr/include/boost/ $(LOCAL_DIR)/cross-tools-w64/x86_64-w64-mingw32/include
34 touch $@
36 .PHONY: mingw-w64-clean
37 mingw-w64-clean:
38 rm -rf mingw-w64-*.tag
41 download/binutils-$(BINUTILS_VERSION).tar.bz2:
42 download/binutils-$(BINUTILS_VERSION).tar.gz:
43 wget -nv -P download http://ftp.gnu.org/gnu/binutils/binutils-$(BINUTILS_VERSION).tar.bz2
45 binutils-unpack.tag: download/binutils-$(BINUTILS_VERSION).tar.bz2
46 binutils-unpack.tag: download/binutils-$(BINUTILS_VERSION).tar.gz
47 tar -xjf download/binutils-$(BINUTILS_VERSION).tar.bz2
48 touch $@
50 binutils-configure.tag: binutils-unpack.tag
51 cd $(shell find . -maxdepth 1 -type d -name "binutil*") && \
52 ./configure --target=$(TARGET) --program-prefix=$(PROGRAM_PREFIX) --prefix=$(PREFIX) \
53 --with-gcc --with-gnu-as --with-gnu-ld \
54 --disable-nls --disable-shared
55 touch $@
57 binutils-make.tag: binutils-configure.tag
58 cd $(shell find . -maxdepth 1 -type d -name "binutil*") && \
59 make
60 touch $@
62 binutils-install.tag: binutils-make.tag
63 cd $(shell find . -maxdepth 1 -type d -name "binutil*") && \
64 make install
65 find $(PREFIX)/bin/ -type f -exec sh -c "file {} | grep executable > /dev/null && strip {}" \;
66 #strip $(PREFIX)/bin/*
67 touch $@
69 .PHONY: binutils-clean
70 binutils-clean:
71 rm -rf $(shell find . -maxdepth 1 -type d -name "binutil*")
72 rm -rf binutils-*.tag
75 download/gcc-$(GCC_VERSION).tar.bz2:
76 wget -nv -P download ftp://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.bz2
78 gcc-unpack.tag: download/gcc-$(GCC_VERSION).tar.bz2
79 tar -xjf download/gcc-$(GCC_VERSION).tar.bz2
80 touch $@
82 gcc-configure.tag: gcc-unpack.tag
83 rm -rf objdir-gcc
84 mkdir -p objdir-gcc
85 cd objdir-gcc && \
86 ../$(shell find . -maxdepth 1 -type d -name "gcc*")/configure \
87 --target=$(TARGET) --program-prefix=$(PROGRAM_PREFIX) --prefix=$(PREFIX) \
88 --with-gcc --with-gnu-ld --with-gnu-as \
89 --with-gmp=$(LOCAL_DIR) --with-mpfr=$(LOCAL_DIR) --with-mpc=$(LOCAL_DIR) \
90 --enable-threads --disable-nls --enable-languages=c,c++ \
91 --disable-multilib --enable-win32-registry --disable-shared
92 touch $@
94 gcc-make.tag: gcc-configure.tag
95 cd objdir-gcc && \
96 PATH=$(PATH):$(PREFIX)/bin \
97 make LDFLAGS=-s -j 2
98 touch $@
100 gcc-install.tag: gcc-make.tag
101 cd objdir-gcc && \
102 PATH=$(PATH):$(PREFIX)/bin \
103 make install
104 touch $@
106 .PHONY: gcc-clean
107 gcc-clean:
108 rm -rf $(shell find . -maxdepth 1 -type d -name "gcc*")
109 rm -rf objdir-gcc
110 rm -f gcc-*.tag