]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - toolchain/toolchain/toolchain.mk
libftdi: rename option to have proper prefix
[coffee/buildroot.git] / toolchain / toolchain / toolchain.mk
1 ################################################################################
2 #
3 # toolchain
4 #
5 ################################################################################
6
7 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
8 TOOLCHAIN_DEPENDENCIES += toolchain-buildroot
9 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
10 TOOLCHAIN_DEPENDENCIES += toolchain-external
11 endif
12
13 TOOLCHAIN_ADD_TOOLCHAIN_DEPENDENCY = NO
14
15 # Apply a hack that Rick Felker suggested[1] to avoid conflicts between libc
16 # headers and kernel headers. This is needed for kernel headers older than
17 # 4.15. Kernel headers 4.15 and newer don't require __GLIBC__ to be defined.
18 #
19 # Augment the original suggestion with __USE_MISC since recent kernels
20 # (older than 4.15) require this glibc internal macro. Also, as musl defines
21 # IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO, add another macro to suppress
22 # them in the kernel header, and avoid macro/enum conflict.
23 #
24 # Kernel version 3.12 introduced the libc-compat.h header.
25 #
26 # [1] http://www.openwall.com/lists/musl/2015/10/08/2
27 ifeq ($(BR2_TOOLCHAIN_USES_MUSL)$(BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12):$(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15),yy:)
28 define TOOLCHAIN_MUSL_KERNEL_HEADERS_COMPATIBILITY_HACK
29         $(SED) 's/^#if defined(__GLIBC__)$$/#if 1/' \
30                 $(STAGING_DIR)/usr/include/linux/libc-compat.h
31         $(SED) '1s/^/#define __USE_MISC\n/' \
32                 $(STAGING_DIR)/usr/include/linux/libc-compat.h
33         $(SED) '1s/^/#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0\n/' \
34                 $(STAGING_DIR)/usr/include/linux/libc-compat.h
35 endef
36 TOOLCHAIN_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_MUSL_KERNEL_HEADERS_COMPATIBILITY_HACK
37 TOOLCHAIN_INSTALL_STAGING = YES
38 endif
39
40 $(eval $(virtual-package))