Changeset 2431f30 in mainline
- Timestamp:
- 2011-06-13T01:32:54Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c1198c2
- Parents:
- df56f5c
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
rdf56f5c r2431f30 100 100 distclean: clean 101 101 rm -f $(CSCOPE).out $(COMMON_MAKEFILE) $(COMMON_HEADER) $(COMMON_HEADER_PREV) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) tools/*.pyc tools/checkers/*.pyc release/HelenOS-* 102 cd ./uspace/app/binutils/; ./distclean.sh 102 103 103 104 clean: -
uspace/app/binutils/Makefile
rdf56f5c r2431f30 46 46 # because targets derived from it will be referenced from 47 47 # other than the current directory. 48 USPACE_PREFIX = $(subst $(space),\ ,$( PWD))/../..48 USPACE_PREFIX = $(subst $(space),\ ,$(shell pwd))/../.. 49 49 50 50 # Ensure static configuration of Makefile.common. … … 70 70 71 71 # Patch $PATH to intercept toolchain calls. 72 PATH := $(PWD):$(PATH) 72 PATH := $(shell pwd):$(PATH) 73 export PATH 73 74 74 75 # Shell script for false toolchain generation. … … 89 90 # Map the HelenOS target to binutils target. 90 91 ifeq ($(PLATFORM),amd64) 91 TARGET=amd64-linux-gnu 92 else ($(PLATFORM),arm32) 93 TARGET=arm-linux-gnu 94 else ($(PLATFORM),ia32) 95 TARGET=i686-pc-linux-gnu 96 else ($(PLATFORM),ia64) 97 TARGET=ia64-pc-linux-gnu 98 else ($(PLATFORM),mips32) 99 TARGET=mipsel-linux-gnu 100 else ($(PLATFORM),mips32eb) 101 TARGET=mips-linux-gnu 102 else ($(PLATFORM),mips64) 103 TARGET=mips64el-linux-gnu 104 else ($(PLATFORM),ppc32) 105 TARGET=ppc-linux-gnu 106 else ($(PLATFORM),ppc64) 107 TARGET=ppc64-linux-gnu 108 else ($(PLATFORM),sparc64) 109 TARGET=sparc64-linux-gnu 92 TARGET = amd64-linux-gnu 93 endif 94 ifeq ($(PLATFORM),arm32) 95 TARGET = arm-linux-gnu 96 endif 97 ifeq ($(PLATFORM),ia32) 98 TARGET = i686-pc-linux-gnu 99 endif 100 ifeq ($(PLATFORM),ia64) 101 TARGET = ia64-pc-linux-gnu 102 endif 103 ifeq ($(PLATFORM),mips32) 104 TARGET = mipsel-linux-gnu 105 endif 106 ifeq ($(PLATFORM),mips32eb) 107 TARGET = mips-linux-gnu 108 endif 109 ifeq ($(PLATFORM),mips64) 110 TARGET = mips64el-linux-gnu 111 endif 112 ifeq ($(PLATFORM),ppc32) 113 TARGET = ppc-linux-gnu 114 endif 115 ifeq ($(PLATFORM),ppc64) 116 TARGET = ppc64-linux-gnu 117 endif 118 ifeq ($(PLATFORM),sparc64) 119 TARGET = sparc64-linux-gnu 110 120 endif 111 121 112 122 # Binutils configure flags. 113 123 CONF_FLAGS = --disable-nls --disable-shared --enable-static \ 114 --with-zlib=no 124 --with-zlib=no --with-ppl=no --with-cloog=no \ 125 --with-gmp=no --with-mpfr=no --with-mpc=no 115 126 116 127 # Binutils make targets. … … 123 134 all: $(COMMON_MAKEFILE_PATCHED) all_ $(TOOLCHAIN) $(BINUTILS_PATCHED) \ 124 135 $(BINUTILS_CONFIGURED) $(REDIST_DETECT) 125 export PATH126 136 make -C $(REDIST_DIR) $(MAKE_TARGETS) 127 137 cp -f $(REDIST_DIR)/gas/as-new ./as … … 143 153 $(REDIST_DETECT): $(REDIST_FILENAME) 144 154 tar -x -j -f $< 145 mv -f $(REDIST_NAME) $(REDIST_DIR) 155 mv -f -T $(REDIST_NAME) $(REDIST_DIR) 156 touch $@ 146 157 147 158 # Generate false toolchain scripts. 148 159 $(TOOLCHAIN): $(TOOLCHAIN_SCRIPT) 149 $^gcc $(CC) '$(CFLAGS)'150 $^as $(AS)151 $^ar $(AR)152 $^ranlib153 $^ld $(LD) '$(LFLAGS)' '$(LINKER_SCRIPT)' '$(LIBS) $(BASE_LIBS)'154 $^objdump $(OBJDUMP)155 $^objcopy $(OBJCOPY)156 $^strip $(STRIP)160 ./$< gcc $(CC) '$(CFLAGS)' 161 ./$< as $(AS) 162 ./$< ar $(AR) 163 ./$< ranlib 164 ./$< ld $(LD) '$(LFLAGS)' '$(LINKER_SCRIPT)' '$(LIBS) $(BASE_LIBS)' 165 ./$< objdump $(OBJDUMP) 166 ./$< objcopy $(OBJCOPY) 167 ./$< strip $(STRIP) 157 168 158 169 # Patch binutils source tree. 159 170 $(BINUTILS_PATCHED): $(BINUTILS_PATCH) $(REDIST_DETECT) 160 $^do $(REDIST_DIR)171 ./$< do $(REDIST_DIR) 161 172 touch $@ 162 173 163 174 # Configure binutils. 175 # $LD variable have to exported to override configure script caching. 164 176 $(BINUTILS_CONFIGURED): $(REDIST_DIR)/configure $(REDIST_DETECT) 165 $^ --target=$(TARGET) $(CONF_FLAGS) 177 export LD=ld; \ 178 cd $(REDIST_DIR); \ 179 ./configure --target=$(TARGET) $(CONF_FLAGS) 166 180 167 181 # Delete binaries. … … 169 183 # Unpatch binutils. 170 184 # Delete generated scripts. 171 clean: $(BINUTILS_PATCH) 185 clean: $(BINUTILS_PATCH) clean_ 172 186 rm -f as ld 173 if [ -e $(REDIST_DIR)/Makefile ]; then 174 make -C $(REDIST_DIR) distclean 187 if [ -e $(REDIST_DIR)/Makefile ]; then \ 188 make -C $(REDIST_DIR) distclean; \ 175 189 fi 176 if [ -e $(BINUTILS_PATCHED) ]; then 177 ./intrusive.sh undo $(REDIST_DIR) 178 rm -f $(BINUTILS_PATCHED) 190 if [ -e $(BINUTILS_PATCHED) ]; then \ 191 ./intrusive.sh undo $(REDIST_DIR); \ 192 rm -f $(BINUTILS_PATCHED); \ 179 193 fi 180 194 rm -f $(TOOLCHAIN) -
uspace/app/binutils/intrusive.sh
rdf56f5c r2431f30 34 34 # would require too much complexity. 35 35 # 36 # List of patch descriptions: 37 # 38 # Patch 1 39 # Even though binutils build process supports cross compilation where 40 # build and host platforms are different, it is not easily applicable 41 # to HelenOS. It would be difficult to satisfy binutils expectations 42 # of host headers, libraries and tools on a build system (at least 43 # until these are developed/ported). Another issue would be the 44 # necessity to carry out time consuming full canadian cross compilation 45 # (even in case when build, host and target hardware platforms are the 46 # same). Instead of going into such trouble, it is easier to leverage 47 # already built HelenOS toolchain as a first stage of canadian cross 48 # and trick binutils scripts to do a simple cross compilation while 49 # actually doing second stage of canadian cross. Because binutils 50 # configure scripts try to compile and execute various testing code, it 51 # have to be ensured that these tests are skipped. Such behaviour can 52 # be acomplished by patching cross compilation flag while leaving host 53 # and build parameters empty (i.e. configure script believes it is 54 # not doing cross compilation while skipping some testing as in the case 55 # of cross compilation). 56 # 57 # Patch 2 58 # Enabled cross compilation flag brings along some anomalies which 59 # have to reverted. 60 # 61 # Patch 3 62 # Binutils plugin support is dependent on libdl.so library. 63 # By default, the plugin support is switched off for all 64 # configure scripts of binutils. The only exception is configure 65 # script of ld 2.21 (and possibly above), where plugin support 66 # became mandatory (although not really needed). 67 # 36 68 37 69 case "$1" in 38 70 "do") 39 # Binutils plugin support is dependent on libdl.so library. 40 # By default, the plugin support is switched off for all 41 # configure scripts of binutils. The only exception is configure 42 # script of ld 2.21 (and possibly above), where plugin support 43 # became mandatory (although not really needed). 44 mv -f "$2/ld/configure" "$2/ld/configure.backup" 45 sed 's/enable_plugins=yes/enable_plugins=no/g' \ 46 < "$2/ld/configure.backup" > "$2/ld/configure" 71 # Backup original files. 72 cp -f "$2/configure" "$2/configure.backup" 73 cp -f "$2/bfd/configure" "$2/bfd/configure.backup" 74 cp -f "$2/gas/configure" "$2/gas/configure.backup" 75 cp -f "$2/intl/configure" "$2/intl/configure.backup" 76 cp -f "$2/ld/configure" "$2/ld/configure.backup" 77 cp -f "$2/libiberty/configure" "$2/libiberty/configure.backup" 78 cp -f "$2/opcodes/configure" "$2/opcodes/configure.backup" 79 80 # Patch main binutils configure script. 81 cat "$2/configure.backup" | \ 82 # See Patch 1. 83 sed 's/^cross_compiling=no/cross_compiling=yes/g' \ 84 > "$2/configure" 85 86 # Patch bfd configure script. 87 cat "$2/bfd/configure.backup" | \ 88 # See Patch 1. 89 sed 's/^cross_compiling=no/cross_compiling=yes/g' \ 90 > "$2/bfd/configure" 91 92 # Patch gas configure script. 93 cat "$2/gas/configure.backup" | \ 94 # See Patch 1. 95 sed 's/^cross_compiling=no/cross_compiling=yes/g' \ 96 > "$2/gas/configure" 97 98 # Patch intl configure script. 99 cat "$2/intl/configure.backup" | \ 100 # See Patch 1. 101 sed 's/^cross_compiling=no/cross_compiling=yes/g' \ 102 > "$2/intl/configure" 103 104 # Patch ld configure script. 105 cat "$2/ld/configure.backup" | \ 106 # See Patch 1. 107 sed 's/^cross_compiling=no/cross_compiling=yes/g' | \ 108 # See Patch 3. 109 sed 's/^enable_plugins=yes/enable_plugins=no/g' \ 110 > "$2/ld/configure" 111 112 # Patch libiberty configure script. 113 cat "$2/libiberty/configure.backup" | \ 114 # See Patch 1. 115 sed 's/^cross_compiling=no/cross_compiling=yes/g' \ 116 > "$2/libiberty/configure" 117 118 # Patch opcodes configure script. 119 cat "$2/opcodes/configure.backup" | \ 120 # See Patch 1. 121 sed 's/^cross_compiling=no/cross_compiling=yes/g' | \ 122 # See Patch 2. 123 sed 's/BUILD_LIBS=-liberty/BUILD_LIBS=..\/libiberty\/libiberty.a/g' \ 124 > "$2/opcodes/configure" 125 47 126 ;; 48 127 "undo") 128 # Restore original files. 129 mv -f "$2/configure.backup" "$2/configure" 130 mv -f "$2/bfd/configure.backup" "$2/bfd/configure" 131 mv -f "$2/gas/configure.backup" "$2/gas/configure" 132 mv -f "$2/intl/configure.backup" "$2/intl/configure" 49 133 mv -f "$2/ld/configure.backup" "$2/ld/configure" 134 mv -f "$2/libiberty/configure.backup" "$2/libiberty/configure" 135 mv -f "$2/opcodes/configure.backup" "$2/opcodes/configure" 50 136 ;; 51 137 *) -
uspace/app/binutils/toolchain.sh
rdf56f5c r2431f30 75 75 sed 's/-W[^ ]*//g' | \ 76 76 sed 's/-pipe//g' | \ 77 sed 's/-std=[^ ]*//g' | \78 77 sed 's/-g//g' | \ 79 78 sed 's/ [ ]*/ /g'`" 79 echo ' echo' \'"$2"\' \'"$CFLAGS"\' '"$@"' 80 80 echo " $2" "$CFLAGS" '$@' 81 81 echo 'fi' … … 86 86 ( 87 87 echo '#! /bin/bash' 88 echo 'echo' \'"$2"\' '"$@"' 88 89 echo "$2" '$@' 89 90 ) > 'as' … … 93 94 ( 94 95 echo '#! /bin/bash' 96 echo 'echo' \'"$2"\' '"$@"' 95 97 echo "$2" '$@' 96 98 ) > 'ar' … … 100 102 ( 101 103 echo '#! /bin/bash' 104 echo 'echo' \'"$2"\' '"$@"' 102 105 echo "ar -s" '$@' 103 106 ) > 'ranlib' … … 107 110 ( 108 111 echo '#! /bin/bash' 112 echo 'echo' \'"$2 -n $3 -T $4"\' '"$@"' \'"$5"\' 109 113 echo "$2 -n $3 -T $4" '$@' "$5" 110 114 ) > 'ld' … … 114 118 ( 115 119 echo '#! /bin/bash' 120 echo 'echo' \'"$2"\' '"$@"' 116 121 echo "$2" '$@' 117 122 ) > 'objdump' … … 121 126 ( 122 127 echo '#! /bin/bash' 128 echo 'echo' \'"$2"\' '"$@"' 123 129 echo "$2" '$@' 124 130 ) > 'objcopy' … … 128 134 ( 129 135 echo '#! /bin/bash' 136 echo 'echo' \'"$2"\' '"$@"' 130 137 echo "$2" '$@' 131 138 ) > 'strip'
Note:
See TracChangeset
for help on using the changeset viewer.