summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-02-12 10:39:09 +0000
committerEric Andersen <andersen@codepoet.org>2003-02-12 10:39:09 +0000
commitd4ef2a6a25ec7cd1a968f7367706925825868452 (patch)
treedd671aea8c761fce2ea62203a6bfae88cc3e7798
parentde2ae8dcf37d6a6c62da6abb4c750b1db6803269 (diff)
Update toolchains a bit forther so that after blowing away the 'build'
directory we do not need to rebuild the toolchain (which now is built under 'toolchain_build'). Should help prevent a bunch of unnecessary toolchain rebuilds. -Erik
-rw-r--r--make/uclibc_toolchain.mk12
-rw-r--r--make/uclibc_toolchain_2_95.mk171
2 files changed, 90 insertions, 93 deletions
diff --git a/make/uclibc_toolchain.mk b/make/uclibc_toolchain.mk
index 662f77f1f..74e780260 100644
--- a/make/uclibc_toolchain.mk
+++ b/make/uclibc_toolchain.mk
@@ -72,7 +72,7 @@ GCC_DIR:=$(TOOL_BUILD_DIR)/gcc-3.2.2
# Setup some initial paths
#
#############################################################
-$(TOOL_BUILD_DIR)/.setup:
+$(STAGING_DIR)/.setup:
mkdir -p $(TOOL_BUILD_DIR)
mkdir -p $(DL_DIR)
mkdir -p $(STAGING_DIR)
@@ -85,7 +85,7 @@ $(TOOL_BUILD_DIR)/.setup:
(cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include)
(cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include sys-include)
(cd $(STAGING_DIR)/usr/lib; ln -fs ../../lib/gcc-lib)
- touch $(TOOL_BUILD_DIR)/.setup
+ touch $(STAGING_DIR)/.setup
#############################################################
@@ -110,7 +110,7 @@ BINUTILS_DIR1:=$(TOOL_BUILD_DIR)/binutils-build
$(DL_DIR)/$(BINUTILS_SOURCE):
$(WGET) -P $(DL_DIR) $(BINUTILS_SITE)/$(BINUTILS_SOURCE)
-$(BINUTILS_DIR)/.unpacked: $(TOOL_BUILD_DIR)/.setup $(DL_DIR)/$(BINUTILS_SOURCE)
+$(BINUTILS_DIR)/.unpacked: $(DL_DIR)/$(BINUTILS_SOURCE)
bzcat $(DL_DIR)/$(BINUTILS_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
touch $(BINUTILS_DIR)/.unpacked
@@ -197,7 +197,7 @@ GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-initial
$(DL_DIR)/$(GCC_SOURCE):
$(WGET) -P $(DL_DIR) $(GCC_SITE)/$(GCC_SOURCE)
-$(GCC_DIR)/.unpacked: $(TOOL_BUILD_DIR)/.setup $(DL_DIR)/$(GCC_SOURCE)
+$(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
zcat $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
touch $(GCC_DIR)/.unpacked
@@ -301,7 +301,7 @@ gcc_initial-dirclean:
$(DL_DIR)/$(UCLIBC_SOURCE):
$(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE)
-$(UCLIBC_DIR)/.unpacked: $(TOOL_BUILD_DIR)/.setup $(DL_DIR)/$(UCLIBC_SOURCE)
+$(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE)
bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(BUILD_DIR) -xvf -
touch $(UCLIBC_DIR)/.unpacked
@@ -458,7 +458,7 @@ $(STAGING_DIR)/bin/$(ARCH)-uclibc-g++: $(GCC_BUILD_DIR2)/.compiled
fi; \
done;
-gcc_final: binutils gcc_initial uclibc $(STAGING_DIR)/bin/$(ARCH)-uclibc-g++
+gcc_final: $(STAGING_DIR)/.setup binutils gcc_initial uclibc $(STAGING_DIR)/bin/$(ARCH)-uclibc-g++
gcc_final-clean:
rm -rf $(GCC_BUILD_DIR2)
diff --git a/make/uclibc_toolchain_2_95.mk b/make/uclibc_toolchain_2_95.mk
index 254c76c0c..0c08e097c 100644
--- a/make/uclibc_toolchain_2_95.mk
+++ b/make/uclibc_toolchain_2_95.mk
@@ -26,7 +26,7 @@ ifeq ($(GCC_2_95_TOOLCHAIN),true)
#
#############################################################
#Directory in which to build the toolchain
-TOOL_BUILD_DIR:=$(BASE_DIR)/toolchain_build
+TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build
TARGET_LANGUAGES:=c,c++
@@ -52,11 +52,11 @@ BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-2.13.2.1
ifeq ($(USE_UCLIBC_SNAPSHOT),true)
# Be aware that this changes daily....
-UCLIBC_DIR=$(TOOL_BUILD_DIR)/uClibc
+UCLIBC_DIR=$(BUILD_DIR)/uClibc
UCLIBC_SOURCE=uClibc-snapshot.tar.bz2
UCLIBC_SITE:=http://www.uclibc.org/downloads/snapshots
else
-UCLIBC_DIR:=$(TOOL_BUILD_DIR)/uClibc-0.9.17
+UCLIBC_DIR:=$(BUILD_DIR)/uClibc-0.9.17
UCLIBC_SOURCE:=uClibc-0.9.17.tar.bz2
UCLIBC_SITE:=http://www.kernel.org/pub/linux/libs/uclibc
endif
@@ -86,11 +86,12 @@ $(TOOL_BUILD_DIR)/.setup:
mkdir -p $(STAGING_DIR)
mkdir -p $(STAGING_DIR)/include
mkdir -p $(STAGING_DIR)/lib/gcc-lib
+ mkdir -p $(STAGING_DIR)/usr/lib
+ mkdir -p $(STAGING_DIR)/usr/bin;
mkdir -p $(STAGING_DIR)/$(GNU_TARGET_NAME)/
(cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../lib)
(cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include)
(cd $(STAGING_DIR)/$(GNU_TARGET_NAME); ln -fs ../include sys-include)
- mkdir -p $(STAGING_DIR)/usr/lib
(cd $(STAGING_DIR)/usr/lib; ln -fs ../../lib/gcc-lib)
touch $(TOOL_BUILD_DIR)/.setup
@@ -142,7 +143,8 @@ $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked
$(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched
mkdir -p $(BINUTILS_DIR1)
- (cd $(BINUTILS_DIR1); CC=$(HOSTCC) $(BINUTILS_DIR)/configure \
+ (cd $(BINUTILS_DIR1); CC=$(HOSTCC) \
+ $(BINUTILS_DIR)/configure \
--target=$(GNU_TARGET_NAME) \
--prefix=$(STAGING_DIR) \
--exec-prefix=$(STAGING_DIR) \
@@ -167,6 +169,20 @@ $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ld: $(BINUTILS_DIR1)/binutils/objdump
$(MAKE) -C $(BINUTILS_DIR1) install
rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \
$(STAGING_DIR)/share/locale
+ mkdir -p $(STAGING_DIR)/usr/bin;
+ set -e; \
+ for app in addr2line ar as c++filt gprof ld nm objcopy \
+ objdump ranlib readelf size strings strip ; \
+ do \
+ if [ -x $(STAGING_DIR)/bin/$(ARCH)-uclibc-$${app} ] ; then \
+ (cd $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin; \
+ ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \
+ ); \
+ (cd $(STAGING_DIR)/usr/bin; \
+ ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \
+ ); \
+ fi; \
+ done;
$(STAGING_DIR)/lib/libg.a:
$(STAGING_DIR)/$(GNU_TARGET_NAME)/bin/ar rv $(STAGING_DIR)/lib/libg.a;
@@ -249,7 +265,8 @@ $(GCC_DIR)/.gcc_build_hacks: $(GCC_DIR)/.patched
$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.gcc_build_hacks
mkdir -p $(GCC_BUILD_DIR1)
(cd $(GCC_BUILD_DIR1); AR=$(ARCH)-uclibc-ar \
- RANLIB=$(ARCH)-uclibc-ranlib CC=$(HOSTCC) $(GCC_DIR)/configure \
+ RANLIB=$(ARCH)-uclibc-ranlib CC=$(HOSTCC) \
+ $(GCC_DIR)/configure \
--target=$(GNU_TARGET_NAME) \
--prefix=$(STAGING_DIR) \
--exec-prefix=$(STAGING_DIR) \
@@ -275,7 +292,7 @@ $(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
RANLIB_FOR_TARGET=$(STAGING_DIR)/bin/$(ARCH)-uclibc-ranlib
touch $(GCC_BUILD_DIR1)/.compiled
-$(GCC_BUILD_DIR1)/.installed: $(GCC_BUILD_DIR1)/.compiled
+$(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc: $(GCC_BUILD_DIR1)/.compiled
$(MAKE) -C $(GCC_BUILD_DIR1) install;
#Cleanup then mess when --program-prefix mysteriously fails
-mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-cpp $(STAGING_DIR)/bin/$(ARCH)-uclibc-cpp
@@ -283,9 +300,8 @@ $(GCC_BUILD_DIR1)/.installed: $(GCC_BUILD_DIR1)/.compiled
rm -f $(STAGING_DIR)/bin/gccbug $(STAGING_DIR)/bin/gcov
rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \
$(STAGING_DIR)/share/locale
- touch $(GCC_BUILD_DIR1)/.installed
-gcc_initial: binutils $(UCLIBC_DIR)/.configured $(GCC_BUILD_DIR1)/.installed
+gcc_initial: binutils $(UCLIBC_DIR)/.configured $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc
gcc_initial-clean:
rm -rf $(GCC_BUILD_DIR1)
@@ -308,10 +324,10 @@ $(DL_DIR)/$(UCLIBC_SOURCE):
$(WGET) -P $(DL_DIR) $(UCLIBC_SITE)/$(UCLIBC_SOURCE)
$(UCLIBC_DIR)/.unpacked: $(TOOL_BUILD_DIR)/.setup $(DL_DIR)/$(UCLIBC_SOURCE)
- bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
+ bzcat $(DL_DIR)/$(UCLIBC_SOURCE) | tar -C $(BUILD_DIR) -xvf -
touch $(UCLIBC_DIR)/.unpacked
-$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(TOOL_BUILD_DIR)/linux/.configured
+$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(BUILD_DIR)/linux/.configured
perl -i -p -e 's,^CROSS=.*,TARGET_ARCH=$(ARCH)\nCROSS=$(TARGET_CROSS),g' \
$(UCLIBC_DIR)/Rules.mak
cp $(SOURCE_DIR)/uClibc.config $(UCLIBC_DIR)/.config
@@ -349,11 +365,13 @@ $(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/lib/libc.a
$(TARGET_DIR)/usr/bin/ldd: $(TARGET_DIR)/lib/libc.so.0
$(MAKE) -C $(UCLIBC_DIR) PREFIX=$(TARGET_DIR) install_target_utils
+ (cd $(TARGET_DIR)/sbin; ln -s /bin/true ldconfig)
UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0 $(TARGET_DIR)/usr/bin/ldd
endif
-uclibc: gcc_initial $(STAGING_DIR)/lib/libc.a $(UCLIBC_TARGETS)
+uclibc: $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc $(STAGING_DIR)/lib/libc.a \
+ $(UCLIBC_TARGETS)
uclibc-clean:
-$(MAKE) -C $(UCLIBC_DIR) clean
@@ -368,6 +386,42 @@ uclibc-dirclean:
#############################################################
#
+# STLport -- an alternative C++ library
+#
+#############################################################
+STLPORT_PATCH=$(SOURCE_DIR)/STLport-4.5.3.patch
+$(DL_DIR)/$(STLPORT_SOURCE):
+ $(WGET) -P $(DL_DIR) $(STLPORT_SITE)/$(STLPORT_SOURCE)
+
+$(STLPORT_DIR)/Makefile: $(DL_DIR)/$(STLPORT_SOURCE) $(STLPORT_PATCH)
+ zcat $(DL_DIR)/$(STLPORT_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
+ cat $(STLPORT_PATCH) | patch -d $(STLPORT_DIR) -p1
+
+$(STLPORT_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/Makefile
+ $(MAKE) ARCH=$(ARCH) PREFIX=$(STAGING_DIR) -C $(STLPORT_DIR)
+
+$(STAGING_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/lib/libstdc++.a
+ $(MAKE) ARCH=$(ARCH) PREFIX=$(STAGING_DIR) -C $(STLPORT_DIR) install
+ifneq ($(HAS_MMU),true)
+ rm -f $(STAGING_DIR)/lib/libstdc++*.so*
+endif
+
+stlport: $(STAGING_DIR)/lib/libstdc++.a
+
+stlport-clean:
+ rm -f $(STAGING_DIR)/lib/libstdc++*
+ rm -f $(STAGING_DIR)/include/c++*
+ -$(MAKE) -C $(STLPORT_DIR) clean
+
+stlport-dirclean:
+ rm -f $(STAGING_DIR)/lib/libstdc++*
+ rm -f $(STAGING_DIR)/include/g++-v3*
+ rm -rf $(STLPORT_DIR)
+
+
+
+#############################################################
+#
# second pass compiler build. Build the compiler targeting
# the newly built shared uClibc library.
#
@@ -399,8 +453,9 @@ $(GCC_DIR)/.g++_build_hacks: $(GCC_DIR)/.patched
$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.g++_build_hacks
mkdir -p $(GCC_BUILD_DIR2)
(cd $(GCC_BUILD_DIR2); AR=$(TARGET_CROSS)ar \
- RANLIB=$(TARGET_CROSS)ranlib LD=$(TARGET_CROSS)ld NM=$(TARGET_CROSS)nm \
- CC=$(HOSTCC) $(GCC_DIR)/configure \
+ RANLIB=$(TARGET_CROSS)ranlib LD=$(TARGET_CROSS)ld \
+ NM=$(TARGET_CROSS)nm CC=$(HOSTCC) \
+ $(GCC_DIR)/configure \
--target=$(GNU_TARGET_NAME) \
--prefix=$(STAGING_DIR) \
--exec-prefix=$(STAGING_DIR) \
@@ -433,14 +488,13 @@ $(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured
touch $(GCC_BUILD_DIR2)/.compiled
$(GCC_BUILD_DIR2)/.installed: $(GCC_BUILD_DIR2)/.compiled
- $(MAKE) -C $(GCC_BUILD_DIR2) install;
touch $(GCC_BUILD_DIR2)/.installed
-#Cleanup then mess when --program-prefix mysteriously fails
-$(GCC_BUILD_DIR2)/.fixedup: $(GCC_BUILD_DIR2)/.installed
- -mv $(STAGING_DIR)/bin/gcc $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin;
- -mv $(STAGING_DIR)/bin/protoize $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin;
- -mv $(STAGING_DIR)/bin/unprotoize $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin;
+$(STAGING_DIR)/bin/$(ARCH)-uclibc-g++: $(GCC_BUILD_DIR2)/.compiled
+ $(MAKE) -C $(GCC_BUILD_DIR2) install;
+ -mv $(STAGING_DIR)/bin/gcc $(STAGING_DIR)/usr/bin;
+ -mv $(STAGING_DIR)/bin/protoize $(STAGING_DIR)/usr/bin;
+ -mv $(STAGING_DIR)/bin/unprotoize $(STAGING_DIR)/usr/bin;
-mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-cpp $(STAGING_DIR)/bin/$(ARCH)-uclibc-cpp
-mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-gcc $(STAGING_DIR)/bin/$(ARCH)-uclibc-gcc
-mv $(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-c++ $(STAGING_DIR)/bin/$(ARCH)-uclibc-c++
@@ -449,77 +503,20 @@ $(GCC_BUILD_DIR2)/.fixedup: $(GCC_BUILD_DIR2)/.installed
rm -f $(STAGING_DIR)/bin/cpp $(STAGING_DIR)/bin/gcov $(STAGING_DIR)/bin/*gccbug
rm -rf $(STAGING_DIR)/info $(STAGING_DIR)/man $(STAGING_DIR)/share/doc \
$(STAGING_DIR)/share/locale
- touch $(GCC_BUILD_DIR2)/.fixedup
-
-
-#############################################################
-#
-# STLport -- an alternative C++ library
-#
-#############################################################
-STLPORT_PATCH=$(SOURCE_DIR)/STLport-4.5.3.patch
-$(DL_DIR)/$(STLPORT_SOURCE):
- $(WGET) -P $(DL_DIR) $(STLPORT_SITE)/$(STLPORT_SOURCE)
-
-$(STLPORT_DIR)/Makefile: $(DL_DIR)/$(STLPORT_SOURCE) $(STLPORT_PATCH)
- zcat $(DL_DIR)/$(STLPORT_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf -
- cat $(STLPORT_PATCH) | patch -d $(STLPORT_DIR) -p1
-
-$(STLPORT_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/Makefile
- $(MAKE) ARCH=$(ARCH) PREFIX=$(STAGING_DIR) -C $(STLPORT_DIR)
-
-$(STAGING_DIR)/lib/libstdc++.a: $(STLPORT_DIR)/lib/libstdc++.a
- $(MAKE) ARCH=$(ARCH) PREFIX=$(STAGING_DIR) -C $(STLPORT_DIR) install
-ifneq ($(HAS_MMU),true)
- rm -f $(STAGING_DIR)/lib/libstdc++*.so*
-endif
-
-stlport: $(STAGING_DIR)/lib/libstdc++.a
-
-stlport-clean:
- rm -f $(STAGING_DIR)/lib/libstdc++*
- rm -f $(STAGING_DIR)/include/c++*
- -$(MAKE) -C $(STLPORT_DIR) clean
-
-stlport-dirclean:
- rm -f $(STAGING_DIR)/lib/libstdc++*
- rm -f $(STAGING_DIR)/include/g++-v3*
- rm -rf $(STLPORT_DIR)
-
-
-
-#############################################################
-#
-# Final cleanups....
-#
-#############################################################
-$(TOOL_BUILD_DIR)/.shuffled: $(GCC_BUILD_DIR2)/.fixedup
- mkdir -p $(STAGING_DIR)/usr/bin;
- (set -e; cd $(STAGING_DIR)/usr/bin; \
- for i in $(STAGING_DIR)/bin/* ; do \
- j=`basename $$i`; \
- k=`basename $$i| sed -e "s,$(ARCH)-uclibc-,,g"`; \
- ln -fs ../../bin/$$j $$k; \
- done)
- (set -e; cd $(STAGING_DIR)/$(GNU_TARGET_NAME)/bin; \
- for i in $(STAGING_DIR)/bin/* ; do \
- j=`basename $$i`; \
- k=`basename $$i| sed -e "s,$(ARCH)-uclibc-,,g"`; \
- ln -fs ../../bin/$$j $$k; \
- done)
- touch $(TOOL_BUILD_DIR)/.shuffled
-
-$(TOOL_BUILD_DIR)/.stripped: $(TOOL_BUILD_DIR)/.shuffled
# Strip the host binaries
-strip --strip-all -R .note -R .comment $(STAGING_DIR)/bin/*
# Strip the target shared libs
-$(STRIP) --strip-unneeded -R .note -R .comment $(STAGING_DIR)/lib/*.so*;
- touch $(TOOL_BUILD_DIR)/.stripped
-
-$(STAGING_DIR)/bin/$(TARGET_CC): $(GCC_BUILD_DIR2)/.fixedup $(TOOL_BUILD_DIR)/.stripped $(STLPORT_TARGET)
- cp --remove-destination -a $(STAGING_DIR) $(STAGING_DIR)
-
-gcc_final: uclibc $(STAGING_DIR)/bin/$(TARGET_CC)
+ set -e;
+ for app in cc gcc c89 cpp c++ g++ ; do \
+ if [ -x $(STAGING_DIR)/bin/$(ARCH)-uclibc-$${app} ] ; then \
+ (cd $(STAGING_DIR)/usr/bin; \
+ ln -fs ../../bin/$(ARCH)-uclibc-$${app} $${app}; \
+ ); \
+ fi; \
+ done;
+
+gcc_final: binutils gcc_initial uclibc $(STAGING_DIR)/bin/$(ARCH)-uclibc-g++ $(STLPORT_TARGET)
gcc_final-clean:
rm -rf $(GCC_BUILD_DIR2)