Find file
Fetching contributors…
Cannot retrieve contributors at this time
173 lines (126 sloc) 4.23 KB
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)