Update copyright year
[openadk.git] / toolchain / glibc / Makefile
blob4d87f57892f7e4692994cf0299266a5dd1fa8616
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 include $(ADK_TOPDIR)/rules.mk
5 include ../rules.mk
6 include Makefile.inc
7 include ${ADK_TOPDIR}/mk/buildhlp.mk
9 # glibc does not boot with Os and CPU specific FLAGS for nios2
10 ifeq ($(ADK_TARGET_ARCH_NIOS2),y)
11 TARGET_CFLAGS:= -O2
12 TARGET_CXXFLAGS:= -O2
13 endif
15 # glibc does not compile with NEON suggested CFLAGS/CXXFLAGS
16 TARGET_CFLAGS:= $(filter-out -ffast-math,$(TARGET_CFLAGS))
17 TARGET_CXXFLAGS:= $(filter-out -ffast-math,$(TARGET_CXXFLAGS))
19 GLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
20 --host=$(GNU_TARGET_NAME) \
21 --with-headers=$(STAGING_TARGET_DIR)/usr/include \
22 --disable-sanity-checks \
23 --disable-werror \
24 --disable-nscd \
25 --enable-shared
27 ifeq ($(ADK_TARGET_LINUX_ARCH_SPARC64),y)
28 GLIBC_CONFOPTS+= --disable-default-pie
29 else
30 GLIBC_CONFOPTS+= --enable-default-pie
31 endif
33 ifeq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY),y)
34 GLIBC_CONFOPTS+= --enable-static-nss
35 endif
37 GLIBC_ENV:= PATH='${HOST_PATH}:${TARGET_PATH}' \
38 BUILD_CC='${CC_FOR_BUILD}' \
39 CFLAGS="$(TARGET_CFLAGS)" \
40 CXXFLAGS="$(TARGET_CXXFLAGS)" \
41 CC="${TARGET_CC}" \
42 CXX="${TARGET_CXX}" \
43 AR="${TARGET_AR}" \
44 RANLIB="${TARGET_RANLIB}" \
45 libc_cv_gnu99_inline=yes \
46 libc_cv_initfini_array=yes
48 ifeq ($(ADK_TARGET_ARCH_RISCV64),y)
49 GLIBC_ENV+= libc_cv_slibdir=/lib libc_cv_rtlddir=/lib
50 endif
51 ifeq ($(ADK_TARGET_ARCH_RISCV32),y)
52 GLIBC_ENV+= libc_cv_slibdir=/lib libc_cv_rtlddir=/lib
53 endif
55 GLIBC_MAKEOPTS+= cross-compiling=yes
56 ifeq (${ADK_MAKE_PARALLEL},y)
57 GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j$(ADK_MAKE_JOBS)"
58 endif
61 GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
63 $(WRKBUILD)/.configured:
64 mkdir -p $(GLIBC_BUILD_DIR_FINAL)
65 (cd $(GLIBC_BUILD_DIR_FINAL); \
66 ${GLIBC_ENV} \
67 $(WRKBUILD)/configure \
68 --prefix=/usr \
69 ${GLIBC_CONFOPTS} \
71 touch $@
73 $(WRKBUILD)/.compiled:
74 ${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} -C $(GLIBC_BUILD_DIR_FINAL) all
75 touch $@
77 $(WRKBUILD)/.installed:
78 ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
79 touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
80 touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64,lp64,soft,hard}.h
81 mkdir -p ${STAGING_TARGET_DIR}/etc
82 ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc
83 ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
84 touch $@
86 include ${ADK_TOPDIR}/mk/toolchain.mk