summaryrefslogtreecommitdiff
path: root/toolchain
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2015-12-02 08:51:13 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2015-12-02 08:53:47 +0100
commitf06aece697aeab98f44c6ad0017e87e36c8ae764 (patch)
tree2dbfa60819b6fae3358eb997d41826940424f4c7 /toolchain
parentfcfd8fdbd759d500a5b585e58fade1bd74801c49 (diff)
simplify toolchain building
Buildroot uses the two-stage mechanism since a while. This reduces the build time a lot. Instead of three stages, we just use the two-stage build. The benefit is that the C library do not need to be rebuild and one gcc compile is obsolete. Tested with embedded-test.sh. There is one unresolved problem, tile toolchain building is broken.
Diffstat (limited to 'toolchain')
-rw-r--r--toolchain/Makefile31
-rw-r--r--toolchain/binutils/Makefile4
-rw-r--r--toolchain/gcc/Makefile104
-rw-r--r--toolchain/gcc/patches/4.9.3/fix-m86k-libgcc.patch11
-rw-r--r--toolchain/gcc/patches/4.9.3/fix-nios2.patch11
-rw-r--r--toolchain/gcc/patches/4.9.3/stdlib-h.ia6430
-rw-r--r--toolchain/glibc/Makefile34
-rw-r--r--toolchain/kernel-headers/Makefile3
-rw-r--r--toolchain/musl/Makefile32
-rw-r--r--toolchain/uclibc-ng/Makefile47
10 files changed, 128 insertions, 179 deletions
diff --git a/toolchain/Makefile b/toolchain/Makefile
index 19ee5dd44..e81b2b073 100644
--- a/toolchain/Makefile
+++ b/toolchain/Makefile
@@ -4,14 +4,11 @@
# Steps to build toolchains
# 1) build and install binutils
# 2) build and install mpfr, mpc, libelf and gmp
-# 3) build and install minimal gcc c compiler
+# 3) build and install initial gcc
# 4) install kernel-headers
-# 5) install libc headers
-# 6) build and install initial static gcc
-# 7) build and install full libc
-# 8) build and install full shared gcc
-# 9) rebuild and install full libc (in case of musl/uclibc)
-# 10) build and install gdb debugger
+# 5) build and install full libc
+# 6) build and install full gcc
+# 7) build and install gdb debugger
include $(ADK_TOPDIR)/rules.mk
@@ -46,20 +43,18 @@ endif
DOWNLOAD:=kernel-headers-download $(patsubst %,%-download,$(TARGETS))
TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS))
-FIXUP:=$(patsubst %,%-fixup,$(CLIB))
+FINAL:=$(patsubst %,%-final,gcc)
TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
install: $(TARGETS_INSTALL)
clean: $(TARGETS_CLEAN)
download: $(DOWNLOAD)
-fixup: $(FIXUP)
+final: $(FINAL)
-gcc-prepare: binutils-install gmp-install mpfr-install mpc-install libelf-install
-$(CLIB)-prepare: gcc-prepare kernel-headers-prepare
-gcc-configure: $(CLIB)-prepare
-$(CLIB)-compile: gcc-configure
-gcc-compile: $(CLIB)-install
-$(CLIB)-fixup: gcc-install $(GDB) $(ELF2FLT)
+gcc-configure: binutils-install gmp-install mpfr-install mpc-install libelf-install
+$(CLIB)-install: gcc-configure kernel-headers-configure
+gcc-install: $(CLIB)-install
+gcc-final: gcc-install $(GDB) $(ELF2FLT)
%-download:
$(TRACE) toolchain/$(patsubst %-download,%,$@)/download
@@ -105,9 +100,9 @@ $(CLIB)-fixup: gcc-install $(GDB) $(ELF2FLT)
CC='$(HOST_CC)' CFLAGS='$(HOST_CFLAGS)' CXXFLAGS='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE); \
fi
-%-fixup: %-install
- $(TRACE) toolchain/$(patsubst %-fixup,%,$@)/fixup
- @$(MAKE) -C $(patsubst %-fixup,%,$@) fixup $(MAKE_TRACE)
+%-final: %-install
+ $(TRACE) toolchain/$(patsubst %-final,%,$@)/final
+ @$(MAKE) -C $(patsubst %-final,%,$@) final $(MAKE_TRACE)
%-clean:
$(TRACE) toolchain/$(patsubst %-clean,%,$@)/clean
diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile
index d4f6a54a9..7b276ae6d 100644
--- a/toolchain/binutils/Makefile
+++ b/toolchain/binutils/Makefile
@@ -69,8 +69,8 @@ $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
$(MAKE) -C $(WRKBUILD) install
ifeq ($(ADK_TOOLCHAIN_BINUTILS_GIT),y)
ifeq ($(ADK_TARGET_ARCH_H8300),y)
- $(INSTALL_DIR) $(TOOLCHAIN_DIR)/usr/lib/ldscripts
- $(CP) $(WRKBUILD)/ld/ldscripts/* $(TOOLCHAIN_DIR)/usr/lib/ldscripts/
+ $(INSTALL_DIR) $(STAGING_TARGET_DIR)/usr/lib/ldscripts
+ $(CP) $(WRKBUILD)/ld/ldscripts/* $(STAGING_TARGET_DIR)/usr/lib/ldscripts/
endif
endif
@touch $@
diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile
index c4c053bda..079ddd0e5 100644
--- a/toolchain/gcc/Makefile
+++ b/toolchain/gcc/Makefile
@@ -56,7 +56,6 @@ GCC_CONFOPTS:= --prefix=$(TOOLCHAIN_DIR)/usr \
--without-isl \
--disable-nls
-
ifeq ($(ADK_TARGET_WITH_NPTL),y)
GCC_FINAL_CONFOPTS:= --enable-tls --enable-threads --enable-libatomic
endif
@@ -188,16 +187,15 @@ endif
include ${ADK_TOPDIR}/mk/buildhlp.mk
-GCC_BUILD_DIR_MINIMAL:= $(WRKBUILD)-minimal
GCC_BUILD_DIR_INITIAL:= $(WRKBUILD)-initial
GCC_BUILD_DIR_FINAL:= $(WRKBUILD)-final
-$(GCC_BUILD_DIR_MINIMAL)/.configured:
+$(GCC_BUILD_DIR_INITIAL)/.configured:
ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_XTENSA).tar \
--strip-components=1 -C $(WRKSRC) gcc
endif
- mkdir -p $(GCC_BUILD_DIR_MINIMAL)
+ mkdir -p $(GCC_BUILD_DIR_INITIAL)
# these symlinks are very important, do not remove
rm -rf $(TOOLCHAIN_DIR)/usr/$(GNU_TARGET_NAME)/sys-include
mkdir -p $(TOOLCHAIN_DIR)/usr/$(GNU_TARGET_NAME)
@@ -205,7 +203,7 @@ endif
ln -s ../$(STAGING_HOST2TARGET)/usr/include sys-include)
rm -rf ${TOOLCHAIN_DIR}/usr/$(GNU_TARGET_NAME)/lib
(cd $(TOOLCHAIN_DIR)/usr/$(GNU_TARGET_NAME); \
- ln -s ../$(STAGING_HOST2TARGET)/lib lib)
+ ln -s ../$(STAGING_HOST2TARGET)/usr/lib lib)
ifeq ($(ADK_TARGET_ARCH_SH),y)
ifeq ($(ADK_CPU_SH3),y)
(cd ${STAGING_TARGET_DIR}/ && ln -sf . m3)
@@ -217,8 +215,12 @@ ifeq ($(ADK_CPU_SH4A),y)
(cd ${STAGING_TARGET_DIR}/ && ln -sf . m4a)
endif
endif
+ifeq ($(ADK_TARGET_ARCH_ARC),y)
+ $(SED) 's/crtbeginS.o libgmon.a crtg.o/crtbeginS.o crtg.o/' \
+ $(WRKBUILD)/libgcc/config.host
+endif
$(SED) '/k prot/agcc_cv_libc_provides_ssp=yes' $(WRKBUILD)/gcc/configure
- cd $(GCC_BUILD_DIR_MINIMAL); \
+ cd $(GCC_BUILD_DIR_INITIAL); \
PATH='$(TARGET_PATH)' \
CC='$(HOST_CC)' \
CXX='$(HOST_CXX)' \
@@ -227,57 +229,47 @@ endif
$(WRKBUILD)/configure \
${GCC_CONFOPTS} \
--enable-languages=c \
- --disable-libssp \
+ --with-newlib \
+ --enable-tls \
--disable-shared \
--disable-threads \
--disable-multilib \
--without-headers
touch $@
-$(GCC_BUILD_DIR_MINIMAL)/.compiled: $(GCC_BUILD_DIR_MINIMAL)/.configured
- PATH='$(TARGET_PATH)' $(MAKE) ${GCC_MAKEOPTS} -C $(GCC_BUILD_DIR_MINIMAL) all-gcc
- touch $@
-
-$(WRKBUILD)/.headers: $(GCC_BUILD_DIR_MINIMAL)/.compiled
- PATH='$(TARGET_PATH)' $(MAKE) -C $(GCC_BUILD_DIR_MINIMAL) install-gcc
- touch $@
-
-$(GCC_BUILD_DIR_INITIAL)/.configured:
- mkdir -p $(GCC_BUILD_DIR_INITIAL)
- cd $(GCC_BUILD_DIR_INITIAL); \
- PATH='$(TARGET_PATH)' \
- CC='$(HOST_CC)' \
- CXX='$(HOST_CXX)' \
- CFLAGS="-O0 -g0 -fomit-frame-pointer" \
- CXXFLAGS="-O0 -g0 -fomit-frame-pointer" \
- $(WRKBUILD)/configure \
- ${GCC_CONFOPTS} \
- ${GCC_FINAL_CONFOPTS} \
- --enable-languages=c \
- --disable-shared \
- --disable-threads \
- --with-sysroot=$(STAGING_TARGET_DIR)
- touch $@
-
-ifeq ($(ADK_TOOLCHAIN_GCC_4_2_4),y)
$(GCC_BUILD_DIR_INITIAL)/.compiled: $(GCC_BUILD_DIR_INITIAL)/.configured
- PATH='$(TARGET_PATH)' $(MAKE) ${GCC_MAKEOPTS} -C $(GCC_BUILD_DIR_INITIAL) all-gcc
- touch $@
-
-$(WRKBUILD)/.configured: $(GCC_BUILD_DIR_INITIAL)/.compiled
- PATH='$(TARGET_PATH)' $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) install-gcc
- touch $@
+ifeq ($(ADK_TOOLCHAIN_GCC_OLD),y)
+ PATH='$(TARGET_PATH)' \
+ $(MAKE) ${GCC_MAKEOPTS} -C $(GCC_BUILD_DIR_INITIAL) all-gcc
else
-$(GCC_BUILD_DIR_INITIAL)/.compiled: $(GCC_BUILD_DIR_INITIAL)/.configured
- PATH='$(TARGET_PATH)' $(MAKE) ${GCC_MAKEOPTS} -C $(GCC_BUILD_DIR_INITIAL) all-gcc all-target-libgcc
+ PATH='$(TARGET_PATH)' \
+ $(MAKE) ${GCC_MAKEOPTS} -C $(GCC_BUILD_DIR_INITIAL) all-gcc all-target-libgcc
+endif
touch $@
$(WRKBUILD)/.configured: $(GCC_BUILD_DIR_INITIAL)/.compiled
- PATH='$(TARGET_PATH)' $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) install-gcc install-target-libgcc
- touch $@
+ifeq ($(ADK_TOOLCHAIN_GCC_OLD),y)
+ PATH='$(TARGET_PATH)' \
+ $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) install-gcc
+else
+ PATH='$(TARGET_PATH)' \
+ $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) install-gcc install-target-libgcc
+endif
+ifeq ($(ADK_TARGET_ARCH_M68K),y)
+ # create gcc wrapper for uClinux/m68k
+ echo "#!/bin/sh" > $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
+ echo "exec ${GNU_TARGET_NAME}-gcc \"\$$@\" -specs $(ADK_TOPDIR)/toolchain/gcc/m68k-uclinux-gcc.specs" >> $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
+ chmod a+x $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
endif
+ifeq ($(ADK_TARGET_ARCH_ARM),y)
+ # create gcc wrapper for uClinux/arm
+ echo "#!/bin/sh" > $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
+ echo "exec ${GNU_TARGET_NAME}-gcc \"\$$@\" -specs $(ADK_TOPDIR)/toolchain/gcc/arm-uclinux-gcc.specs" >> $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
+ chmod a+x $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
+endif
+ touch $@
-$(GCC_BUILD_DIR_FINAL)/.configured:
+$(WRKBUILD)/.compiled:
mkdir -p $(GCC_BUILD_DIR_FINAL)
cd $(GCC_BUILD_DIR_FINAL); \
PATH='$(TARGET_PATH)' \
@@ -293,9 +285,6 @@ $(GCC_BUILD_DIR_FINAL)/.configured:
--with-build-sysroot='$${prefix}/${STAGING_HOST2TARGET}' \
--with-sysroot='$${prefix}/${STAGING_HOST2TARGET}'
PATH='$(TARGET_PATH)' $(MAKE) -C $(GCC_BUILD_DIR_FINAL) configure-host
- touch $@
-
-$(WRKBUILD)/.compiled: $(GCC_BUILD_DIR_FINAL)/.configured
cd $(GCC_BUILD_DIR_FINAL); \
PATH='$(TARGET_PATH)' \
$(MAKE) ${GCC_MAKEOPTS} all
@@ -327,20 +316,17 @@ endif
cd $(STAGING_TARGET_DIR)/lib && \
ln -sf libstdc++.so.6.0.$(LIBSTDCXXVER) libstdc++.so && \
ln -sf libstdc++.so.6.0.$(LIBSTDCXXVER) libstdc++.so.6
+ touch $@
+
+$(WRKBUILD)/.final:
# cleanup unneeded docs
rm -rf $(TOOLCHAIN_DIR)/usr/share
-ifeq ($(ADK_TARGET_ARCH_M68K),y)
- # create gcc wrapper for uClinux/m68k
- echo "#!/bin/sh" > $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
- echo "exec ${GNU_TARGET_NAME}-gcc \"\$$@\" -specs $(ADK_TOPDIR)/toolchain/gcc/m68k-uclinux-gcc.specs" >> $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
- chmod a+x $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
-endif
-ifeq ($(ADK_TARGET_ARCH_ARM),y)
- # create gcc wrapper for uClinux/arm
- echo "#!/bin/sh" > $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
- echo "exec ${GNU_TARGET_NAME}-gcc \"\$$@\" -specs $(ADK_TOPDIR)/toolchain/gcc/arm-uclinux-gcc.specs" >> $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
- chmod a+x $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
-endif
+ # cleanup unneeded libtool files
+ -find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -exec rm {} \;
+ # strip target libs and host tools for toolchain builds
+ PATH="$(TARGET_PATH)" debug='0' prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh \
+ $(STAGING_TARGET_DIR) $(TOOLCHAIN_DIR)/usr/lib/gcc/$(GNU_TARGET_NAME)
+ debug='0' prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(TOOLCHAIN_DIR)/usr/bin
touch $@
include ${ADK_TOPDIR}/mk/toolchain.mk
diff --git a/toolchain/gcc/patches/4.9.3/fix-m86k-libgcc.patch b/toolchain/gcc/patches/4.9.3/fix-m86k-libgcc.patch
new file mode 100644
index 000000000..e8481d549
--- /dev/null
+++ b/toolchain/gcc/patches/4.9.3/fix-m86k-libgcc.patch
@@ -0,0 +1,11 @@
+diff -Nur gcc-4.9.3.orig/libgcc/config/m68k/linux-atomic.c gcc-4.9.3/libgcc/config/m68k/linux-atomic.c
+--- gcc-4.9.3.orig/libgcc/config/m68k/linux-atomic.c 2014-01-02 23:25:22.000000000 +0100
++++ gcc-4.9.3/libgcc/config/m68k/linux-atomic.c 2015-11-29 14:42:10.566143595 +0100
+@@ -33,7 +33,6 @@
+ using the kernel helper defined below. There is no support for
+ 64-bit operations yet. */
+
+-#include <asm/unistd.h>
+ #include <stdbool.h>
+
+ #ifndef __NR_atomic_cmpxchg_32
diff --git a/toolchain/gcc/patches/4.9.3/fix-nios2.patch b/toolchain/gcc/patches/4.9.3/fix-nios2.patch
new file mode 100644
index 000000000..8fe2589ce
--- /dev/null
+++ b/toolchain/gcc/patches/4.9.3/fix-nios2.patch
@@ -0,0 +1,11 @@
+diff -Nur gcc-4.9.3.orig/libgcc/config/nios2/linux-atomic.c gcc-4.9.3/libgcc/config/nios2/linux-atomic.c
+--- gcc-4.9.3.orig/libgcc/config/nios2/linux-atomic.c 2014-01-02 23:25:22.000000000 +0100
++++ gcc-4.9.3/libgcc/config/nios2/linux-atomic.c 2015-12-01 22:50:00.029946306 +0100
+@@ -20,7 +20,6 @@
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+-#include <asm/unistd.h>
+ #define EFAULT 14
+ #define EBUSY 16
+ #define ENOSYS 38
diff --git a/toolchain/gcc/patches/4.9.3/stdlib-h.ia64 b/toolchain/gcc/patches/4.9.3/stdlib-h.ia64
new file mode 100644
index 000000000..cdbbd6000
--- /dev/null
+++ b/toolchain/gcc/patches/4.9.3/stdlib-h.ia64
@@ -0,0 +1,30 @@
+diff -Nur gcc-4.9.3.orig/libgcc/config/ia64/fde-glibc.c gcc-4.9.3/libgcc/config/ia64/fde-glibc.c
+--- gcc-4.9.3.orig/libgcc/config/ia64/fde-glibc.c 2014-01-02 23:25:22.000000000 +0100
++++ gcc-4.9.3/libgcc/config/ia64/fde-glibc.c 2015-12-01 07:06:43.963906167 +0100
+@@ -25,6 +25,8 @@
+ /* Locate the FDE entry for a given address, using glibc ld.so routines
+ to avoid register/deregister calls at DSO load/unload. */
+
++#ifndef inhibit_libc
++
+ #ifndef _GNU_SOURCE
+ #define _GNU_SOURCE 1
+ #endif
+@@ -159,3 +161,4 @@
+
+ return data.ret;
+ }
++#endif
+diff -Nur gcc-4.9.3.orig/libgcc/unwind-generic.h gcc-4.9.3/libgcc/unwind-generic.h
+--- gcc-4.9.3.orig/libgcc/unwind-generic.h 2014-01-02 23:25:22.000000000 +0100
++++ gcc-4.9.3/libgcc/unwind-generic.h 2015-12-01 07:00:15.731287428 +0100
+@@ -221,7 +221,9 @@
+ compatible with the standard ABI for IA-64, we inline these. */
+
+ #ifdef __ia64__
++#ifndef inhibit_libc
+ #include <stdlib.h>
++#endif
+
+ static inline _Unwind_Ptr
+ _Unwind_GetDataRelBase (struct _Unwind_Context *_C)
diff --git a/toolchain/glibc/Makefile b/toolchain/glibc/Makefile
index cecb784c9..c952a9c12 100644
--- a/toolchain/glibc/Makefile
+++ b/toolchain/glibc/Makefile
@@ -20,30 +20,8 @@ ifeq (${ADK_MAKE_PARALLEL},y)
GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j$(ADK_MAKE_JOBS)"
endif
-
-GLIBC_BUILD_DIR_INITIAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers
GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
-$(WRKBUILD)/.headers_configure:
- mkdir -p $(GLIBC_BUILD_DIR_INITIAL)
- (cd $(GLIBC_BUILD_DIR_INITIAL); \
- ${GLIBC_ENV} \
- $(WRKBUILD)/configure \
- --prefix=$(STAGING_TARGET_DIR)/usr \
- --with-sysroot=$(STAGING_TARGET_DIR) \
- ${GLIBC_CONFOPTS} \
- );
- touch $@
-
-$(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
- (cd $(GLIBC_BUILD_DIR_INITIAL); \
- ${GLIBC_ENV} \
- $(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,soft,hard}.h
- touch $@
-
$(WRKBUILD)/.configured:
mkdir -p $(GLIBC_BUILD_DIR_FINAL)
(cd $(GLIBC_BUILD_DIR_FINAL); \
@@ -62,20 +40,14 @@ $(WRKBUILD)/.compiled:
$(WRKBUILD)/.installed:
${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
+ touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
+ touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64,soft,hard}.h
mkdir -p ${STAGING_TARGET_DIR}/etc
${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc
${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
touch $@
-$(WRKBUILD)/.fixup:
- -find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -exec rm {} \;
- rm -rf $(STAGING_TARGET_DIR)/usr/share/locale $(STAGING_TARGET_DIR)/usr/share/i18n
-ifeq ($(ADK_TARGET_TOOLCHAIN),y)
- # strip target libs and host tools for toolchain builds
- PATH="$(TARGET_PATH)" debug='0' prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh \
- $(STAGING_TARGET_DIR) $(TOOLCHAIN_DIR)/usr/lib/gcc/$(GNU_TARGET_NAME)
- debug='0' prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(TOOLCHAIN_DIR)/usr/bin
-endif
+$(WRKBUILD)/.final:
touch $@
include ${ADK_TOPDIR}/mk/toolchain.mk
diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
index 1628c80aa..a835a349a 100644
--- a/toolchain/kernel-headers/Makefile
+++ b/toolchain/kernel-headers/Makefile
@@ -12,7 +12,6 @@ LINUX_DIR=${WRKBUILD}
include $(ADK_TOPDIR)/mk/kernel-vars.mk
-
$(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_FILE_VER)/.patched:
ifeq ($(ADK_TARGET_SYSTEM_PCENGINES_APU),y)
ifeq ($(ADK_KERNEL_ROOT_NFS),y)
@@ -39,7 +38,7 @@ ifneq ($(ADK_DISABLE_TARGET_KERNEL_PATCHES),y)
endif
touch $@
-$(WRKBUILD)/.headers: $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_FILE_VER)/.patched
+$(WRKBUILD)/.configured: $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_FILE_VER)/.patched
$(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
INSTALL_HDR_PATH=$(STAGING_TARGET_DIR)/usr \
headers_install
diff --git a/toolchain/musl/Makefile b/toolchain/musl/Makefile
index a5cfaa4a2..8390b13a7 100644
--- a/toolchain/musl/Makefile
+++ b/toolchain/musl/Makefile
@@ -13,26 +13,16 @@ endif
TARGET_CFLAGS:= $(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
TARGET_LDFLAGS:= $(filter-out -fstack-protector-all,$(TARGET_LDFLAGS))
-$(WRKBUILD)/.headers:
+$(WRKBUILD)/.configured:
(cd $(WRKBUILD); CC='$(TARGET_CC)' CROSS_COMPILE='$(TARGET_CROSS)' \
CFLAGS='$(TARGET_CFLAGS)' \
./configure --prefix=/usr \
--target=$(GNU_TARGET_NAME) \
--disable-gcc-wrapper \
)
- $(MAKE) -C $(WRKBUILD) DESTDIR=$(STAGING_TARGET_DIR) install-headers
- touch $(WRKBUILD)/.configured
touch $@
$(WRKBUILD)/.compiled:
- # reconfigure musl, otherwise linking with libgcc or libgcc_eh is disabled
- $(MAKE) -C $(WRKBUILD) clean
- (cd $(WRKBUILD); CC='$(TARGET_CC)' CROSS_COMPILE='$(TARGET_CROSS)' \
- CFLAGS='$(TARGET_CFLAGS)' \
- ./configure --prefix=/usr \
- --target=$(GNU_TARGET_NAME) \
- --disable-gcc-wrapper \
- )
$(MAKE) -C $(WRKBUILD) CFLAGS='$(TARGET_CFLAGS)' all
touch $@
@@ -40,25 +30,7 @@ $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
$(MAKE) -C $(WRKBUILD) CFLAGS='$(TARGET_CFLAGS)' DESTDIR=$(STAGING_TARGET_DIR) install
touch $@
-$(WRKBUILD)/.fixup:
- # reconfigure musl, otherwise linking with libgcc or libgcc_eh is disabled
- $(MAKE) -C $(WRKBUILD) clean
- (cd $(WRKBUILD); CC='$(TARGET_CC)' CROSS_COMPILE='$(TARGET_CROSS)' \
- CFLAGS='$(TARGET_CFLAGS)' \
- ./configure --prefix=/usr \
- --target=$(GNU_TARGET_NAME) \
- --disable-gcc-wrapper \
- )
- $(MAKE) -C $(WRKBUILD) CFLAGS='$(TARGET_CFLAGS)' all
- $(MAKE) -C $(WRKBUILD) CFLAGS='$(TARGET_CFLAGS)' DESTDIR=$(STAGING_TARGET_DIR) install
- # cleanup toolchain
- -find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -exec rm {} \;
-ifeq ($(ADK_TARGET_TOOLCHAIN),y)
- # strip target libs and host tools for toolchain builds
- PATH="$(TARGET_PATH)" debug='0' prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh \
- $(STAGING_TARGET_DIR) $(TOOLCHAIN_DIR)/usr/lib/gcc/$(GNU_TARGET_NAME)
- debug='0' prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(TOOLCHAIN_DIR)/usr/bin
-endif
+$(WRKBUILD)/.final:
touch $@
include ${ADK_TOPDIR}/mk/toolchain.mk
diff --git a/toolchain/uclibc-ng/Makefile b/toolchain/uclibc-ng/Makefile
index 53ee55a75..5a6442952 100644
--- a/toolchain/uclibc-ng/Makefile
+++ b/toolchain/uclibc-ng/Makefile
@@ -8,6 +8,7 @@ include ../rules.mk
include Makefile.inc
include ${ADK_TOPDIR}/mk/buildhlp.mk
+# disable LTO
TARGET_CFLAGS:=$(filter-out -flto,$(TARGET_CFLAGS))
# handled by uClibc-ng makefiles
TARGET_CFLAGS:=$(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
@@ -35,7 +36,7 @@ ifeq (${ADK_MAKE_PARALLEL},y)
UCLIBC_MAKEOPTS+= -j${ADK_MAKE_JOBS}
endif
-$(WRKBUILD)/.headers:
+$(WRKBUILD)/.configured: $(WRKBUILD)/.prepared
$(SED) 's,^CROSS_COMPILE=.*,CROSS_COMPILE=$(TARGET_CROSS),g' $(WRKBUILD)/Rules.mak
ifeq ($(ADK_TARGET_LIB_UCLIBC_NG_GIT),y)
PATH='$(HOST_PATH)' sed -e 's^KERNEL_HEADERS.*$$KERNEL_HEADERS=\"${STAGING_TARGET_DIR}/usr/include\"' \
@@ -277,7 +278,7 @@ ifeq ($(ADK_TARGET_ABI_O32),y)
$(SED) 's/.*\(CONFIG_MIPS_N64_ABI\).*/# \1 is not set/' ${WRKBUILD}/.config
endif
endif
- echo N|PATH='$(HOST_PATH)' $(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
+ echo N|PATH='$(HOST_PATH)' $(MAKE) $(UCLIBC_MAKEOPTS) -C $(WRKBUILD) \
PREFIX=$(STAGING_TARGET_DIR) \
DEVEL_PREFIX=/usr/ \
RUNTIME_PREFIX=$(STAGING_TARGET_DIR) \
@@ -285,19 +286,10 @@ endif
UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
oldconfig
- PATH='$(HOST_PATH)' $(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
- PREFIX=$(STAGING_TARGET_DIR) \
- DEVEL_PREFIX=/usr/ \
- RUNTIME_PREFIX=$(STAGING_TARGET_DIR) \
- HOSTCC="$(HOST_CC)" \
- UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
- UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
- install_headers
- touch $(WRKBUILD)/.configured
touch $@
-$(WRKBUILD)/.compiled:
- PATH='$(HOST_PATH)' $(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
+$(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
+ PATH='$(HOST_PATH)' $(MAKE) $(UCLIBC_MAKEOPTS) -C $(WRKBUILD) \
PREFIX= \
DEVEL_PREFIX=/usr/ \
RUNTIME_PREFIX=/ \
@@ -308,7 +300,7 @@ $(WRKBUILD)/.compiled:
all
touch $@
-$(WRKBUILD)/.install_headers: $(WRKBUILD)/.compiled
+$(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
PATH='$(HOST_PATH)' $(MAKE) -C $(WRKBUILD) \
PREFIX=$(STAGING_TARGET_DIR) \
DEVEL_PREFIX=/usr/ \
@@ -317,38 +309,19 @@ $(WRKBUILD)/.install_headers: $(WRKBUILD)/.compiled
UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
VERBOSE=1 \
- install_dev
- touch $@
-
-$(WRKBUILD)/.installed: $(WRKBUILD)/.install_headers
+ install_runtime install_dev
PATH='$(HOST_PATH)' $(MAKE) -C $(WRKBUILD) \
- PREFIX=$(STAGING_TARGET_DIR) \
+ CC='$(TARGET_CC)' \
+ PREFIX= \
DEVEL_PREFIX=/usr/ \
- DEVEL_PREFIX_LIB=/ \
RUNTIME_PREFIX=/ \
+ HOSTCC="$(HOST_CC)" \
UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
- VERBOSE=1 \
- install_runtime
- touch $@
-
-$(WRKBUILD)/.fixup:
- PATH='$(HOST_PATH)' $(MAKE) -C $(WRKBUILD) \
- CC='$(TARGET_CC)' \
TEST_INSTALLED_UCLIBC=1 \
UCLIBC_ONLY=1 \
- UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
- UCLIBC_EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
VERBOSE=1 \
test_compile test_gen
-ifeq ($(ADK_TARGET_TOOLCHAIN),y)
- # cleanup toolchain
- -find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -exec rm {} \;
- # strip target libs and host tools for toolchain builds
- PATH="$(TARGET_PATH)" debug='0' prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh \
- $(STAGING_TARGET_DIR) $(TOOLCHAIN_DIR)/usr/lib/gcc/$(GNU_TARGET_NAME)
- debug='0' prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(TOOLCHAIN_DIR)/usr/bin
-endif
touch $@
include ${ADK_TOPDIR}/mk/toolchain.mk