annotate src/native-gcc.mk @ 3012:100e618349f7

Improve handling of prefix directories by defining HOST_PREFIX and BUILD_TOOLS_PREFIX variables in top-level Makefile.
author John W. Eaton <jwe@octave.org>
date Sun, 02 Jun 2013 10:31:04 -0400
parents 4f9b72cf7ee7
children bcc26ffe9a0f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2915
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 # This file is part of MXE.
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2 # See index.html for further information.
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 PKG := native-gcc
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 $(PKG)_IGNORE :=
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 $(PKG)_CHECKSUM := a464ba0f26eef24c29bcd1e7489421117fb9ee35
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 $(PKG)_SUBDIR := gcc-$($(PKG)_VERSION)
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 $(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.bz2
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 $(PKG)_URL := ftp://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 $(PKG)_URL_2 := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 $(PKG)_DEPS := mingwrt w32api binutils gcc-gmp gcc-mpc gcc-mpfr
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 ifneq ($(BUILD_SHARED),yes)
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 $(PKG)_STATIC_FLAG := --static
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 endif
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 define $(PKG)_UPDATE
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 $(WGET) -q -O- 'http://ftp.gnu.org/gnu/gcc/?C=M;O=D' | \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 $(SED) -n 's,.*<a href="gcc-\([0-9][^"]*\)/".*,\1,p' | \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 grep -v '^4\.[543]\.' | \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 head -1
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 endef
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 define $(PKG)_BUILD
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 # unpack support libraries
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,gcc-gmp)
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 mv '$(1)/$(gcc-gmp_SUBDIR)' '$(1)/gmp'
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,gcc-mpc)
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 mv '$(1)/$(gcc-mpc_SUBDIR)' '$(1)/mpc'
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,gcc-mpfr)
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 mv '$(1)/$(gcc-mpfr_SUBDIR)' '$(1)/mpfr'
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 # build GCC and support libraries
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 mkdir '$(1).build'
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 cd '$(1).build' && '$(1)/configure' \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 --target='$(TARGET)' \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 --host='$(TARGET)' \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 --build="`config.guess`" \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 --prefix='/usr' \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 --libdir='/usr/lib' \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 --enable-languages='c,c++,objc,fortran' \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 --enable-version-specific-runtime-libs \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 --with-gcc \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 --with-gnu-ld \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 --with-gnu-as \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 --disable-nls \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 $(ENABLE_SHARED_OR_STATIC) \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 --disable-sjlj-exceptions \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 --without-x \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 --disable-win32-registry \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 --enable-threads=win32 \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 --disable-libgomp \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 --disable-libmudflap \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 --with-mpfr-include='$(1)/mpfr/src' \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 --with-mpfr-lib='$(1).build/mpfr/src/.libs' \
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2916
diff changeset
55 --with-native-system-header-dir=$(MXE_INCDIR) \
2915
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 $(shell [ `uname -s` == Darwin ] && echo "LDFLAGS='-Wl,-no_pie'")
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 $(MAKE) -C '$(1).build' -j '$(JOBS)'
3012
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
58 $(MAKE) -C '$(1).build' -j 1 DESTDIR='$(TOP_DIR)/native-tools' install
2915
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 # # create pkg-config script
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 # (echo '#!/bin/sh'; \
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2916
diff changeset
62 # echo 'PKG_CONFIG_PATH="$$PKG_CONFIG_PATH_$(subst -,_,$(TARGET))" PKG_CONFIG_LIBDIR='\''$(MXE_LIBDIR)/pkgconfig'\'' exec pkg-config $($(PKG)_STATIC_FLAG) "$$@"') \
3012
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
63 # > '$(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-pkg-config'
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
64 # chmod 0755 '$(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-pkg-config'
2915
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 # # create the CMake toolchain file
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 # [ -d '$(dir $(CMAKE_TOOLCHAIN_FILE))' ] || mkdir -p '$(dir $(CMAKE_TOOLCHAIN_FILE))'
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 # (echo 'set(CMAKE_SYSTEM_NAME Windows)'; \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 # echo 'set(MSYS 1)'; \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 # if [ $(BUILD_SHARED) = yes ]; then \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 # echo 'set(BUILD_SHARED_LIBS ON)'; \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 # else \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 # echo 'set(BUILD_SHARED_LIBS OFF)'; \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 # fi; \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 # if [ $(BUILD_STATIC) = yes ]; then \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 # echo 'set(BUILD_STATIC_LIBS ON)'; \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 # else \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 # echo 'set(BUILD_STATIC_LIBS OFF)'; \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 # fi; \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 # echo 'set(CMAKE_BUILD_TYPE Release)'; \
3012
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
81 # echo 'set(CMAKE_FIND_ROOT_PATH $(HOST_PREFIX))'; \
2915
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 # echo 'set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)'; \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83 # echo 'set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)'; \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84 # echo 'set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)'; \
3012
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
85 # echo 'set(CMAKE_C_COMPILER $(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-gcc)'; \
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
86 # echo 'set(CMAKE_CXX_COMPILER $(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-g++)'; \
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
87 # echo 'set(CMAKE_Fortran_COMPILER $(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-gfortran)'; \
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
88 # echo 'set(CMAKE_RC_COMPILER $(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-windres)'; \
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
89 # echo 'set(PKG_CONFIG_EXECUTABLE $(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-pkg-config)'; \
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
90 # echo 'set(QT_QMAKE_EXECUTABLE $(BUILD_TOOLS_PREFIX)/bin/$(TARGET)-qmake)'; \
100e618349f7 Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents: 2997
diff changeset
91 # echo 'set(CMAKE_INSTALL_PREFIX $(HOST_PREFIX) CACHE PATH "Installation Prefix")'; \
2915
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92 # echo 'set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug|Release|RelWithDebInfo|MinSizeRel")') \
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93 # > '$(CMAKE_TOOLCHAIN_FILE)'
74304e21f1ab native gcc and binutils
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94 endef