diff options
Diffstat (limited to 'toolchain/uClibc')
-rw-r--r-- | toolchain/uClibc/uclibc.mk | 90 |
1 files changed, 56 insertions, 34 deletions
diff --git a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk index b730a9622..038c9cf37 100644 --- a/toolchain/uClibc/uclibc.mk +++ b/toolchain/uClibc/uclibc.mk @@ -59,6 +59,7 @@ UCLIBC_TARGET_ENDIAN:=$(shell $(SHELL) -c "echo $(ARCH) | sed \ -e 's/mipsel/LITTLE/' \ -e 's/mips/BIG/' \ ") + ifneq ($(UCLIBC_TARGET_ENDIAN),LITTLE) ifneq ($(UCLIBC_TARGET_ENDIAN),BIG) UCLIBC_TARGET_ENDIAN:= @@ -88,6 +89,7 @@ endif uclibc-unpacked: $(UCLIBC_DIR)/.unpacked $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) $(UCLIBC_LOCALE_DATA) [ -d $(TOOL_BUILD_DIR) ] || $(INSTALL) -d $(TOOL_BUILD_DIR) + rm -rf $(UCLIBC_DIR) $(UCLIBC_CAT) $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) - ifneq ($(BR2_UCLIBC_VERSION_SNAPSHOT),y) toolchain/patch-kernel.sh $(UCLIBC_DIR) toolchain/uClibc/ uClibc-$(UCLIBC_VER)-\*.patch @@ -97,7 +99,7 @@ endif ifneq ($(BR2_ENABLE_LOCALE),) cp -dpf $(DL_DIR)/$(UCLIBC_SOURCE_LOCALE) $(UCLIBC_DIR)/extra/locale/ endif - touch $(UCLIBC_DIR)/.unpacked + touch $@ # Some targets may wish to provide their own UCLIBC_CONFIG_FILE... $(UCLIBC_DIR)/.config: $(UCLIBC_DIR)/.unpacked $(UCLIBC_CONFIG_FILE) @@ -126,15 +128,6 @@ ifeq ($(BR2_ARM_OABI),y) endif endif ifneq ($(UCLIBC_TARGET_ENDIAN),) - $(SED) '/^# ARCH_$(UCLIBC_TARGET_ENDIAN)_ENDIAN /{s,# ,,;s, is not set,=y,g}' \ - -e '/^# ARCH_$(UCLIBC_NOT_TARGET_ENDIAN)_ENDIAN /{s,# ,,;s, is not set,=n,g}' \ - $(UCLIBC_DIR)/.config - - $(SED) '/^# ARCH_WANTS_$(UCLIBC_TARGET_ENDIAN)_ENDIAN /{s,# ,,;s, is not set,=y,g}' \ - -e '/^# ARCH_WANTS_$(UCLIBC_NOT_TARGET_ENDIAN)_ENDIAN /{s,# ,,;s, is not set,=n,g}' \ - $(UCLIBC_DIR)/.config -endif -ifneq ($(UCLIBC_TARGET_ENDIAN),) # The above doesn't work for me, so redo $(SED) 's/.*\(ARCH_$(UCLIBC_NOT_TARGET_ENDIAN)_ENDIAN\).*/# \1 is not set/g' \ -e 's/.*\(ARCH_WANTS_$(UCLIBC_NOT_TARGET_ENDIAN)_ENDIAN\).*/# \1 is not set/g' \ @@ -158,7 +151,9 @@ ifeq ($(BR2_SOFT_FLOAT),y) $(UCLIBC_DIR)/.config #$(SED) 's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=n\nHAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(UCLIBC_DIR)/.config else - $(SED) 's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=y\nHAS_FPU=y\nUCLIBC_HAS_FLOATS=y\n,g' $(UCLIBC_DIR)/.config + $(SED) '/UCLIBC_HAS_FLOATS/d' \ + -e 's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=y\nHAS_FPU=y\nUCLIBC_HAS_FLOATS=y\n,g' \ + $(UCLIBC_DIR)/.config endif $(SED) '/UCLIBC_HAS_THREADS/d' $(UCLIBC_DIR)/.config $(SED) '/LINUXTHREADS/d' $(UCLIBC_DIR)/.config @@ -235,7 +230,7 @@ endif RUNTIME_PREFIX=$(TOOL_BUILD_DIR)/uClibc_dev/ \ HOSTCC="$(HOSTCC)" \ oldconfig - touch $(UCLIBC_DIR)/.config + touch -c $@ $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.config set -x && $(MAKE1) -C $(UCLIBC_DIR) \ @@ -245,6 +240,12 @@ $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.config HOSTCC="$(HOSTCC)" \ pregen install_dev # Install the kernel headers to the first stage gcc include dir if necessary +ifeq ($(LINUX_HEADERS_IS_KERNEL),y) + if [ ! -f $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/linux/version.h ] ; \ + then \ + cp -pLR $(LINUX_HEADERS_DIR)/include/* $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/ ; \ + fi +else if [ ! -f $(STAGING_DIR)/include/linux/version.h ] ; then \ cp -pLR $(LINUX_HEADERS_DIR)/include/asm $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/ ; \ cp -pLR $(LINUX_HEADERS_DIR)/include/linux $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/ ; \ @@ -253,7 +254,8 @@ $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.config $(TOOL_BUILD_DIR)/uClibc_dev/usr/include/ ; \ fi; \ fi; - touch $(UCLIBC_DIR)/.configured +endif + touch $@ $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(LIBFLOAT_TARGET) $(MAKE1) -C $(UCLIBC_DIR) \ @@ -262,7 +264,7 @@ $(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(LIBFLOAT_TARGET) RUNTIME_PREFIX=/ \ HOSTCC="$(HOSTCC)" \ all - touch -c $(UCLIBC_DIR)/lib/libc.a + touch -c $@ uclibc-menuconfig: host-sed $(UCLIBC_DIR)/.config $(MAKE1) -C $(UCLIBC_DIR) \ @@ -272,45 +274,59 @@ uclibc-menuconfig: host-sed $(UCLIBC_DIR)/.config HOSTCC="$(HOSTCC)" \ menuconfig && \ cp -f $(UCLIBC_DIR)/.config $(UCLIBC_CONFIG_FILE) && \ - touch $(UCLIBC_DIR)/.config + touch -c $(UCLIBC_DIR)/.config -$(STAGING_DIR)/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a +$(STAGING_DIR)/usr/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a +ifeq ($(findstring y,$(BR2_GCC_VERSION_3_3_5)$(BR2_GCC_VERSION_3_3_6)$(BR2_GCC_VERSION_3_4_2)$(BR2_GCC_VERSION_3_4_3)$(BR2_GCC_VERSION_3_4_4)$(BR2_GCC_VERSION_3_4_5)$(BR2_GCC_VERSION_3_4_6)),y) $(MAKE1) -C $(UCLIBC_DIR) \ PREFIX= \ DEVEL_PREFIX=$(STAGING_DIR)/ \ RUNTIME_PREFIX=$(STAGING_DIR)/ \ install_runtime install_dev +else + $(MAKE1) -C $(UCLIBC_DIR) \ + PREFIX=$(STAGING_DIR) \ + DEVEL_PREFIX=/usr/ \ + RUNTIME_PREFIX=/ \ + install_runtime install_dev +endif # Install the kernel headers to the staging dir if necessary - if [ ! -f $(STAGING_DIR)/include/linux/version.h ] ; then \ - cp -pLR $(LINUX_HEADERS_DIR)/include/asm $(STAGING_DIR)/include/ ; \ - cp -pLR $(LINUX_HEADERS_DIR)/include/linux $(STAGING_DIR)/include/ ; \ +ifeq ($(LINUX_HEADERS_IS_KERNEL),y) + if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ] ; then \ + cp -pLR $(LINUX_HEADERS_DIR)/include/* $(STAGING_DIR)/usr/include/ ; \ + fi +else + + if [ ! -f $(STAGING_DIR)/usr/include/linux/version.h ] ; then \ + cp -pLR $(LINUX_HEADERS_DIR)/include/asm $(STAGING_DIR)/usr/include/ ; \ + cp -pLR $(LINUX_HEADERS_DIR)/include/linux $(STAGING_DIR)/usr/include/ ; \ if [ -d $(LINUX_HEADERS_DIR)/include/asm-generic ] ; then \ cp -pLR $(LINUX_HEADERS_DIR)/include/asm-generic \ - $(STAGING_DIR)/include/ ; \ + $(STAGING_DIR)/usr/include/ ; \ fi; \ fi; +endif # Build the host utils. Need to add an install target... $(MAKE1) -C $(UCLIBC_DIR)/utils \ PREFIX=$(STAGING_DIR) \ HOSTCC="$(HOSTCC)" \ hostutils - install -c $(UCLIBC_DIR)/utils/ldd.host $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/ldd - (cd $(STAGING_DIR)/bin; ln -s ../$(REAL_GNU_TARGET_NAME)/bin/ldd $(GNU_TARGET_NAME)-ldd) - (cd $(STAGING_DIR)/bin; ln -s ../$(REAL_GNU_TARGET_NAME)/bin/ldd $(REAL_GNU_TARGET_NAME)-ldd) - install -c $(UCLIBC_DIR)/utils/ldconfig.host $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/ldconfig - (cd $(STAGING_DIR)/bin; ln -s ../$(REAL_GNU_TARGET_NAME)/bin/ldconfig $(GNU_TARGET_NAME)-ldconfig) - (cd $(STAGING_DIR)/bin; ln -s ../$(REAL_GNU_TARGET_NAME)/bin/ldconfig $(REAL_GNU_TARGET_NAME)-ldconfig) - touch -c $(STAGING_DIR)/lib/libc.a + install -c $(UCLIBC_DIR)/utils/ldd.host $(STAGING_DIR)/usr/bin/ldd + ln -sf ldd $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldd + install -c $(UCLIBC_DIR)/utils/ldconfig.host $(STAGING_DIR)/usr/bin/ldconfig + ln -sf ldconfig $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-ldconfig + ln -sf ldconfig $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-ldconfig + touch -c $@ ifneq ($(TARGET_DIR),) -$(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/lib/libc.a +$(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/usr/lib/libc.a $(MAKE1) -C $(UCLIBC_DIR) \ PREFIX=$(TARGET_DIR) \ DEVEL_PREFIX=/usr/ \ RUNTIME_PREFIX=/ \ install_runtime - touch -c $(TARGET_DIR)/lib/libc.so.0 + touch -c $@ $(TARGET_DIR)/usr/bin/ldd: $(MAKE1) -C $(UCLIBC_DIR) $(TARGET_CONFIGURE_OPTS) \ @@ -320,7 +336,7 @@ ifeq ($(strip $(BR2_CROSS_TOOLCHAIN_TARGET_UTILS)),y) install -c $(TARGET_DIR)/usr/bin/ldd \ $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/target_utils/ldd endif - touch -c $(TARGET_DIR)/usr/bin/ldd + touch -c $@ UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0 endif @@ -328,8 +344,7 @@ endif uclibc-configured: dependencies kernel-headers $(UCLIBC_DIR)/.configured -uclibc: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc $(STAGING_DIR)/lib/libc.a \ - $(UCLIBC_TARGETS) +uclibc: $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc $(STAGING_DIR)/usr/lib/libc.a $(UCLIBC_TARGETS) uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE) @@ -351,13 +366,19 @@ uclibc-target-utils: $(TARGET_DIR)/usr/bin/ldd # ############################################################# -$(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a +$(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/usr/lib/libc.a $(MAKE1) -C $(UCLIBC_DIR) \ PREFIX=$(TARGET_DIR) \ DEVEL_PREFIX=/usr/ \ RUNTIME_PREFIX=/ \ install_dev # Install the kernel headers to the target dir if necessary +ifeq ($(LINUX_HEADERS_IS_KERNEL),y) + if [ ! -f $(TARGET_DIR)/usr/include/linux/version.h ] ; \ + then \ + cp -pLR $(LINUX_HEADERS_DIR)/include/* $(TARGET_DIR)/usr/include/ ; \ + fi +else if [ ! -f $(TARGET_DIR)/usr/include/linux/version.h ] ; then \ cp -pLR $(LINUX_HEADERS_DIR)/include/asm $(TARGET_DIR)/usr/include/ ; \ cp -pLR $(LINUX_HEADERS_DIR)/include/linux $(TARGET_DIR)/usr/include/ ; \ @@ -366,7 +387,8 @@ $(TARGET_DIR)/usr/lib/libc.a: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib/libc.a $(TARGET_DIR)/usr/include/ ; \ fi; \ fi; - touch -c $(TARGET_DIR)/usr/lib/libc.a +endif + touch -c $@ uclibc_target: gcc uclibc $(TARGET_DIR)/usr/lib/libc.a $(TARGET_DIR)/usr/bin/ldd |