common/makefiles/devkit/Tools.gmk

changeset 839
174a54ce39c4
parent 740
c0fa87863427
     1.1 --- a/common/makefiles/devkit/Tools.gmk	Wed Oct 09 18:51:32 2013 -0700
     1.2 +++ b/common/makefiles/devkit/Tools.gmk	Thu Oct 10 14:58:19 2013 +0200
     1.3 @@ -26,15 +26,15 @@
     1.4  ##########################################################################################
     1.5  #
     1.6  # Workhorse makefile for creating ONE cross compiler
     1.7 -# Needs either to be from BUILD -> BUILD OR have 
     1.8 +# Needs either to be from BUILD -> BUILD OR have
     1.9  # BUILD -> HOST prebuilt
    1.10  #
    1.11 -# NOTE: There is a bug here. We don't limit the 
    1.12 -# PATH when building BUILD -> BUILD, which means that 
    1.13 +# NOTE: There is a bug here. We don't limit the
    1.14 +# PATH when building BUILD -> BUILD, which means that
    1.15  # if you configure after you've once build the BUILD->BUILD
    1.16  # compiler THAT one will be picked up as the compiler for itself.
    1.17  # This is not so great, especially if you did a partial delete
    1.18 -# of the target tree. 
    1.19 +# of the target tree.
    1.20  #
    1.21  # Fix this...
    1.22  #
    1.23 @@ -43,45 +43,45 @@
    1.24  $(info HOST=$(HOST))
    1.25  $(info BUILD=$(BUILD))
    1.26  
    1.27 -ARCH		:= $(word 1,$(subst -, ,$(TARGET)))
    1.28 +ARCH := $(word 1,$(subst -, ,$(TARGET)))
    1.29  
    1.30  ##########################################################################################
    1.31  # Define external dependencies
    1.32  
    1.33  # Latest that could be made to work.
    1.34 -gcc_ver		:= gcc-4.7.3
    1.35 -binutils_ver	:= binutils-2.22
    1.36 -ccache_ver	:= ccache-3.1.9
    1.37 -mpfr_ver        := mpfr-3.0.1
    1.38 -gmp_ver         := gmp-4.3.2
    1.39 -mpc_ver		:= mpc-1.0.1
    1.40 +gcc_ver := gcc-4.7.3
    1.41 +binutils_ver := binutils-2.22
    1.42 +ccache_ver := ccache-3.1.9
    1.43 +mpfr_ver := mpfr-3.0.1
    1.44 +gmp_ver := gmp-4.3.2
    1.45 +mpc_ver := mpc-1.0.1
    1.46  
    1.47 -GCC		:= http://ftp.gnu.org/pub/gnu/gcc/$(gcc_ver)/$(gcc_ver).tar.bz2
    1.48 -BINUTILS	:= http://ftp.gnu.org/pub/gnu/binutils/$(binutils_ver).tar.bz2
    1.49 -CCACHE		:= http://samba.org/ftp/ccache/$(ccache_ver).tar.gz
    1.50 -MPFR		:= http://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2
    1.51 -GMP 		:= http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2
    1.52 -MPC		:= http://www.multiprecision.org/mpc/download/${mpc_ver}.tar.gz
    1.53 +GCC := http://ftp.gnu.org/pub/gnu/gcc/$(gcc_ver)/$(gcc_ver).tar.bz2
    1.54 +BINUTILS := http://ftp.gnu.org/pub/gnu/binutils/$(binutils_ver).tar.bz2
    1.55 +CCACHE := http://samba.org/ftp/ccache/$(ccache_ver).tar.gz
    1.56 +MPFR := http://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2
    1.57 +GMP := http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2
    1.58 +MPC := http://www.multiprecision.org/mpc/download/${mpc_ver}.tar.gz
    1.59  
    1.60  # RPMs in OEL5.5
    1.61 -RPM_LIST 	:= \
    1.62 -		kernel-headers \
    1.63 -		glibc-2 glibc-headers glibc-devel \
    1.64 -		cups-libs cups-devel \
    1.65 -		libX11 libX11-devel \
    1.66 -		xorg-x11-proto-devel \
    1.67 -		alsa-lib alsa-lib-devel \
    1.68 -		libXext libXext-devel \
    1.69 -		libXtst libXtst-devel \
    1.70 -		libXrender libXrender-devel \
    1.71 -		freetype freetype-devel \
    1.72 -		libXt libXt-devel \
    1.73 -		libSM libSM-devel \
    1.74 -		libICE libICE-devel \
    1.75 -		libXi libXi-devel \
    1.76 -		libXdmcp libXdmcp-devel \
    1.77 -		libXau libXau-devel \
    1.78 -		libgcc
    1.79 +RPM_LIST := \
    1.80 +    kernel-headers \
    1.81 +    glibc-2 glibc-headers glibc-devel \
    1.82 +    cups-libs cups-devel \
    1.83 +    libX11 libX11-devel \
    1.84 +    xorg-x11-proto-devel \
    1.85 +    alsa-lib alsa-lib-devel \
    1.86 +    libXext libXext-devel \
    1.87 +    libXtst libXtst-devel \
    1.88 +    libXrender libXrender-devel \
    1.89 +    freetype freetype-devel \
    1.90 +    libXt libXt-devel \
    1.91 +    libSM libSM-devel \
    1.92 +    libICE libICE-devel \
    1.93 +    libXi libXi-devel \
    1.94 +    libXdmcp libXdmcp-devel \
    1.95 +    libXau libXau-devel \
    1.96 +    libgcc
    1.97  
    1.98  
    1.99  ifeq ($(ARCH),x86_64)
   1.100 @@ -90,7 +90,7 @@
   1.101    ifeq ($(BUILD),$(HOST))
   1.102      ifeq ($(TARGET),$(HOST))
   1.103        # When building the native compiler for x86_64, enable mixed mode.
   1.104 -      RPM_ARCHS	+= i386 i686
   1.105 +      RPM_ARCHS += i386 i686
   1.106      endif
   1.107    endif
   1.108  else
   1.109 @@ -110,47 +110,47 @@
   1.110  
   1.111  # Ensure we have 32-bit libs also for x64. We enable mixed-mode.
   1.112  ifeq (x86_64,$(ARCH))
   1.113 -  LIBDIRS	:= lib64 lib
   1.114 -  CFLAGS_lib	:= -m32
   1.115 +  LIBDIRS := lib64 lib
   1.116 +  CFLAGS_lib := -m32
   1.117  else
   1.118 -  LIBDIRS 	:= lib
   1.119 +  LIBDIRS := lib
   1.120  endif
   1.121  
   1.122  # Define directories
   1.123 -RESULT		:= $(OUTPUT_ROOT)/result
   1.124 -BUILDDIR	:= $(OUTPUT_ROOT)/$(HOST)/$(TARGET)
   1.125 -PREFIX		:= $(RESULT)/$(HOST)
   1.126 -TARGETDIR	:= $(PREFIX)/$(TARGET)
   1.127 -SYSROOT		:= $(TARGETDIR)/sys-root
   1.128 -DOWNLOAD	:= $(OUTPUT_ROOT)/download
   1.129 -SRCDIR		:= $(OUTPUT_ROOT)/src
   1.130 +RESULT := $(OUTPUT_ROOT)/result
   1.131 +BUILDDIR := $(OUTPUT_ROOT)/$(HOST)/$(TARGET)
   1.132 +PREFIX := $(RESULT)/$(HOST)
   1.133 +TARGETDIR := $(PREFIX)/$(TARGET)
   1.134 +SYSROOT := $(TARGETDIR)/sys-root
   1.135 +DOWNLOAD := $(OUTPUT_ROOT)/download
   1.136 +SRCDIR := $(OUTPUT_ROOT)/src
   1.137  
   1.138  # Marker file for unpacking rpms
   1.139 -rpms		:= $(SYSROOT)/rpms_unpacked
   1.140 +rpms := $(SYSROOT)/rpms_unpacked
   1.141  
   1.142 -# Need to patch libs that are linker scripts to use non-absolute paths 
   1.143 -libs		:= $(SYSROOT)/libs_patched
   1.144 +# Need to patch libs that are linker scripts to use non-absolute paths
   1.145 +libs := $(SYSROOT)/libs_patched
   1.146  
   1.147  ##########################################################################################
   1.148  # Unpack source packages
   1.149  
   1.150 -# Generate downloading + unpacking of sources. 
   1.151 +# Generate downloading + unpacking of sources.
   1.152  define Download
   1.153 -$(1)_DIR	= $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1))))))
   1.154 -$(1)_CFG	= $$($(1)_DIR)/configure
   1.155 -$(1)_FILE	= $(DOWNLOAD)/$(notdir $($(1)))
   1.156 +  $(1)_DIR = $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1))))))
   1.157 +  $(1)_CFG = $$($(1)_DIR)/configure
   1.158 +  $(1)_FILE = $(DOWNLOAD)/$(notdir $($(1)))
   1.159  
   1.160 -$$($(1)_CFG)	: $$($(1)_FILE)
   1.161 -		mkdir -p $$(SRCDIR)
   1.162 -		tar -C $$(SRCDIR) -x$$(if $$(findstring .gz, $$<),z,j)f $$<
   1.163 -		$$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)),	\
   1.164 -			echo PATCHING $$(p) ;						\
   1.165 -			patch -d $$($(1)_DIR) -p1 -i $$(p) ; 				\
   1.166 -			)
   1.167 -		touch $$@
   1.168 +  $$($(1)_CFG) : $$($(1)_FILE)
   1.169 +	mkdir -p $$(SRCDIR)
   1.170 +	tar -C $$(SRCDIR) -x$$(if $$(findstring .gz, $$<),z,j)f $$<
   1.171 +	$$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)), \
   1.172 +	  echo PATCHING $$(p) ; \
   1.173 +	  patch -d $$($(1)_DIR) -p1 -i $$(p) ; \
   1.174 +	)
   1.175 +	touch $$@
   1.176  
   1.177 -$$($(1)_FILE)	:
   1.178 -		wget -P $(DOWNLOAD) $$($(1))
   1.179 +  $$($(1)_FILE) :
   1.180 +	wget -P $(DOWNLOAD) $$($(1))
   1.181  endef
   1.182  
   1.183  # Download and unpack all source packages
   1.184 @@ -159,48 +159,48 @@
   1.185  ##########################################################################################
   1.186  # Unpack RPMS
   1.187  
   1.188 -# Note. For building linux you should install rpm2cpio. 
   1.189 +# Note. For building linux you should install rpm2cpio.
   1.190  define unrpm
   1.191 -$(SYSROOT)/$(notdir $(1)).unpacked	\
   1.192 -		: $(1)
   1.193 -$$(rpms)	: $(SYSROOT)/$(notdir $(1)).unpacked
   1.194 +  $(SYSROOT)/$(notdir $(1)).unpacked \
   1.195 +    : $(1)
   1.196 +  $$(rpms) : $(SYSROOT)/$(notdir $(1)).unpacked
   1.197  endef
   1.198  
   1.199 -%.unpacked	:
   1.200 -		$(info Unpacking target rpms and libraries from $<)
   1.201 -		@(mkdir -p $(@D);					\
   1.202 -		cd $(@D);						\
   1.203 -		rpm2cpio $< | 						\
   1.204 -			cpio --extract --make-directories 		\
   1.205 -				-f 					\
   1.206 -				"./usr/share/doc/*" 			\
   1.207 -				"./usr/share/man/*"			\
   1.208 -				"./usr/X11R6/man/*" 			\
   1.209 -				"*/X11/locale/*"			\
   1.210 -				|| die ; )
   1.211 -		touch $@
   1.212 +%.unpacked :
   1.213 +	$(info Unpacking target rpms and libraries from $<)
   1.214 +	@(mkdir -p $(@D); \
   1.215 +	cd $(@D); \
   1.216 +	rpm2cpio $< | \
   1.217 +	    cpio --extract --make-directories \
   1.218 +	        -f \
   1.219 +	        "./usr/share/doc/*" \
   1.220 +	        "./usr/share/man/*" \
   1.221 +	        "./usr/X11R6/man/*" \
   1.222 +	        "*/X11/locale/*" \
   1.223 +	    || die ; )
   1.224 +	touch $@
   1.225  
   1.226  $(foreach p,$(RPM_FILE_LIST),$(eval $(call unrpm,$(p))))
   1.227  
   1.228  ##########################################################################################
   1.229  
   1.230 -# Note: MUST create a <sys-root>/usr/lib even if not really needed. 
   1.231 -# gcc will use a path relative to it to resolve lib64. (x86_64). 
   1.232 -# we're creating multi-lib compiler with 32bit libc as well, so we should 
   1.233 +# Note: MUST create a <sys-root>/usr/lib even if not really needed.
   1.234 +# gcc will use a path relative to it to resolve lib64. (x86_64).
   1.235 +# we're creating multi-lib compiler with 32bit libc as well, so we should
   1.236  # have it anyway, but just to make sure...
   1.237  # Patch libc.so and libpthread.so to force linking against libraries in sysroot
   1.238  # and not the ones installed on the build machine.
   1.239 -$(libs)		: $(rpms)
   1.240 -		@echo Patching libc and pthreads
   1.241 -		@(for f in `find $(SYSROOT) -name libc.so -o -name libpthread.so`; do \
   1.242 -			(cat $$f | sed -e 's|/usr/lib64/||g' 		\
   1.243 -				       -e 's|/usr/lib/||g'		\
   1.244 -				       -e 's|/lib64/||g'		\
   1.245 -				       -e 's|/lib/||g' ) > $$f.tmp ;	\
   1.246 -			mv $$f.tmp $$f				;	\
   1.247 -		done)
   1.248 -		@mkdir -p $(SYSROOT)/usr/lib
   1.249 -		@touch $@
   1.250 +$(libs) : $(rpms)
   1.251 +	@echo Patching libc and pthreads
   1.252 +	@(for f in `find $(SYSROOT) -name libc.so -o -name libpthread.so`; do \
   1.253 +	  (cat $$f | sed -e 's|/usr/lib64/||g' \
   1.254 +	      -e 's|/usr/lib/||g' \
   1.255 +	      -e 's|/lib64/||g' \
   1.256 +	      -e 's|/lib/||g' ) > $$f.tmp ; \
   1.257 +	  mv $$f.tmp $$f ; \
   1.258 +	done)
   1.259 +	@mkdir -p $(SYSROOT)/usr/lib
   1.260 +	@touch $@
   1.261  
   1.262  ##########################################################################################
   1.263  
   1.264 @@ -210,264 +210,264 @@
   1.265  ##########################################################################################
   1.266  
   1.267  # Default base config
   1.268 -CONFIG		= --target=$(TARGET) 					\
   1.269 -			--host=$(HOST) --build=$(BUILD)			\
   1.270 -			--prefix=$(PREFIX)
   1.271 +CONFIG = --target=$(TARGET) \
   1.272 +    --host=$(HOST) --build=$(BUILD) \
   1.273 +    --prefix=$(PREFIX)
   1.274  
   1.275 -PATHEXT 	= $(RESULT)/$(BUILD)/bin:
   1.276 +PATHEXT = $(RESULT)/$(BUILD)/bin:
   1.277  
   1.278 -PATHPRE		= PATH=$(PATHEXT)$(PATH)
   1.279 -BUILDPAR	= -j16
   1.280 +PATHPRE = PATH=$(PATHEXT)$(PATH)
   1.281 +BUILDPAR = -j16
   1.282  
   1.283  # Default commands to when making
   1.284 -MAKECMD		=
   1.285 -INSTALLCMD	= install
   1.286 +MAKECMD =
   1.287 +INSTALLCMD = install
   1.288  
   1.289  
   1.290 -declare_tools   = CC$(1)=$(2)gcc LD$(1)=$(2)ld AR$(1)=$(2)ar AS$(1)=$(2)as RANLIB$(1)=$(2)ranlib CXX$(1)=$(2)g++ OBJDUMP$(1)=$(2)objdump
   1.291 +declare_tools = CC$(1)=$(2)gcc LD$(1)=$(2)ld AR$(1)=$(2)ar AS$(1)=$(2)as RANLIB$(1)=$(2)ranlib CXX$(1)=$(2)g++ OBJDUMP$(1)=$(2)objdump
   1.292  
   1.293  ifeq ($(HOST),$(BUILD))
   1.294 -ifeq ($(HOST),$(TARGET))
   1.295 -TOOLS		= $(call declare_tools,_FOR_TARGET,)
   1.296 -endif
   1.297 +  ifeq ($(HOST),$(TARGET))
   1.298 +    TOOLS = $(call declare_tools,_FOR_TARGET,)
   1.299 +  endif
   1.300  endif
   1.301  
   1.302 -TOOLS		?=  $(call declare_tools,_FOR_TARGET,$(TARGET)-)
   1.303 +TOOLS ?= $(call declare_tools,_FOR_TARGET,$(TARGET)-)
   1.304  
   1.305  ##########################################################################################
   1.306  
   1.307 -# Create a TARGET bfd + libiberty only. 
   1.308 +# Create a TARGET bfd + libiberty only.
   1.309  # Configure one or two times depending on mulitlib arch.
   1.310 -# If multilib, the second should be 32-bit, and we resolve 
   1.311 +# If multilib, the second should be 32-bit, and we resolve
   1.312  # CFLAG_<name> to most likely -m32.
   1.313  define mk_bfd
   1.314 -$$(info Libs for $(1)) 
   1.315 -$$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \
   1.316 -		: CFLAGS += $$(CFLAGS_$(1))
   1.317 -$$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \
   1.318 -		: LIBDIRS = --libdir=$(TARGETDIR)/$(1)
   1.319 +  $$(info Libs for $(1))
   1.320 +  $$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \
   1.321 +      : CFLAGS += $$(CFLAGS_$(1))
   1.322 +  $$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \
   1.323 +      : LIBDIRS = --libdir=$(TARGETDIR)/$(1)
   1.324  
   1.325 -bfdlib		+= $$(TARGETDIR)/$$(binutils_ver)-$(subst /,-,$(1)).done
   1.326 -bfdmakes	+= $$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile
   1.327 +  bfdlib += $$(TARGETDIR)/$$(binutils_ver)-$(subst /,-,$(1)).done
   1.328 +  bfdmakes += $$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile
   1.329  endef
   1.330  
   1.331  # Create one set of bfds etc for each multilib arch
   1.332  $(foreach l,$(LIBDIRS),$(eval $(call mk_bfd,$(l))))
   1.333  
   1.334  # Only build these two libs.
   1.335 -$(bfdlib)	: MAKECMD 	= all-libiberty all-bfd
   1.336 -$(bfdlib)	: INSTALLCMD 	= install-libiberty install-bfd
   1.337 +$(bfdlib) : MAKECMD = all-libiberty all-bfd
   1.338 +$(bfdlib) : INSTALLCMD = install-libiberty install-bfd
   1.339  
   1.340 -# Building targets libbfd + libiberty. HOST==TARGET, i.e not 
   1.341 -# for a cross env. 
   1.342 -$(bfdmakes)	: CONFIG = --target=$(TARGET) 				\
   1.343 -			--host=$(TARGET) --build=$(BUILD)		\
   1.344 -			--prefix=$(TARGETDIR) 				\
   1.345 -			--with-sysroot=$(SYSROOT) 			\
   1.346 -			$(LIBDIRS)
   1.347 +# Building targets libbfd + libiberty. HOST==TARGET, i.e not
   1.348 +# for a cross env.
   1.349 +$(bfdmakes) : CONFIG = --target=$(TARGET) \
   1.350 +    --host=$(TARGET) --build=$(BUILD) \
   1.351 +    --prefix=$(TARGETDIR) \
   1.352 +    --with-sysroot=$(SYSROOT) \
   1.353 +    $(LIBDIRS)
   1.354  
   1.355 -$(bfdmakes)	: TOOLS = $(call declare_tools,_FOR_TARGET,$(TARGET)-) $(call declare_tools,,$(TARGET)-)
   1.356 +$(bfdmakes) : TOOLS = $(call declare_tools,_FOR_TARGET,$(TARGET)-) $(call declare_tools,,$(TARGET)-)
   1.357  
   1.358  ##########################################################################################
   1.359  
   1.360 -$(gcc)		\
   1.361 -$(binutils)	\
   1.362 -$(gmp)		\
   1.363 -$(mpfr)		\
   1.364 -$(mpc)		\
   1.365 -$(bfdmakes)	\
   1.366 -$(ccache)	: ENVS += $(TOOLS)
   1.367 +$(gcc) \
   1.368 +    $(binutils) \
   1.369 +    $(gmp) \
   1.370 +    $(mpfr) \
   1.371 +    $(mpc) \
   1.372 +    $(bfdmakes) \
   1.373 +    $(ccache) : ENVS += $(TOOLS)
   1.374  
   1.375  # libdir to work around hateful bfd stuff installing into wrong dirs...
   1.376 -# ensure we have 64 bit bfd support in the HOST library. I.e our 
   1.377 +# ensure we have 64 bit bfd support in the HOST library. I.e our
   1.378  # compiler on i686 will know 64 bit symbols, BUT later
   1.379 -# we build just the libs again for TARGET, then with whatever the arch 
   1.380 +# we build just the libs again for TARGET, then with whatever the arch
   1.381  # wants.
   1.382  $(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS))
   1.383  
   1.384  # Makefile creation. Simply run configure in build dir.
   1.385 -$(bfdmakes)				\
   1.386 -$(BUILDDIR)/$(binutils_ver)/Makefile	\
   1.387 -		: $(BINUTILS_CFG)
   1.388 -		$(info Configuring $@. Log in $(@D)/log.config)
   1.389 -		@mkdir -p $(@D)
   1.390 -		(						\
   1.391 -			cd $(@D) ;				\
   1.392 -			$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)"	\
   1.393 -				$(BINUTILS_CFG) 		\
   1.394 -				$(CONFIG) 			\
   1.395 -				--with-sysroot=$(SYSROOT)	\
   1.396 -				--disable-nls			\
   1.397 -				--program-prefix=$(TARGET)-	\
   1.398 -				--enable-multilib		\
   1.399 -		) > $(@D)/log.config 2>&1
   1.400 -		@echo 'done'
   1.401 +$(bfdmakes) \
   1.402 +$(BUILDDIR)/$(binutils_ver)/Makefile \
   1.403 +    : $(BINUTILS_CFG)
   1.404 +	$(info Configuring $@. Log in $(@D)/log.config)
   1.405 +	@mkdir -p $(@D)
   1.406 +	( \
   1.407 +	  cd $(@D) ; \
   1.408 +	  $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
   1.409 +	      $(BINUTILS_CFG) \
   1.410 +	      $(CONFIG) \
   1.411 +	      --with-sysroot=$(SYSROOT) \
   1.412 +	      --disable-nls \
   1.413 +	      --program-prefix=$(TARGET)- \
   1.414 +	      --enable-multilib \
   1.415 +	) > $(@D)/log.config 2>&1
   1.416 +	@echo 'done'
   1.417  
   1.418 -$(BUILDDIR)/$(mpfr_ver)/Makefile	\
   1.419 -		: $(MPFR_CFG)
   1.420 -		$(info Configuring $@. Log in $(@D)/log.config)
   1.421 -		@mkdir -p $(@D)
   1.422 -		(						\
   1.423 -			cd $(@D) ;				\
   1.424 -			$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)"	\
   1.425 -				$(MPFR_CFG) 			\
   1.426 -				$(CONFIG) 			\
   1.427 -				--program-prefix=$(TARGET)-	\
   1.428 -				--enable-shared=no		\
   1.429 -				--with-gmp=$(PREFIX)	\
   1.430 -		) > $(@D)/log.config 2>&1
   1.431 -		@echo 'done'
   1.432 +$(BUILDDIR)/$(mpfr_ver)/Makefile \
   1.433 +    : $(MPFR_CFG)
   1.434 +	$(info Configuring $@. Log in $(@D)/log.config)
   1.435 +	@mkdir -p $(@D)
   1.436 +	( \
   1.437 +	  cd $(@D) ; \
   1.438 +	  $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
   1.439 +	      $(MPFR_CFG) \
   1.440 +	      $(CONFIG) \
   1.441 +	      --program-prefix=$(TARGET)- \
   1.442 +	      --enable-shared=no \
   1.443 +	      --with-gmp=$(PREFIX) \
   1.444 +	) > $(@D)/log.config 2>&1
   1.445 +	@echo 'done'
   1.446  
   1.447 -$(BUILDDIR)/$(gmp_ver)/Makefile	\
   1.448 -		: $(GMP_CFG)
   1.449 -		$(info Configuring $@. Log in $(@D)/log.config)
   1.450 -		@mkdir -p $(@D)
   1.451 -		(						\
   1.452 -			cd $(@D) ;				\
   1.453 -			$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)"	\
   1.454 -				$(GMP_CFG) 			\
   1.455 -				--host=$(HOST) --build=$(BUILD)	\
   1.456 -				--prefix=$(PREFIX)		\
   1.457 -				--disable-nls			\
   1.458 -				--program-prefix=$(TARGET)-	\
   1.459 -				--enable-shared=no		\
   1.460 -				--with-mpfr=$(PREFIX)	\
   1.461 -		) > $(@D)/log.config 2>&1
   1.462 -		@echo 'done'
   1.463 +$(BUILDDIR)/$(gmp_ver)/Makefile \
   1.464 +    : $(GMP_CFG)
   1.465 +	$(info Configuring $@. Log in $(@D)/log.config)
   1.466 +	@mkdir -p $(@D)
   1.467 +	( \
   1.468 +	  cd $(@D) ; \
   1.469 +	  $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
   1.470 +	      $(GMP_CFG) \
   1.471 +	      --host=$(HOST) --build=$(BUILD) \
   1.472 +	      --prefix=$(PREFIX) \
   1.473 +	      --disable-nls \
   1.474 +	      --program-prefix=$(TARGET)- \
   1.475 +	      --enable-shared=no \
   1.476 +	      --with-mpfr=$(PREFIX) \
   1.477 +	) > $(@D)/log.config 2>&1
   1.478 +	@echo 'done'
   1.479  
   1.480 -$(BUILDDIR)/$(mpc_ver)/Makefile	\
   1.481 -		: $(MPC_CFG)
   1.482 -		$(info Configuring $@. Log in $(@D)/log.config)
   1.483 -		@mkdir -p $(@D)
   1.484 -		(						\
   1.485 -			cd $(@D) ;				\
   1.486 -			$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)"	\
   1.487 -				$(MPC_CFG) 			\
   1.488 -				$(CONFIG) 			\
   1.489 -				--program-prefix=$(TARGET)-	\
   1.490 -				--enable-shared=no		\
   1.491 -				--with-mpfr=$(PREFIX)	\
   1.492 -				--with-gmp=$(PREFIX)	\
   1.493 -		) > $(@D)/log.config 2>&1
   1.494 -		@echo 'done'
   1.495 +$(BUILDDIR)/$(mpc_ver)/Makefile \
   1.496 +    : $(MPC_CFG)
   1.497 +	$(info Configuring $@. Log in $(@D)/log.config)
   1.498 +	@mkdir -p $(@D)
   1.499 +	( \
   1.500 +	  cd $(@D) ; \
   1.501 +	  $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
   1.502 +	      $(MPC_CFG) \
   1.503 +	      $(CONFIG) \
   1.504 +	      --program-prefix=$(TARGET)- \
   1.505 +	      --enable-shared=no \
   1.506 +	      --with-mpfr=$(PREFIX) \
   1.507 +	      --with-gmp=$(PREFIX) \
   1.508 +	) > $(@D)/log.config 2>&1
   1.509 +	@echo 'done'
   1.510  
   1.511  # Only valid if glibc target -> linux
   1.512  # proper destructor handling for c++
   1.513  ifneq (,$(findstring linux,$(TARGET)))
   1.514 -$(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG += --enable-__cxa_atexit 
   1.515 +  $(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG += --enable-__cxa_atexit
   1.516  endif
   1.517  
   1.518  # Want:
   1.519 -# 	c,c++
   1.520 -# 	shared libs
   1.521 -#	multilib (-m32/-m64 on x64)
   1.522 -# 	skip native language. 
   1.523 -#	and link and assemble with the binutils we created 
   1.524 -#	earlier, so --with-gnu*
   1.525 -$(BUILDDIR)/$(gcc_ver)/Makefile	\
   1.526 -		: $(GCC_CFG) 
   1.527 -		$(info Configuring $@. Log in $(@D)/log.config)
   1.528 -		mkdir -p $(@D)
   1.529 -		(						\
   1.530 -			cd $(@D) ;				\
   1.531 -			$(PATHPRE) $(ENVS) $(GCC_CFG) $(EXTRA_CFLAGS) \
   1.532 -				$(CONFIG) 			\
   1.533 -				--with-sysroot=$(SYSROOT)	\
   1.534 -				--enable-languages=c,c++ 	\
   1.535 -				--enable-shared			\
   1.536 -				--enable-multilib		\
   1.537 -				--disable-nls			\
   1.538 -				--with-gnu-as 			\
   1.539 -				--with-gnu-ld			\
   1.540 -				--with-mpfr=$(PREFIX)		\
   1.541 -				--with-gmp=$(PREFIX)		\
   1.542 -				--with-mpc=$(PREFIX)		\
   1.543 -		) > $(@D)/log.config 2>&1
   1.544 -		@echo 'done'
   1.545 +# c,c++
   1.546 +# shared libs
   1.547 +# multilib (-m32/-m64 on x64)
   1.548 +# skip native language.
   1.549 +# and link and assemble with the binutils we created
   1.550 +# earlier, so --with-gnu*
   1.551 +$(BUILDDIR)/$(gcc_ver)/Makefile \
   1.552 +    : $(GCC_CFG)
   1.553 +	$(info Configuring $@. Log in $(@D)/log.config)
   1.554 +	mkdir -p $(@D)
   1.555 +	( \
   1.556 +	  cd $(@D) ; \
   1.557 +	  $(PATHPRE) $(ENVS) $(GCC_CFG) $(EXTRA_CFLAGS) \
   1.558 +	      $(CONFIG) \
   1.559 +	      --with-sysroot=$(SYSROOT) \
   1.560 +	      --enable-languages=c,c++ \
   1.561 +	      --enable-shared \
   1.562 +	      --enable-multilib \
   1.563 +	      --disable-nls \
   1.564 +	      --with-gnu-as \
   1.565 +	      --with-gnu-ld \
   1.566 +	      --with-mpfr=$(PREFIX) \
   1.567 +	      --with-gmp=$(PREFIX) \
   1.568 +	      --with-mpc=$(PREFIX) \
   1.569 +	) > $(@D)/log.config 2>&1
   1.570 +	@echo 'done'
   1.571  
   1.572  # need binutils for gcc
   1.573 -$(gcc)		: $(binutils) 
   1.574 +$(gcc) : $(binutils)
   1.575  
   1.576  # as of 4.3 or so need these for doing config
   1.577  $(BUILDDIR)/$(gcc_ver)/Makefile : $(gmp) $(mpfr) $(mpc)
   1.578 -$(mpfr)		: $(gmp)
   1.579 -$(mpc)		: $(gmp) $(mpfr)
   1.580 +$(mpfr) : $(gmp)
   1.581 +$(mpc) : $(gmp) $(mpfr)
   1.582  
   1.583  ##########################################################################################
   1.584 -# very straightforward. just build a ccache. it is only for host. 
   1.585 -$(BUILDDIR)/$(ccache_ver)/Makefile	\
   1.586 -		: $(CCACHE_CFG)
   1.587 -		$(info Configuring $@. Log in $(@D)/log.config)
   1.588 -		@mkdir -p $(@D)
   1.589 -		@(						\
   1.590 -			cd $(@D) ;				\
   1.591 -			$(PATHPRE) $(ENVS) $(CCACHE_CFG)	\
   1.592 -				$(CONFIG) 			\
   1.593 -		) > $(@D)/log.config 2>&1
   1.594 -		@echo 'done'
   1.595 +# very straightforward. just build a ccache. it is only for host.
   1.596 +$(BUILDDIR)/$(ccache_ver)/Makefile \
   1.597 +    : $(CCACHE_CFG)
   1.598 +	$(info Configuring $@. Log in $(@D)/log.config)
   1.599 +	@mkdir -p $(@D)
   1.600 +	@( \
   1.601 +	  cd $(@D) ; \
   1.602 +	  $(PATHPRE) $(ENVS) $(CCACHE_CFG) \
   1.603 +	      $(CONFIG) \
   1.604 +	) > $(@D)/log.config 2>&1
   1.605 +	@echo 'done'
   1.606  
   1.607 -gccpatch	= $(TARGETDIR)/gcc-patched
   1.608 +gccpatch = $(TARGETDIR)/gcc-patched
   1.609  
   1.610  ##########################################################################################
   1.611 -# For some reason cpp is not created as a target-compiler 
   1.612 +# For some reason cpp is not created as a target-compiler
   1.613  ifeq ($(HOST),$(TARGET))
   1.614 -$(gccpatch)	: $(gcc) link_libs
   1.615 -		@echo -n 'Creating compiler symlinks...'
   1.616 -		@for f in cpp; do 				\
   1.617 -			if [ ! -e $(PREFIX)/bin/$(TARGET)-$$f ];\
   1.618 -			then					\
   1.619 -			cd $(PREFIX)/bin && 			\
   1.620 -				ln -s $$f $(TARGET)-$$f ;	\
   1.621 -			fi					\
   1.622 -		done
   1.623 -		@touch $@
   1.624 -		@echo 'done'
   1.625 +  $(gccpatch) : $(gcc) link_libs
   1.626 +	@echo -n 'Creating compiler symlinks...'
   1.627 +	@for f in cpp; do \
   1.628 +	  if [ ! -e $(PREFIX)/bin/$(TARGET)-$$f ]; \
   1.629 +	  then \
   1.630 +	    cd $(PREFIX)/bin && \
   1.631 +	    ln -s $$f $(TARGET)-$$f ; \
   1.632 +	  fi \
   1.633 +	done
   1.634 +	@touch $@
   1.635 +	@echo 'done'
   1.636  
   1.637 -##########################################################################################
   1.638 -# Ugly at best. Seems that when we compile host->host compiler, that are NOT
   1.639 -# the BUILD compiler, the result will not try searching for libs in package root.
   1.640 -# "Solve" this by create links from the target libdirs to where they are. 
   1.641 -link_libs:
   1.642 -		@echo -n 'Creating library symlinks...'
   1.643 -		@$(foreach l,$(LIBDIRS),							\
   1.644 -		for f in `cd $(PREFIX)/$(l) && ls`; do 						\
   1.645 -			if [ ! -e $(TARGETDIR)/$(l)/$$f ]; then					\
   1.646 -				mkdir -p $(TARGETDIR)/$(l) &&					\
   1.647 -				cd $(TARGETDIR)/$(l)/ && 					\
   1.648 -				ln -s $(if $(findstring /,$(l)),../,)../../$(l)/$$f $$f;	\
   1.649 -			fi									\
   1.650 -		done;) 
   1.651 -		@echo 'done'
   1.652 +  ##########################################################################################
   1.653 +  # Ugly at best. Seems that when we compile host->host compiler, that are NOT
   1.654 +  # the BUILD compiler, the result will not try searching for libs in package root.
   1.655 +  # "Solve" this by create links from the target libdirs to where they are.
   1.656 +  link_libs:
   1.657 +	@echo -n 'Creating library symlinks...'
   1.658 +	@$(foreach l,$(LIBDIRS), \
   1.659 +	for f in `cd $(PREFIX)/$(l) && ls`; do \
   1.660 +	  if [ ! -e $(TARGETDIR)/$(l)/$$f ]; then \
   1.661 +	    mkdir -p $(TARGETDIR)/$(l) && \
   1.662 +	    cd $(TARGETDIR)/$(l)/ && \
   1.663 +	    ln -s $(if $(findstring /,$(l)),../,)../../$(l)/$$f $$f; \
   1.664 +	  fi \
   1.665 +	done;)
   1.666 +	@echo 'done'
   1.667  else
   1.668 -$(gccpatch)	:
   1.669 -		@echo 'done'
   1.670 +  $(gccpatch) :
   1.671 +	@echo 'done'
   1.672  endif
   1.673  
   1.674  ##########################################################################################
   1.675 -# Build in two steps. 
   1.676 +# Build in two steps.
   1.677  # make <default>
   1.678 -# make install. 
   1.679 +# make install.
   1.680  # Use path to our build hosts cross tools
   1.681 -# Always need to build cross tools for build host self. 
   1.682 -$(TARGETDIR)/%.done : $(BUILDDIR)/%/Makefile 
   1.683 -		$(info Building $(basename $@). Log in $(<D)/log.build)
   1.684 -		$(PATHPRE) $(ENVS) $(MAKE) $(BUILDPAR) -f $< -C $(<D) $(MAKECMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.build 2>&1
   1.685 -		@echo -n 'installing...'
   1.686 -		$(PATHPRE) $(MAKE) $(INSTALLPAR) -f $< -C $(<D) $(INSTALLCMD) $(MAKECMD.$(notdir $@))  > $(<D)/log.install 2>&1
   1.687 -		@touch $@
   1.688 -		@echo 'done'
   1.689 +# Always need to build cross tools for build host self.
   1.690 +$(TARGETDIR)/%.done : $(BUILDDIR)/%/Makefile
   1.691 +	$(info Building $(basename $@). Log in $(<D)/log.build)
   1.692 +	$(PATHPRE) $(ENVS) $(MAKE) $(BUILDPAR) -f $< -C $(<D) $(MAKECMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.build 2>&1
   1.693 +	@echo -n 'installing...'
   1.694 +	$(PATHPRE) $(MAKE) $(INSTALLPAR) -f $< -C $(<D) $(INSTALLCMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.install 2>&1
   1.695 +	@touch $@
   1.696 +	@echo 'done'
   1.697  
   1.698  ##########################################################################################
   1.699  
   1.700 -bfdlib		: $(bfdlib)
   1.701 -binutils	: $(binutils)
   1.702 -rpms		: $(rpms)
   1.703 -libs		: $(libs)
   1.704 -sysroot		: rpms libs
   1.705 -gcc		: sysroot $(gcc) $(gccpatch)
   1.706 -all		: binutils gcc bfdlib
   1.707 +bfdlib : $(bfdlib)
   1.708 +binutils : $(binutils)
   1.709 +rpms : $(rpms)
   1.710 +libs : $(libs)
   1.711 +sysroot : rpms libs
   1.712 +gcc : sysroot $(gcc) $(gccpatch)
   1.713 +all : binutils gcc bfdlib
   1.714  
   1.715 -# this is only built for host. so separate. 
   1.716 -ccache		: $(ccache)
   1.717 +# this is only built for host. so separate.
   1.718 +ccache : $(ccache)
   1.719  
   1.720 -.PHONY		: gcc all binutils bfdlib link_libs rpms libs sysroot
   1.721 +.PHONY : gcc all binutils bfdlib link_libs rpms libs sysroot

mercurial