xref: /OK3568_Linux_fs/buildroot/package/gcc/gcc-target/gcc-target.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# gcc-target
4#
5################################################################################
6
7GCC_TARGET_VERSION = $(GCC_VERSION)
8GCC_TARGET_SITE = $(GCC_SITE)
9GCC_TARGET_SOURCE = $(GCC_SOURCE)
10
11# Use the same archive as gcc-initial and gcc-final
12GCC_TARGET_DL_SUBDIR = gcc
13
14GCC_TARGET_DEPENDENCIES = binutils gmp mpfr mpc
15
16# First, we use HOST_GCC_COMMON_MAKE_OPTS to get a lot of correct flags (such as
17# the arch, abi, float support, etc.) which are based on the config used to
18# build the internal toolchain
19GCC_TARGET_CONF_OPTS = $(HOST_GCC_COMMON_CONF_OPTS)
20# Then, we modify incorrect flags from HOST_GCC_COMMON_CONF_OPTS
21GCC_TARGET_CONF_OPTS += \
22	--with-sysroot=/ \
23	--with-build-sysroot=$(STAGING_DIR) \
24	--disable-__cxa_atexit \
25	--with-gmp=$(STAGING_DIR) \
26	--with-mpc=$(STAGING_DIR) \
27	--with-mpfr=$(STAGING_DIR)
28# Then, we force certain flags that may appear in HOST_GCC_COMMON_CONF_OPTS
29GCC_TARGET_CONF_OPTS += \
30	--disable-libquadmath \
31	--disable-libsanitizer \
32	--disable-plugin \
33	--disable-lto
34# Finally, we add some of our own flags
35GCC_TARGET_CONF_OPTS += \
36	--enable-languages=c \
37	--disable-boostrap \
38	--disable-libgomp \
39	--disable-nls \
40	--disable-libmpx \
41	--disable-gcov \
42	$(EXTRA_TARGET_GCC_CONFIG_OPTIONS)
43
44GCC_TARGET_CONF_ENV = $(HOST_GCC_COMMON_CONF_ENV)
45
46GCC_TARGET_MAKE_OPTS += $(HOST_GCC_COMMON_MAKE_OPTS)
47
48# Install standard C headers (from glibc)
49define GCC_TARGET_INSTALL_HEADERS
50	cp -r $(STAGING_DIR)/usr/include $(TARGET_DIR)/usr
51endef
52GCC_TARGET_POST_INSTALL_TARGET_HOOKS += GCC_TARGET_INSTALL_HEADERS
53
54# Install standard C libraries (from glibc)
55GCC_TARGET_GLIBC_LIBS = \
56	*crt*.o *_nonshared.a \
57	libBrokenLocale.so libanl.so libbfd.so libc.so libcrypt.so libdl.so \
58	libm.so libnss_compat.so libnss_db.so libnss_files.so libnss_hesiod.so \
59	libpthread.so libresolv.so librt.so libthread_db.so libutil.so
60
61define GCC_TARGET_INSTALL_LIBS
62	for libpattern in $(GCC_TARGET_GLIBC_LIBS); do \
63		$(call copy_toolchain_lib_root,$$libpattern) ; \
64	done
65endef
66GCC_TARGET_POST_INSTALL_TARGET_HOOKS += GCC_TARGET_INSTALL_LIBS
67
68# Remove unnecessary files (extra links to gcc binaries, and libgcc which is
69# already in `/lib`)
70define GCC_TARGET_RM_FILES
71	rm -f $(TARGET_DIR)/usr/bin/$(ARCH)-buildroot-linux-gnu-gcc*
72	rm -f $(TARGET_DIR)/usr/lib/libgcc_s*.so*
73	rm -f $(TARGET_DIR)/usr/$(ARCH)-buildroot-linux-gnu/lib/ldscripts/elf32*
74	rm -f $(TARGET_DIR)/usr/$(ARCH)-buildroot-linux-gnu/lib/ldscripts/elf64b*
75endef
76GCC_TARGET_POST_INSTALL_TARGET_HOOKS += GCC_TARGET_RM_FILES
77
78$(eval $(autotools-package))
79