Merge next branch to trunk.
[sdcc.git] / sdcc-cf / packages / build.mingw32 / Makefile
blob359d1e889d5971b3d523fe452dd35192641171be
1 include ../packages.mk
3 BINUTILS_VERSION=2.30
4 MINGWRT_VERSION=3.20
5 W32API_DIR_VERSION=3.17
6 W32API_VERSION=$(W32API_DIR_VERSION)-2
7 GCC_VERSION=4.9.4
9 TARGET=i586-mingw32msvc
10 PROGRAM_PREFIX=i586-mingw32msvc-
11 PREFIX=$(LOCAL_DIR)/cross-tools
13 .PHONY: all
14 all: binutils-install.tag binutils-clean \
15 mingw-runtime-install.tag \
16 w32api-install.tag \
17 gcc-install.tag gcc-clean
19 .PHONY: clean
20 clean: binutils-clean mingw-runtime-clean w32api-clean gcc-clean
21 rm -rf download/* *.tag
23 .PHONY: real-clean
24 real-clean: binutils-realclean mingw-runtime-realclean w32api-realclean gcc-realclean
25 rm -rf $(PREFIX)
28 download/binutils-$(BINUTILS_VERSION).tar.bz2:
29 wget -nv -P download http://ftp.gnu.org/gnu/binutils/binutils-$(BINUTILS_VERSION).tar.bz2
31 binutils-unpack.tag: download/binutils-$(BINUTILS_VERSION).tar.bz2
32 tar -xjf download/binutils-$(BINUTILS_VERSION).tar.bz2
33 touch $@
35 binutils-configure.tag: binutils-unpack.tag
36 cd $(shell find . -maxdepth 1 -type d -name "binutil*") && \
37 ./configure --target=$(TARGET) --program-prefix=$(PROGRAM_PREFIX) --prefix=$(PREFIX) \
38 --with-gcc --with-gnu-as --with-gnu-ld \
39 --disable-nls --disable-shared
40 touch $@
42 binutils-make.tag: binutils-configure.tag
43 cd $(shell find . -maxdepth 1 -type d -name "binutil*") && \
44 make
45 touch $@
47 binutils-install.tag: binutils-make.tag
48 cd $(shell find . -maxdepth 1 -type d -name "binutil*") && \
49 make install
50 find $(PREFIX)/bin/ -type f -exec sh -c "file {} | grep executable > /dev/null && strip {}" \;
51 #strip $(PREFIX)/bin/*
52 touch $@
55 .PHONY: binutils-clean
56 binutils-clean:
57 rm -rf $(shell find . -maxdepth 1 -type d -name "binutil*")
59 .PHONY: binutils-realclean
60 binutils-realclean: binutils-clean
61 rm -rf binutils-*
64 download/mingwrt-$(MINGWRT_VERSION)-mingw32-dev.tar.gz:
65 wget -nv -P download http://sourceforge.net/projects/mingw/files/MinGW/Base/mingwrt/mingwrt-$(MINGWRT_VERSION)/mingwrt-$(MINGWRT_VERSION)-mingw32-dev.tar.gz
67 mingw-runtime-install.tag: download/mingwrt-$(MINGWRT_VERSION)-mingw32-dev.tar.gz
68 mkdir -p $(PREFIX)/$(TARGET)/include
69 mkdir -p $(PREFIX)/$(TARGET)/lib
70 tar -C $(PREFIX)/$(TARGET) -xzf download/mingwrt-$(MINGWRT_VERSION)-mingw32-dev.tar.gz
71 touch $@
73 .PHONY: mingw-runtime-clean
74 mingw-runtime-clean:
75 rm -f mingw-runtime-install.tag
77 .PHONY: mingw-runtime-realclean
78 mingw-runtime-realclean: mingw-runtime-clean
79 rm -f mingw-runtime-download.tag
81 download/w32api-$(W32API_VERSION)-mingw32-dev.tar.lzma:
82 wget -nv -P download http://sourceforge.net/projects/mingw/files/MinGW/Base/w32api/w32api-$(W32API_DIR_VERSION)/w32api-$(W32API_VERSION)-mingw32-dev.tar.lzma
84 w32api-install.tag: download/w32api-$(W32API_VERSION)-mingw32-dev.tar.lzma
85 mkdir -p $(PREFIX)/$(TARGET)/include
86 mkdir -p $(PREFIX)/$(TARGET)/lib
87 tar -C $(PREFIX)/$(TARGET) --lzma -xf download/w32api-$(W32API_VERSION)-mingw32-dev.tar.lzma
88 touch $@
90 .PHONY: w32api-clean
91 w32api-clean:
92 rm -f w32api-install.tag
94 .PHONY: w32api-realclean
95 w32api-realclean: w32api-clean
96 rm -f w32api-download.tag
98 download/gcc-$(GCC_VERSION).tar.bz2:
99 wget -nv -P download ftp://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.bz2
101 gcc-unpack.tag: download/gcc-$(GCC_VERSION).tar.bz2
102 tar -xjf download/gcc-$(GCC_VERSION).tar.bz2
103 touch $@
105 gcc-configure.tag: gcc-unpack.tag
106 rm -rf objdir-gcc
107 mkdir -p objdir-gcc
108 cd objdir-gcc && \
109 ../gcc-$(GCC_VERSION)/configure \
110 --target=$(TARGET) --program-prefix=$(PROGRAM_PREFIX) --prefix=$(PREFIX) \
111 --enable-languages=c,c++ \
112 --with-gcc --with-gnu-ld --with-gnu-as \
113 --with-gmp=$(LOCAL_DIR) --with-mpfr=$(LOCAL_DIR) --with-mpc=$(LOCAL_DIR) \
114 --enable-threads --disable-nls \
115 --disable-multilib --enable-win32-registry --disable-shared
116 touch $@
118 gcc-make.tag: gcc-configure.tag
119 cd objdir-gcc && \
120 PATH=$(PATH):$(PREFIX)/bin \
121 make LDFLAGS=-s -j 2
122 touch $@
124 gcc-install.tag: gcc-make.tag
125 cd objdir-gcc && \
126 PATH=$(PATH):$(PREFIX)/bin \
127 make install
128 touch $@
130 .PHONY: gcc-clean
131 gcc-clean:
132 rm -rf $(shell find . -maxdepth 1 -type d -name "gcc*")
133 rm -rf objdir-gcc
134 rm -f gcc-unpack.tag gcc-configure.tag gcc-make.tag
136 .PHONY: gcc-realclean