python-werkzeug: bump to version 0.11.15
[buildroot-gz.git] / package / gcc / gcc-final / gcc-final.mk
blobc9ee476fb7f4fcbcfd5b4e8e85a1868bc28d056f
1 ################################################################################
3 # gcc-final
5 ################################################################################
7 GCC_FINAL_VERSION = $(GCC_VERSION)
8 GCC_FINAL_SITE = $(GCC_SITE)
9 GCC_FINAL_SOURCE = $(GCC_SOURCE)
11 HOST_GCC_FINAL_DEPENDENCIES = \
12 $(HOST_GCC_COMMON_DEPENDENCIES) \
13 $(BR_LIBC)
15 HOST_GCC_FINAL_EXCLUDES = $(HOST_GCC_EXCLUDES)
16 HOST_GCC_FINAL_POST_EXTRACT_HOOKS += HOST_GCC_FAKE_TESTSUITE
18 ifneq ($(call qstrip, $(BR2_XTENSA_CORE_NAME)),)
19 HOST_GCC_FINAL_POST_EXTRACT_HOOKS += HOST_GCC_XTENSA_OVERLAY_EXTRACT
20 endif
22 HOST_GCC_FINAL_POST_PATCH_HOOKS += HOST_GCC_APPLY_PATCHES
24 # gcc doesn't support in-tree build, so we create a 'build'
25 # subdirectory in the gcc sources, and build from there.
26 HOST_GCC_FINAL_SUBDIR = build
28 HOST_GCC_FINAL_PRE_CONFIGURE_HOOKS += HOST_GCC_CONFIGURE_SYMLINK
30 # We want to always build the static variants of all the gcc libraries,
31 # of which libstdc++, libgomp, libmudflap...
32 # To do so, we can not just pass --enable-static to override the generic
33 # --disable-static flag, otherwise gcc fails to build some of those
34 # libraries, see;
35 # http://lists.busybox.net/pipermail/buildroot/2013-October/080412.html
37 # So we must completely override the generic commands and provide our own.
39 define HOST_GCC_FINAL_CONFIGURE_CMDS
40 (cd $(HOST_GCC_FINAL_SRCDIR) && rm -rf config.cache; \
41 $(HOST_CONFIGURE_OPTS) \
42 CFLAGS="$(HOST_CFLAGS)" \
43 LDFLAGS="$(HOST_LDFLAGS)" \
44 $(HOST_GCC_FINAL_CONF_ENV) \
45 ./configure \
46 --prefix="$(HOST_DIR)/usr" \
47 --sysconfdir="$(HOST_DIR)/etc" \
48 --enable-static \
49 $(QUIET) $(HOST_GCC_FINAL_CONF_OPTS) \
51 endef
54 # Languages supported by the cross-compiler
55 GCC_FINAL_CROSS_LANGUAGES-y = c
56 GCC_FINAL_CROSS_LANGUAGES-$(BR2_INSTALL_LIBSTDCPP) += c++
57 GCC_FINAL_CROSS_LANGUAGES-$(BR2_TOOLCHAIN_BUILDROOT_FORTRAN) += fortran
58 GCC_FINAL_CROSS_LANGUAGES = $(subst $(space),$(comma),$(GCC_FINAL_CROSS_LANGUAGES-y))
60 HOST_GCC_FINAL_CONF_OPTS = \
61 $(HOST_GCC_COMMON_CONF_OPTS) \
62 --enable-languages=$(GCC_FINAL_CROSS_LANGUAGES) \
63 --with-build-time-tools=$(HOST_DIR)/usr/$(GNU_TARGET_NAME)/bin
65 HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib*
66 # The kernel wants to use the -m4-nofpu option to make sure that it
67 # doesn't use floating point operations.
68 ifeq ($(BR2_sh4)$(BR2_sh4eb),y)
69 HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4,m4-nofpu"
70 HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib/!m4*
71 endif
72 ifeq ($(BR2_sh4a)$(BR2_sh4aeb),y)
73 HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4a,m4a-nofpu"
74 HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/usr/$(GNU_TARGET_NAME)/lib/!m4*
75 endif
77 ifeq ($(BR2_bfin),y)
78 HOST_GCC_FINAL_CONF_OPTS += --disable-symvers
79 endif
81 # Disable shared libs like libstdc++ if we do static since it confuses linking
82 # In that case also disable libcilkrts as there is no static version
83 ifeq ($(BR2_STATIC_LIBS),y)
84 HOST_GCC_FINAL_CONF_OPTS += --disable-shared --disable-libcilkrts
85 else
86 HOST_GCC_FINAL_CONF_OPTS += --enable-shared
87 endif
89 ifeq ($(BR2_GCC_ENABLE_OPENMP),y)
90 HOST_GCC_FINAL_CONF_OPTS += --enable-libgomp
91 else
92 HOST_GCC_FINAL_CONF_OPTS += --disable-libgomp
93 endif
95 # End with user-provided options, so that they can override previously
96 # defined options.
97 HOST_GCC_FINAL_CONF_OPTS += \
98 $(call qstrip,$(BR2_EXTRA_GCC_CONFIG_OPTIONS))
100 HOST_GCC_FINAL_CONF_ENV = \
101 $(HOST_GCC_COMMON_CONF_ENV)
103 HOST_GCC_FINAL_MAKE_OPTS += $(HOST_GCC_COMMON_MAKE_OPTS)
105 # Make sure we have 'cc'
106 define HOST_GCC_FINAL_CREATE_CC_SYMLINKS
107 if [ ! -e $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-cc ]; then \
108 ln -f $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-gcc \
109 $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-cc; \
111 endef
113 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_CREATE_CC_SYMLINKS
115 HOST_GCC_FINAL_TOOLCHAIN_WRAPPER_ARGS += $(HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS)
116 HOST_GCC_FINAL_POST_BUILD_HOOKS += TOOLCHAIN_WRAPPER_BUILD
117 HOST_GCC_FINAL_POST_INSTALL_HOOKS += TOOLCHAIN_WRAPPER_INSTALL
118 # Note: this must be done after CREATE_CC_SYMLINKS, otherwise the
119 # -cc symlink to the wrapper is not created.
120 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
122 # coldfire is not working without removing these object files from libgcc.a
123 ifeq ($(BR2_m68k_cf),y)
124 define HOST_GCC_FINAL_M68K_LIBGCC_FIXUP
125 find $(STAGING_DIR) -name libgcc.a -print | \
126 while read t; do $(GNU_TARGET_NAME)-ar dv "$t" _ctors.o; done
127 endef
128 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_M68K_LIBGCC_FIXUP
129 endif
131 # Cannot use the HOST_GCC_FINAL_USR_LIBS mechanism below, because we want
132 # libgcc_s to be installed in /lib and not /usr/lib.
133 define HOST_GCC_FINAL_INSTALL_LIBGCC
134 -cp -dpf $(HOST_GCC_FINAL_GCC_LIB_DIR)/libgcc_s* \
135 $(STAGING_DIR)/lib/
136 -cp -dpf $(HOST_GCC_FINAL_GCC_LIB_DIR)/libgcc_s* \
137 $(TARGET_DIR)/lib/
138 endef
140 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_INSTALL_LIBGCC
142 define HOST_GCC_FINAL_INSTALL_LIBATOMIC
143 -cp -dpf $(HOST_GCC_FINAL_GCC_LIB_DIR)/libatomic* \
144 $(STAGING_DIR)/lib/
145 -cp -dpf $(HOST_GCC_FINAL_GCC_LIB_DIR)/libatomic* \
146 $(TARGET_DIR)/lib/
147 endef
149 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_INSTALL_LIBATOMIC
151 # Handle the installation of libraries in /usr/lib
152 HOST_GCC_FINAL_USR_LIBS =
154 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
155 HOST_GCC_FINAL_USR_LIBS += libstdc++
156 endif
158 ifeq ($(BR2_TOOLCHAIN_BUILDROOT_FORTRAN),y)
159 HOST_GCC_FINAL_USR_LIBS += libgfortran
160 # fortran needs quadmath on x86 and x86_64
161 ifeq ($(BR2_TOOLCHAIN_HAS_LIBQUADMATH),y)
162 HOST_GCC_FINAL_USR_LIBS += libquadmath
163 endif
164 endif
166 ifeq ($(BR2_GCC_ENABLE_OPENMP),y)
167 HOST_GCC_FINAL_USR_LIBS += libgomp
168 endif
170 ifeq ($(BR2_GCC_ENABLE_LIBMUDFLAP),y)
171 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
172 HOST_GCC_FINAL_USR_LIBS += libmudflapth
173 else
174 HOST_GCC_FINAL_USR_LIBS += libmudflap
175 endif
176 endif
178 ifneq ($(HOST_GCC_FINAL_USR_LIBS),)
179 define HOST_GCC_FINAL_INSTALL_STATIC_LIBS
180 for i in $(HOST_GCC_FINAL_USR_LIBS) ; do \
181 cp -dpf $(HOST_GCC_FINAL_GCC_LIB_DIR)/$${i}.a \
182 $(STAGING_DIR)/usr/lib/ ; \
183 done
184 endef
186 ifeq ($(BR2_STATIC_LIBS),)
187 define HOST_GCC_FINAL_INSTALL_SHARED_LIBS
188 for i in $(HOST_GCC_FINAL_USR_LIBS) ; do \
189 cp -dpf $(HOST_GCC_FINAL_GCC_LIB_DIR)/$${i}.so* \
190 $(STAGING_DIR)/usr/lib/ ; \
191 cp -dpf $(HOST_GCC_FINAL_GCC_LIB_DIR)/$${i}.so* \
192 $(TARGET_DIR)/usr/lib/ ; \
193 done
194 endef
195 endif
197 define HOST_GCC_FINAL_INSTALL_USR_LIBS
198 mkdir -p $(TARGET_DIR)/usr/lib
199 $(HOST_GCC_FINAL_INSTALL_STATIC_LIBS)
200 $(HOST_GCC_FINAL_INSTALL_SHARED_LIBS)
201 endef
202 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_INSTALL_USR_LIBS
203 endif
205 $(eval $(host-autotools-package))