public
Description: Set of makefiles to build cross and native toolchains for windows x64 on linux/darwin
Homepage:
Clone URL: git://github.com/cournape/cross-mingw-w64.git
cross-mingw-w64 / Makefile.w64.native
100644 173 lines (126 sloc) 4.333 kb
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
ROOT_DIR = $(PWD)/native
ARCHIVE_DIR = $(PWD)/archives
BUILD_DIR = $(ROOT_DIR)/build
INSTALL_DIR = $(ROOT_DIR)/install
 
# Location of the cross compiler
TOOL_DIR = $(PWD)/install
 
TARGET = x86_64-pc-mingw32
HOST = x86_64-pc-mingw32
 
#BINUTILS_SRC = $(ARCHIVE_DIR)/binutils-2.19.51
#BINUTILS_BLD = $(BUILD_DIR)/binutils-2.19.51
#
#MINGW64_SRC = $(ARCHIVE_DIR)/trunk
#MINGW64_BLD = $(BUILD_DIR)/mingw-w64
#
#W64API_SRC = $(ARCHIVE_DIR)/trunk/mingw-w64-crt
#W64API_BLD = $(BUILD_DIR)/mingw-w64-crt
#
#GDB_SRC = $(ARCHIVE_DIR)/gdb/src
#GDB_BLD = $(BUILD_DIR)/gdb
#
#MAKE = make -j8
#
#GCC_CONFIGURE_OPTS = --with-gmp=$(TOOL_DIR) --with-mpfr=$(TOOL_DIR) \
# --with-sysroot=$(TOOL_DIR) --with-gnu-ld --with-gnu-as \
# --disable-shared --disable-win32-registry
#
#GCC_SRC = $(ARCHIVE_DIR)/gcc-4.4-20090320
#GCC_BLD = $(BUILD_DIR)/gcc-4.4-20090320
#
#GCC_LANGUAGES = c,fortran,c++
 
BINUTILS_SRC = $(ARCHIVE_DIR)/binutils/src
BINUTILS_BLD = $(BUILD_DIR)/binutils-2.19
 
MINGW64_SRC = $(ARCHIVE_DIR)/mingw
MINGW64_BLD = $(BUILD_DIR)/mingw-w64
 
W64API_SRC = $(ARCHIVE_DIR)/mingw/mingw-w64-crt
W64API_BLD = $(BUILD_DIR)/mingw-w64-crt
 
MAKE = make -j3
GCC_CONFIGURE_OPTS = --with-sysroot=$(INSTALL_DIR) --with-gnu-ld --with-gnu-as
 
GCC_SRC = $(ARCHIVE_DIR)/gcc/gcc
GCC_BLD = $(BUILD_DIR)/gcc-4.4
 
GCC_LANGUAGES = c#,fortran,c++
 
export PATH:=$(TOOL_DIR)/bin:$(PATH)
 
zip: strip native.zip
 
native.zip:
zip -r $@ native/install
 
strip: gcc_install $(BUILD_DIR)/strip.done
 
$(BUILD_DIR)/strip.done:
find $(INSTALL_DIR) -name '*.exe' -exec ./install/bin/x86_64-pc-mingw32-strip '{}' \;
touch $@
 
gdb_install: gdb_build $(GDB_BLD)/install.done
 
$(GDB_BLD)/install.done:
(cd $(GDB_BLD) && make install)
touch $@
 
gdb_build: gdb_configure $(GDB_BLD)/build.done
 
$(GDB_BLD)/build.done:
(cd $(GDB_BLD) && $(MAKE))
touch $@
 
gdb_configure: sysheader_install $(GDB_BLD)/configure.done
 
$(GDB_BLD)/configure.done:
mkdir -p $(GDB_BLD)
(cd $(GDB_BLD) && $(GDB_SRC)/configure --prefix=$(INSTALL_DIR) \
--target=$(TARGET) --host=$(HOST) --disable-werror)
touch $@
 
gcc_install: gcc_build $(GCC_BLD)/install.done
 
$(GCC_BLD)/install.done:
(cd $(GCC_BLD) && make install)
touch $@
 
gcc_build: w64api_install $(GCC_BLD)/build.done
 
$(GCC_BLD)/build.done:
(cd $(GCC_BLD) && $(MAKE))
touch $@
 
w64api_install: w64api_build $(W64API_BLD)/install.done
 
$(W64API_BLD)/install.done:
(cd $(W64API_BLD) && make install)
touch $@
 
w64api_build: w64api_configure $(W64API_BLD)/build.done
 
$(W64API_BLD)/build.done:
(cd $(W64API_BLD) && $(MAKE))
touch $@
 
w64api_configure: gcc_bootstrap_install $(W64API_BLD)/configure.done
 
$(W64API_BLD)/configure.done:
mkdir -p $(W64API_BLD)
(cd $(W64API_BLD) && $(W64API_SRC)/configure \
--prefix=$(INSTALL_DIR) \
--host=$(HOST) --target=$(TARGET))
touch $@
 
gcc_bootstrap_install: gcc_bootstrap_build $(GCC_BLD)/install.bootstrap.done
 
$(GCC_BLD)/install.bootstrap.done:
(cd $(GCC_BLD) && make install-gcc)
touch $@
 
gcc_bootstrap_build: gcc_bootstrap_configure $(GCC_BLD)/build.bootstrap.done
 
$(GCC_BLD)/build.bootstrap.done:
(cd $(GCC_BLD) && $(MAKE) all-gcc)
touch $@
 
gcc_bootstrap_configure: sysheader_install $(GCC_BLD)/configure.bootstrap.done
 
$(GCC_BLD)/configure.bootstrap.done:
mkdir -p $(GCC_BLD)
(cd $(GCC_BLD) && CFLAGS="-O0" $(GCC_SRC)/configure \
--prefix=$(INSTALL_DIR) --target=$(TARGET) --enable-languages=$(GCC_LANGUAGES) \
--host=$(HOST) --build=$(BUILD) $(GCC_CONFIGURE_OPTS))
touch $@
 
sysheader_install: binutils $(BUILD_DIR)/sys.done
 
$(BUILD_DIR)/sys.done:
mkdir -p $(INSTALL_DIR)/$(TARGET)/include
cp -r $(MINGW64_SRC)/mingw-w64-headers/include/* $(INSTALL_DIR)/$(TARGET)/include
ln -s $(INSTALL_DIR)/$(TARGET) $(INSTALL_DIR)/mingw
touch $@
 
binutils: binutils_install
 
binutils_install: binutils_build $(BINUTILS_BLD)/install.done
 
$(BINUTILS_BLD)/install.done:
(cd $(BINUTILS_BLD) && make install)
touch $@
 
binutils_build: binutils_configure $(BINUTILS_BLD)/build.done
 
$(BINUTILS_BLD)/build.done:
(cd $(BINUTILS_BLD) && $(MAKE))
touch $@
 
binutils_configure: $(BINUTILS_BLD)/configure.done
 
$(BINUTILS_BLD)/configure.done:
mkdir -p $(BINUTILS_BLD)
(cd $(BINUTILS_BLD) && $(BINUTILS_SRC)/configure \
--prefix=$(INSTALL_DIR) --host=$(TARGET) \
--with-sysroot=$(INSTALL_DIR)/$(TARGET))
touch $@
 
clean:
rm -rf $(BUILD_DIR)
rm -rf $(INSTALL_DIR)