make/devkit/Tools.gmk
changeset 48839 042834d56fbf
parent 47433 6331ad007664
child 49204 564802b01ded
child 49357 aaedb8343784
equal deleted inserted replaced
48838:27621e6afcc8 48839:042834d56fbf
     1 #
     1 #
     2 # Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     7 # published by the Free Software Foundation.  Oracle designates this
    42 $(info TARGET=$(TARGET))
    42 $(info TARGET=$(TARGET))
    43 $(info HOST=$(HOST))
    43 $(info HOST=$(HOST))
    44 $(info BUILD=$(BUILD))
    44 $(info BUILD=$(BUILD))
    45 
    45 
    46 ARCH := $(word 1,$(subst -, ,$(TARGET)))
    46 ARCH := $(word 1,$(subst -, ,$(TARGET)))
       
    47 $(info ARCH=$(ARCH))
    47 
    48 
    48 ##########################################################################################
    49 ##########################################################################################
    49 # Define external dependencies
    50 # Define external dependencies
    50 
    51 
    51 # Latest that could be made to work.
    52 # Latest that could be made to work.
    52 gcc_ver := gcc-4.9.2
    53 GCC_VER := 7.3.0
    53 binutils_ver := binutils-2.25
    54 ifeq ($(GCC_VER), 7.3.0)
    54 ccache_ver := ccache-3.2.1
    55   gcc_ver := gcc-7.3.0
    55 mpfr_ver := mpfr-3.0.1
    56   binutils_ver := binutils-2.30
    56 gmp_ver := gmp-4.3.2
    57   ccache_ver := ccache-3.3.6
    57 mpc_ver := mpc-1.0.1
    58   mpfr_ver := mpfr-3.1.5
    58 
    59   gmp_ver := gmp-6.1.2
    59 GCC := http://ftp.gnu.org/pub/gnu/gcc/$(gcc_ver)/$(gcc_ver).tar.bz2
    60   mpc_ver := mpc-1.0.3
    60 BINUTILS := http://ftp.gnu.org/pub/gnu/binutils/$(binutils_ver).tar.bz2
    61   gdb_ver := gdb-8.1
    61 CCACHE := http://samba.org/ftp/ccache/$(ccache_ver).tar.gz
    62 else ifeq ($(GCC_VER), 4.9.2)
       
    63   gcc_ver := gcc-4.9.2
       
    64   binutils_ver := binutils-2.25
       
    65   ccache_ver := ccache-3.2.1
       
    66   mpfr_ver := mpfr-3.0.1
       
    67   gmp_ver := gmp-4.3.2
       
    68   mpc_ver := mpc-1.0.1
       
    69   gdb_ver := gdb-7.12.1
       
    70 else
       
    71   $(error Unsupported GCC version)
       
    72 endif
       
    73 
       
    74 GCC := http://ftp.gnu.org/pub/gnu/gcc/$(gcc_ver)/$(gcc_ver).tar.xz
       
    75 BINUTILS := http://ftp.gnu.org/pub/gnu/binutils/$(binutils_ver).tar.xz
       
    76 CCACHE := https://samba.org/ftp/ccache/$(ccache_ver).tar.xz
    62 MPFR := http://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2
    77 MPFR := http://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2
    63 GMP := http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2
    78 GMP := http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2
    64 MPC := http://www.multiprecision.org/mpc/download/${mpc_ver}.tar.gz
    79 MPC := http://ftp.gnu.org/pub/gnu/mpc/${mpc_ver}.tar.gz
       
    80 GDB := http://ftp.gnu.org/gnu/gdb/${gdb_ver}.tar.xz
       
    81 
       
    82 OEL_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/
    65 
    83 
    66 # RPMs in OEL6.4
    84 # RPMs in OEL6.4
    67 LINUX_VERSION := OEL6.4
    85 LINUX_VERSION := OEL6.4
    68 RPM_LIST := \
    86 RPM_LIST := \
    69     kernel-headers \
    87     kernel-headers \
    83     libXdmcp libXdmcp-devel \
   101     libXdmcp libXdmcp-devel \
    84     libXau libXau-devel \
   102     libXau libXau-devel \
    85     libgcc \
   103     libgcc \
    86     zlib zlib-devel \
   104     zlib zlib-devel \
    87     libffi libffi-devel \
   105     libffi libffi-devel \
    88     fontconfig fontconfig-devel
   106     fontconfig fontconfig-devel \
       
   107     systemtap-sdt-devel \
       
   108     #
       
   109 
       
   110 ##########################################################################################
       
   111 # Define common directories and files
       
   112 
       
   113 # Ensure we have 32-bit libs also for x64. We enable mixed-mode.
       
   114 ifeq (x86_64,$(ARCH))
       
   115   LIBDIRS := lib64 lib
       
   116   CFLAGS_lib := -m32
       
   117 else
       
   118   LIBDIRS := lib
       
   119 endif
       
   120 
       
   121 # Define directories
       
   122 RESULT := $(OUTPUT_ROOT)/result
       
   123 BUILDDIR := $(OUTPUT_ROOT)/$(HOST)/$(TARGET)
       
   124 PREFIX := $(RESULT)/$(HOST)
       
   125 TARGETDIR := $(PREFIX)/$(TARGET)
       
   126 SYSROOT := $(TARGETDIR)/sysroot
       
   127 DOWNLOAD := $(OUTPUT_ROOT)/download
       
   128 DOWNLOAD_RPMS := $(DOWNLOAD)/rpms
       
   129 SRCDIR := $(OUTPUT_ROOT)/src
       
   130 
       
   131 # Marker file for unpacking rpms
       
   132 rpms := $(SYSROOT)/rpms_unpacked
       
   133 
       
   134 # Need to patch libs that are linker scripts to use non-absolute paths
       
   135 libs := $(SYSROOT)/libs_patched
       
   136 
       
   137 ################################################################################
       
   138 # Download RPMs
       
   139 download-rpms:
       
   140 	mkdir -p $(DOWNLOAD_RPMS)
       
   141         # Only run this if rpm dir is empty.
       
   142         ifeq ($(wildcard $(DOWNLOAD_RPMS)/*.rpm), )
       
   143 	  cd $(DOWNLOAD_RPMS) && \
       
   144 	      wget -r -np -nd $(patsubst %, -A "*%*.rpm", $(RPM_LIST)) $(OEL_URL)
       
   145         endif
       
   146 
       
   147 ##########################################################################################
       
   148 # Unpack source packages
       
   149 
       
   150 # Generate downloading + unpacking of sources.
       
   151 define Download
       
   152   $(1)_DIR = $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1))))))
       
   153   $(1)_CFG = $$($(1)_DIR)/configure
       
   154   $(1)_FILE = $(DOWNLOAD)/$(notdir $($(1)))
       
   155 
       
   156   $$($(1)_CFG) : $$($(1)_FILE)
       
   157 	mkdir -p $$(SRCDIR)
       
   158 	tar -C $$(SRCDIR) -xf $$<
       
   159 	$$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)), \
       
   160 	  echo PATCHING $$(p) ; \
       
   161 	  patch -d $$($(1)_DIR) -p1 -i $$(p) ; \
       
   162 	)
       
   163 	touch $$@
       
   164 
       
   165   $$($(1)_FILE) :
       
   166 	wget -P $(DOWNLOAD) $$($(1))
       
   167 endef
       
   168 
       
   169 # Download and unpack all source packages
       
   170 $(foreach p,GCC BINUTILS CCACHE MPFR GMP MPC GDB,$(eval $(call Download,$(p))))
       
   171 
       
   172 ##########################################################################################
       
   173 # Unpack RPMS
    89 
   174 
    90 ifeq ($(ARCH),x86_64)
   175 ifeq ($(ARCH),x86_64)
    91   RPM_DIR ?= $(RPM_DIR_x86_64)
       
    92   RPM_ARCHS := x86_64 noarch
   176   RPM_ARCHS := x86_64 noarch
    93   ifeq ($(BUILD),$(HOST))
   177   ifeq ($(BUILD),$(HOST))
    94     ifeq ($(TARGET),$(HOST))
   178     ifeq ($(TARGET),$(HOST))
    95       # When building the native compiler for x86_64, enable mixed mode.
   179       # When building the native compiler for x86_64, enable mixed mode.
    96       RPM_ARCHS += i386 i686
   180       RPM_ARCHS += i386 i686
    97     endif
   181     endif
    98   endif
   182   endif
       
   183 else ifeq ($(ARCH),i686))
       
   184   RPM_ARCHS := i386 i686
    99 else
   185 else
   100   RPM_DIR ?= $(RPM_DIR_i686)
   186   RPM_ARCHS := $(ARCH)
   101   RPM_ARCHS := i386 i686
   187 endif
   102 endif
   188 
   103 
   189 RPM_FILE_LIST := $(sort $(foreach a, $(RPM_ARCHS), \
   104 # Sort to remove duplicates
   190   $(wildcard $(patsubst %,$(DOWNLOAD_RPMS)/%*$a.rpm,$(RPM_LIST))) \
   105 RPM_FILE_LIST := $(sort $(foreach a,$(RPM_ARCHS),$(wildcard $(patsubst %,$(RPM_DIR)/%*$a.rpm,$(RPM_LIST)))))
   191 ))
   106 
       
   107 #$(info RPM_FILE_LIST $(RPM_FILE_LIST))
       
   108 
       
   109 ifeq ($(RPM_FILE_LIST),)
       
   110   $(error Found no RPMs, RPM_DIR must point to list of directories to search for RPMs)
       
   111 endif
       
   112 
       
   113 ##########################################################################################
       
   114 # Define common directories and files
       
   115 
       
   116 # Ensure we have 32-bit libs also for x64. We enable mixed-mode.
       
   117 ifeq (x86_64,$(ARCH))
       
   118   LIBDIRS := lib64 lib
       
   119   CFLAGS_lib := -m32
       
   120 else
       
   121   LIBDIRS := lib
       
   122 endif
       
   123 
       
   124 # Define directories
       
   125 RESULT := $(OUTPUTDIR)/result
       
   126 BUILDDIR := $(OUTPUTDIR)/$(HOST)/$(TARGET)
       
   127 PREFIX := $(RESULT)/$(HOST)
       
   128 TARGETDIR := $(PREFIX)/$(TARGET)
       
   129 SYSROOT := $(TARGETDIR)/sysroot
       
   130 DOWNLOAD := $(OUTPUTDIR)/download
       
   131 SRCDIR := $(OUTPUTDIR)/src
       
   132 
       
   133 # Marker file for unpacking rpms
       
   134 rpms := $(SYSROOT)/rpms_unpacked
       
   135 
       
   136 # Need to patch libs that are linker scripts to use non-absolute paths
       
   137 libs := $(SYSROOT)/libs_patched
       
   138 
       
   139 ##########################################################################################
       
   140 # Unpack source packages
       
   141 
       
   142 # Generate downloading + unpacking of sources.
       
   143 define Download
       
   144   $(1)_DIR = $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1))))))
       
   145   $(1)_CFG = $$($(1)_DIR)/configure
       
   146   $(1)_FILE = $(DOWNLOAD)/$(notdir $($(1)))
       
   147 
       
   148   $$($(1)_CFG) : $$($(1)_FILE)
       
   149 	mkdir -p $$(SRCDIR)
       
   150 	tar -C $$(SRCDIR) -x$$(if $$(findstring .gz, $$<),z,j)f $$<
       
   151 	$$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)), \
       
   152 	  echo PATCHING $$(p) ; \
       
   153 	  patch -d $$($(1)_DIR) -p1 -i $$(p) ; \
       
   154 	)
       
   155 	touch $$@
       
   156 
       
   157   $$($(1)_FILE) :
       
   158 	wget -P $(DOWNLOAD) $$($(1))
       
   159 endef
       
   160 
       
   161 # Download and unpack all source packages
       
   162 $(foreach p,GCC BINUTILS CCACHE MPFR GMP MPC,$(eval $(call Download,$(p))))
       
   163 
       
   164 ##########################################################################################
       
   165 # Unpack RPMS
       
   166 
   192 
   167 # Note. For building linux you should install rpm2cpio.
   193 # Note. For building linux you should install rpm2cpio.
   168 define unrpm
   194 define unrpm
   169   $(SYSROOT)/$(notdir $(1)).unpacked \
   195   $(SYSROOT)/$(notdir $(1)).unpacked : $(1)
   170     : $(1)
       
   171   $$(rpms) : $(SYSROOT)/$(notdir $(1)).unpacked
   196   $$(rpms) : $(SYSROOT)/$(notdir $(1)).unpacked
   172 endef
   197 endef
   173 
   198 
   174 %.unpacked :
   199 %.unpacked :
   175 	$(info Unpacking target rpms and libraries from $<)
   200 	$(info Unpacking target rpms and libraries from $<)
   208 	@touch $@
   233 	@touch $@
   209 
   234 
   210 ##########################################################################################
   235 ##########################################################################################
   211 # Create links for ffi header files so that they become visible by default when using the
   236 # Create links for ffi header files so that they become visible by default when using the
   212 # devkit.
   237 # devkit.
   213 
   238 ifeq ($(ARCH), x86_64)
   214 $(SYSROOT)/usr/include/ffi.h: $(rpms)
   239   $(SYSROOT)/usr/include/ffi.h: $(rpms)
   215 	cd $(@D) && rm $(@F) && ln -s ../lib/libffi-*/include/$(@F) .
   240 	cd $(@D) && rm -f $(@F) && ln -s ../lib/libffi-*/include/$(@F) .
   216 
   241 
   217 $(SYSROOT)/usr/include/ffitarget.h: $(rpms)
   242   $(SYSROOT)/usr/include/ffitarget.h: $(rpms)
   218 	cd $(@D) && rm $(@F) && ln -s ../lib/libffi-*/include/$(@F) .
   243 	cd $(@D) && rm -f $(@F) && ln -s ../lib/libffi-*/include/$(@F) .
   219 
   244 
   220 SYSROOT_LINKS += $(SYSROOT)/usr/include/ffi.h $(SYSROOT)/usr/include/ffitarget.h
   245   SYSROOT_LINKS += $(SYSROOT)/usr/include/ffi.h $(SYSROOT)/usr/include/ffitarget.h
       
   246 endif
   221 
   247 
   222 ##########################################################################################
   248 ##########################################################################################
   223 
   249 
   224 # Define marker files for each source package to be compiled
   250 # Define marker files for each source package to be compiled
   225 $(foreach t,binutils mpfr gmp mpc gcc ccache,$(eval $(t) = $(TARGETDIR)/$($(t)_ver).done))
   251 $(foreach t,binutils mpfr gmp mpc gcc ccache gdb,$(eval $(t) = $(TARGETDIR)/$($(t)_ver).done))
   226 
   252 
   227 ##########################################################################################
   253 ##########################################################################################
   228 
   254 
   229 # Default base config
   255 # Default base config
   230 CONFIG = --target=$(TARGET) \
   256 CONFIG = --target=$(TARGET) \
   232     --prefix=$(PREFIX)
   258     --prefix=$(PREFIX)
   233 
   259 
   234 PATHEXT = $(RESULT)/$(BUILD)/bin:
   260 PATHEXT = $(RESULT)/$(BUILD)/bin:
   235 
   261 
   236 PATHPRE = PATH=$(PATHEXT)$(PATH)
   262 PATHPRE = PATH=$(PATHEXT)$(PATH)
   237 BUILDPAR = -j16
   263 NUM_CORES := $(shell cat /proc/cpuinfo | grep -c processor)
       
   264 BUILDPAR = -j$(NUM_CORES)
   238 
   265 
   239 # Default commands to when making
   266 # Default commands to when making
   240 MAKECMD =
   267 MAKECMD =
   241 INSTALLCMD = install
   268 INSTALLCMD = install
   242 
   269 
   315 	      $(CONFIG) \
   342 	      $(CONFIG) \
   316 	      --with-sysroot=$(SYSROOT) \
   343 	      --with-sysroot=$(SYSROOT) \
   317 	      --disable-nls \
   344 	      --disable-nls \
   318 	      --program-prefix=$(TARGET)- \
   345 	      --program-prefix=$(TARGET)- \
   319 	      --enable-multilib \
   346 	      --enable-multilib \
       
   347 	      --enable-gold \
       
   348 	      --enable-plugins \
   320 	) > $(@D)/log.config 2>&1
   349 	) > $(@D)/log.config 2>&1
   321 	@echo 'done'
   350 	@echo 'done'
   322 
   351 
   323 $(BUILDDIR)/$(mpfr_ver)/Makefile \
   352 $(BUILDDIR)/$(mpfr_ver)/Makefile \
   324     : $(MPFR_CFG)
   353     : $(MPFR_CFG)
   390 	  $(PATHPRE) $(ENVS) $(GCC_CFG) $(EXTRA_CFLAGS) \
   419 	  $(PATHPRE) $(ENVS) $(GCC_CFG) $(EXTRA_CFLAGS) \
   391 	      $(CONFIG) \
   420 	      $(CONFIG) \
   392 	      --with-sysroot=$(SYSROOT) \
   421 	      --with-sysroot=$(SYSROOT) \
   393 	      --enable-languages=c,c++ \
   422 	      --enable-languages=c,c++ \
   394 	      --enable-shared \
   423 	      --enable-shared \
   395 	      --enable-multilib \
       
   396 	      --disable-nls \
   424 	      --disable-nls \
   397 	      --with-gnu-as \
   425 	      --with-gnu-as \
   398 	      --with-gnu-ld \
   426 	      --with-gnu-ld \
   399 	      --with-mpfr=$(PREFIX) \
   427 	      --with-mpfr=$(PREFIX) \
   400 	      --with-gmp=$(PREFIX) \
   428 	      --with-gmp=$(PREFIX) \
   407 
   435 
   408 # as of 4.3 or so need these for doing config
   436 # as of 4.3 or so need these for doing config
   409 $(BUILDDIR)/$(gcc_ver)/Makefile : $(gmp) $(mpfr) $(mpc)
   437 $(BUILDDIR)/$(gcc_ver)/Makefile : $(gmp) $(mpfr) $(mpc)
   410 $(mpfr) : $(gmp)
   438 $(mpfr) : $(gmp)
   411 $(mpc) : $(gmp) $(mpfr)
   439 $(mpc) : $(gmp) $(mpfr)
       
   440 
       
   441 ################################################################################
       
   442 # Build gdb but only where host and target match
       
   443 ifeq ($(HOST), $(TARGET))
       
   444   $(BUILDDIR)/$(gdb_ver)/Makefile: $(GDB_CFG)
       
   445 	$(info Configuring $@. Log in $(@D)/log.config)
       
   446 	mkdir -p $(@D)
       
   447 	( \
       
   448 	  cd $(@D) ; \
       
   449 	  $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" $(GDB_CFG) \
       
   450 	      $(CONFIG) \
       
   451 	      --with-sysroot=$(SYSROOT) \
       
   452 	) > $(@D)/log.config 2>&1
       
   453 	@echo 'done'
       
   454 
       
   455   $(gdb): $(gcc)
       
   456 endif
   412 
   457 
   413 ##########################################################################################
   458 ##########################################################################################
   414 # very straightforward. just build a ccache. it is only for host.
   459 # very straightforward. just build a ccache. it is only for host.
   415 $(BUILDDIR)/$(ccache_ver)/Makefile \
   460 $(BUILDDIR)/$(ccache_ver)/Makefile \
   416     : $(CCACHE_CFG)
   461     : $(CCACHE_CFG)
   432 	@echo -n 'Creating compiler symlinks...'
   477 	@echo -n 'Creating compiler symlinks...'
   433 	@for f in cpp; do \
   478 	@for f in cpp; do \
   434 	  if [ ! -e $(PREFIX)/bin/$(TARGET)-$$f ]; \
   479 	  if [ ! -e $(PREFIX)/bin/$(TARGET)-$$f ]; \
   435 	  then \
   480 	  then \
   436 	    cd $(PREFIX)/bin && \
   481 	    cd $(PREFIX)/bin && \
   437 	    ln -s $$f $(TARGET)-$$f ; \
   482 	    ln -fs $$f $(TARGET)-$$f ; \
   438 	  fi \
   483 	  fi \
   439 	done
   484 	done
   440 	@touch $@
   485 	@touch $@
   441 	@echo 'done'
   486 	@echo 'done'
   442 
   487 
   449 	@$(foreach l,$(LIBDIRS), \
   494 	@$(foreach l,$(LIBDIRS), \
   450 	for f in `cd $(PREFIX)/$(l) && ls`; do \
   495 	for f in `cd $(PREFIX)/$(l) && ls`; do \
   451 	  if [ ! -e $(TARGETDIR)/$(l)/$$f ]; then \
   496 	  if [ ! -e $(TARGETDIR)/$(l)/$$f ]; then \
   452 	    mkdir -p $(TARGETDIR)/$(l) && \
   497 	    mkdir -p $(TARGETDIR)/$(l) && \
   453 	    cd $(TARGETDIR)/$(l)/ && \
   498 	    cd $(TARGETDIR)/$(l)/ && \
   454 	    ln -s $(if $(findstring /,$(l)),../,)../../$(l)/$$f $$f; \
   499 	    ln -fs $(if $(findstring /,$(l)),../,)../../$(l)/$$f $$f; \
   455 	  fi \
   500 	  fi \
   456 	done;)
   501 	done;)
   457 	@echo 'done'
   502 	@echo 'done'
   458 else
   503 else
   459   $(gccpatch) :
   504   $(gccpatch) :
   469 $(TARGETDIR)/%.done : $(BUILDDIR)/%/Makefile
   514 $(TARGETDIR)/%.done : $(BUILDDIR)/%/Makefile
   470 	$(info Building $(basename $@). Log in $(<D)/log.build)
   515 	$(info Building $(basename $@). Log in $(<D)/log.build)
   471 	$(PATHPRE) $(ENVS) $(MAKE) $(BUILDPAR) -f $< -C $(<D) $(MAKECMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.build 2>&1
   516 	$(PATHPRE) $(ENVS) $(MAKE) $(BUILDPAR) -f $< -C $(<D) $(MAKECMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.build 2>&1
   472 	@echo -n 'installing...'
   517 	@echo -n 'installing...'
   473 	$(PATHPRE) $(MAKE) $(INSTALLPAR) -f $< -C $(<D) $(INSTALLCMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.install 2>&1
   518 	$(PATHPRE) $(MAKE) $(INSTALLPAR) -f $< -C $(<D) $(INSTALLCMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.install 2>&1
       
   519 	@mkdir -p $(@D)
   474 	@touch $@
   520 	@touch $@
   475 	@echo 'done'
   521 	@echo 'done'
   476 
   522 
   477 ##########################################################################################
   523 ##########################################################################################
   478 
   524 
   484 	echo '# devkit' >> $@
   530 	echo '# devkit' >> $@
   485 	echo '' >> $@
   531 	echo '' >> $@
   486 	echo 'DEVKIT_NAME="$(gcc_ver) - $(LINUX_VERSION)"' >> $@
   532 	echo 'DEVKIT_NAME="$(gcc_ver) - $(LINUX_VERSION)"' >> $@
   487 	echo 'DEVKIT_TOOLCHAIN_PATH="$$DEVKIT_ROOT/bin"' >> $@
   533 	echo 'DEVKIT_TOOLCHAIN_PATH="$$DEVKIT_ROOT/bin"' >> $@
   488 	echo 'DEVKIT_SYSROOT="$$DEVKIT_ROOT/$$host/sysroot"' >> $@
   534 	echo 'DEVKIT_SYSROOT="$$DEVKIT_ROOT/$$host/sysroot"' >> $@
       
   535 	echo 'DEVKIT_EXTRA_PATH="$$DEVKIT_ROOT/bin"' >> $@
       
   536 
       
   537 ##########################################################################################
       
   538 # Copy these makefiles into the root of the kit
       
   539 $(PREFIX)/Makefile: ./Makefile
       
   540 	rm -rf $@
       
   541 	cp $< $@
       
   542 
       
   543 $(PREFIX)/Tools.gmk: ./Tools.gmk
       
   544 	rm -rf $@
       
   545 	cp $< $@
       
   546 
       
   547 THESE_MAKEFILES := $(PREFIX)/Makefile $(PREFIX)/Tools.gmk
   489 
   548 
   490 ##########################################################################################
   549 ##########################################################################################
   491 
   550 
   492 ifeq ($(TARGET), $(HOST))
   551 ifeq ($(TARGET), $(HOST))
       
   552   # To build with dtrace support, the build needs access to the dtrace executable from the
       
   553   # sysroot. Generally we don't want to add binaries in the sysroot to the path, but
       
   554   # luckily this seems to execute well enough on a different host Linux distro, so symlink
       
   555   # it into the main bin dir.
       
   556   $(PREFIX)/bin/dtrace:
       
   557 	@echo 'Creating dtrace soft link'
       
   558 	ln -s ../$(HOST)/sysroot/usr/bin/dtrace $@
       
   559 
   493   $(PREFIX)/bin/%:
   560   $(PREFIX)/bin/%:
   494 	@echo 'Creating missing $* soft link'
   561 	@echo 'Creating missing $* soft link'
   495 	ln -s $(TARGET)-$* $@
   562 	ln -s $(TARGET)-$* $@
   496 
   563 
   497   missing-links := $(addprefix $(PREFIX)/bin/, \
   564   missing-links := $(addprefix $(PREFIX)/bin/, \
   498       addr2line ar as c++ c++filt elfedit g++ gcc gprof ld nm objcopy ranlib readelf \
   565       addr2line ar as c++ c++filt elfedit g++ gcc gprof ld nm objcopy ranlib readelf \
   499       size strings strip)
   566       size strings strip ld.bfd ld.gold dtrace)
   500 endif
   567 endif
   501 
   568 
   502 ##########################################################################################
   569 ##########################################################################################
   503 
   570 
   504 bfdlib : $(bfdlib)
   571 bfdlib : $(bfdlib)
   505 binutils : $(binutils)
   572 binutils : $(binutils)
   506 rpms : $(rpms)
   573 rpms : $(rpms)
   507 libs : $(libs)
   574 libs : $(libs)
   508 sysroot : rpms libs
   575 sysroot : rpms libs
   509 gcc : sysroot $(gcc) $(gccpatch)
   576 gcc : sysroot $(gcc) $(gccpatch)
   510 all : binutils gcc bfdlib $(PREFIX)/devkit.info $(missing-links) $(SYSROOT_LINKS)
   577 gdb : $(gdb)
       
   578 all : binutils gcc bfdlib $(PREFIX)/devkit.info $(missing-links) $(SYSROOT_LINKS) \
       
   579     $(THESE_MAKEFILES) gdb
   511 
   580 
   512 # this is only built for host. so separate.
   581 # this is only built for host. so separate.
   513 ccache : $(ccache)
   582 ccache : $(ccache)
   514 
   583 
   515 # Force target
   584 # Force target