diff options
Diffstat (limited to 'toolchain/glibc')
-rw-r--r-- | toolchain/glibc/Makefile | 95 | ||||
-rw-r--r-- | toolchain/glibc/Makefile.multilib | 13 |
2 files changed, 103 insertions, 5 deletions
diff --git a/toolchain/glibc/Makefile b/toolchain/glibc/Makefile index 65341591b..fbcbc617a 100644 --- a/toolchain/glibc/Makefile +++ b/toolchain/glibc/Makefile @@ -15,6 +15,7 @@ TARGET_CFLAGS:= $(filter-out -fstack-protector,$(TARGET_CFLAGS)) #TARGET_CFLAGS:= $(filter-out -flto,$(TARGET_CFLAGS)) include Makefile.inc +include Makefile.multilib include ${TOPDIR}/mk/buildhlp.mk ifeq ($(ADK_TARGET_NO_FPU),y) @@ -29,6 +30,36 @@ endif GLIBC_BUILD_DIR_INITIAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final +ifeq ($(ADK_TARGET_WITH_MULTILIB),y) +$(WRKBUILD)/.headers_configure: + for abi in $(TABI); do \ + mkdir -p $(GLIBC_BUILD_DIR_INITIAL)-$${abi/*:/}; \ + (cd ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION); \ + ln -sf ../../w-glibc-ports-$(PKG_VERSION)-1/glibc-ports-$(PKG_VERSION)/ ports); \ + (cd $(GLIBC_BUILD_DIR_INITIAL)-$${abi/*:/}; \ + ${GLIBC_ENV} \ + CC="${REAL_GNU_TARGET_NAME}-gcc -m$${abi/*:/}" \ + $(WRKBUILD)/libc/configure \ + --prefix=$(STAGING_TARGET_DIR)-$${abi/*:/}/usr \ + --with-sysroot=$(STAGING_TARGET_DIR)-$${abi/*:/} \ + --host=$${abi/:*/} \ + ${GLIBC_CONFOPTS} \ + ); \ + done + touch $@ + +$(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure + for abi in $(TABI); do \ + (cd $(GLIBC_BUILD_DIR_INITIAL)-$${abi/*:/}; \ + ${GLIBC_ENV} \ + CC="${REAL_GNU_TARGET_NAME}-gcc -m$${abi/*:/}" \ + $(MAKE) ${GLIBC_MAKEOPTS} install-headers \ + ); \ + done + touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h + touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64}.h + touch $@ +else $(WRKBUILD)/.headers_configure: mkdir -p $(GLIBC_BUILD_DIR_INITIAL) (cd ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION); \ @@ -45,12 +76,67 @@ $(WRKBUILD)/.headers_configure: $(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure (cd $(GLIBC_BUILD_DIR_INITIAL); \ ${GLIBC_ENV} \ - $(MAKE) ${GLIBC_MAKEOPTS} \ - install-headers \ + $(MAKE) ${GLIBC_MAKEOPTS} install-headers \ ); touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h + touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64}.h + touch $@ +endif + +ifeq ($(ADK_TARGET_WITH_MULTILIB),y) +$(WRKBUILD)/.configured: + for abi in $(TABI); do \ + mkdir -p $(GLIBC_BUILD_DIR_FINAL)-$${abi/*:/} ;\ + (cd $(GLIBC_BUILD_DIR_FINAL)-$${abi/*:/}; \ + ${GLIBC_ENV} \ + CC="${REAL_GNU_TARGET_NAME}-gcc -m$${abi/*:/}" \ + $(WRKBUILD)/libc/configure \ + --prefix=/usr \ + --enable-shared \ + --enable-stackguard-randomization \ + --host=$${abi/:*/} \ + ${GLIBC_CONFOPTS} \ + ); \ + done touch $@ +$(GLIBC_BUILD_DIR_FINAL)/libc.so: +$(WRKBUILD)/.compiled: $(WRKBUILD)/.configured + for abi in $(TABI); do \ + ${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} -C $(GLIBC_BUILD_DIR_FINAL)-$${abi/*:/} all ;\ + done + touch $@ + +$(WRKBUILD)/.installed: $(GLIBC_BUILD_DIR_FINAL)/libc.so + for abi in $(TABI); do \ + ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL)-$${abi/*:/} install_root=$(STAGING_TARGET_DIR)-$${abi/*:/} install ;\ + done +ifeq ($(ADK_TARGET_ABI_64),y) + ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL)-64 install_root=$(STAGING_TARGET_DIR) install +endif +ifeq ($(ADK_TARGET_ABI_32),y) + ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL)-32 install_root=$(STAGING_TARGET_DIR) install +endif +ifeq ($(ADK_TARGET_ABI_X32),y) + ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL)-x32 install_root=$(STAGING_TARGET_DIR) install +endif + # for libgcc build we need C library files, 64 bit default + mkdir -p $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2 ; \ + $(CP) $(STAGING_TARGET_DIR)-64/lib/* $(STAGING_TARGET_DIR)-64/usr/lib/* \ + $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/; \ + rm $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/libc.so ; \ + -for abi in $(TABI); do \ + mkdir -p $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/$${abi/*:/} ; \ + $(CP) $(STAGING_TARGET_DIR)-$${abi/*:/}/lib/* $(STAGING_TARGET_DIR)-$${abi/*:/}/usr/lib/* \ + $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/$${abi/*:/} ; \ + rm $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/$${abi/*:/}/libc.so ; \ + done + mkdir -p ${STAGING_TARGET_DIR}/etc + ${INSTALL_DATA} ${WRKBUILD}/libc/posix/gai.conf ${STAGING_TARGET_DIR}/etc/ + ${INSTALL_DATA} ${WRKBUILD}/libc/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc/ + ${INSTALL_DATA} ${WRKBUILD}/libc/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/ + touch $@ +else $(WRKBUILD)/.configured: mkdir -p $(GLIBC_BUILD_DIR_FINAL) (cd $(GLIBC_BUILD_DIR_FINAL); \ @@ -68,13 +154,12 @@ $(WRKBUILD)/.compiled: touch $@ $(WRKBUILD)/.installed: - ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) \ - install_root=$(STAGING_TARGET_DIR) install + ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install mkdir -p ${STAGING_TARGET_DIR}/etc ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc ${INSTALL_DATA} ${WRKBUILD}/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc - touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h touch $@ +endif include ${TOPDIR}/mk/toolchain.mk diff --git a/toolchain/glibc/Makefile.multilib b/toolchain/glibc/Makefile.multilib new file mode 100644 index 000000000..08be0a100 --- /dev/null +++ b/toolchain/glibc/Makefile.multilib @@ -0,0 +1,13 @@ +# multilib support +ifeq ($(ADK_TARGET_WITH_MULTILIB),y) +TABI:= +ifeq ($(ADK_TARGET_MULTILIB_X86_X32),y) +TABI+=x86_64-openadk-linux-gnu:x32 +endif +ifeq ($(ADK_TARGET_MULTILIB_X86_32),y) +TABI+=i486-openadk-linux-gnu:32 +endif +ifeq ($(ADK_TARGET_MULTILIB_X86_64),y) +TABI+=x86_64-openadk-linux-gnu:64 +endif +endif |