common/makefiles/devkit/Tools.gmk

Mon, 26 Aug 2013 10:09:15 -0700

author
mduigou
date
Mon, 26 Aug 2013 10:09:15 -0700
changeset 778
f643fee2b40f
parent 740
c0fa87863427
child 839
174a54ce39c4
permissions
-rw-r--r--

8023491: Remove target names from test/Makefile and defer to sub-repo makefiles.
Reviewed-by: erikj

erikj@740 1 #
erikj@740 2 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
erikj@740 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@740 4 #
erikj@740 5 # This code is free software; you can redistribute it and/or modify it
erikj@740 6 # under the terms of the GNU General Public License version 2 only, as
erikj@740 7 # published by the Free Software Foundation. Oracle designates this
erikj@740 8 # particular file as subject to the "Classpath" exception as provided
erikj@740 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@740 10 #
erikj@740 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@740 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@740 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@740 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@740 15 # accompanied this code).
erikj@740 16 #
erikj@740 17 # You should have received a copy of the GNU General Public License version
erikj@740 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@740 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@740 20 #
erikj@740 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@740 22 # or visit www.oracle.com if you need additional information or have any
erikj@740 23 # questions.
erikj@740 24 #
erikj@740 25
erikj@740 26 ##########################################################################################
erikj@740 27 #
erikj@740 28 # Workhorse makefile for creating ONE cross compiler
erikj@740 29 # Needs either to be from BUILD -> BUILD OR have
erikj@740 30 # BUILD -> HOST prebuilt
erikj@740 31 #
erikj@740 32 # NOTE: There is a bug here. We don't limit the
erikj@740 33 # PATH when building BUILD -> BUILD, which means that
erikj@740 34 # if you configure after you've once build the BUILD->BUILD
erikj@740 35 # compiler THAT one will be picked up as the compiler for itself.
erikj@740 36 # This is not so great, especially if you did a partial delete
erikj@740 37 # of the target tree.
erikj@740 38 #
erikj@740 39 # Fix this...
erikj@740 40 #
erikj@740 41
erikj@740 42 $(info TARGET=$(TARGET))
erikj@740 43 $(info HOST=$(HOST))
erikj@740 44 $(info BUILD=$(BUILD))
erikj@740 45
erikj@740 46 ARCH := $(word 1,$(subst -, ,$(TARGET)))
erikj@740 47
erikj@740 48 ##########################################################################################
erikj@740 49 # Define external dependencies
erikj@740 50
erikj@740 51 # Latest that could be made to work.
erikj@740 52 gcc_ver := gcc-4.7.3
erikj@740 53 binutils_ver := binutils-2.22
erikj@740 54 ccache_ver := ccache-3.1.9
erikj@740 55 mpfr_ver := mpfr-3.0.1
erikj@740 56 gmp_ver := gmp-4.3.2
erikj@740 57 mpc_ver := mpc-1.0.1
erikj@740 58
erikj@740 59 GCC := http://ftp.gnu.org/pub/gnu/gcc/$(gcc_ver)/$(gcc_ver).tar.bz2
erikj@740 60 BINUTILS := http://ftp.gnu.org/pub/gnu/binutils/$(binutils_ver).tar.bz2
erikj@740 61 CCACHE := http://samba.org/ftp/ccache/$(ccache_ver).tar.gz
erikj@740 62 MPFR := http://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2
erikj@740 63 GMP := http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2
erikj@740 64 MPC := http://www.multiprecision.org/mpc/download/${mpc_ver}.tar.gz
erikj@740 65
erikj@740 66 # RPMs in OEL5.5
erikj@740 67 RPM_LIST := \
erikj@740 68 kernel-headers \
erikj@740 69 glibc-2 glibc-headers glibc-devel \
erikj@740 70 cups-libs cups-devel \
erikj@740 71 libX11 libX11-devel \
erikj@740 72 xorg-x11-proto-devel \
erikj@740 73 alsa-lib alsa-lib-devel \
erikj@740 74 libXext libXext-devel \
erikj@740 75 libXtst libXtst-devel \
erikj@740 76 libXrender libXrender-devel \
erikj@740 77 freetype freetype-devel \
erikj@740 78 libXt libXt-devel \
erikj@740 79 libSM libSM-devel \
erikj@740 80 libICE libICE-devel \
erikj@740 81 libXi libXi-devel \
erikj@740 82 libXdmcp libXdmcp-devel \
erikj@740 83 libXau libXau-devel \
erikj@740 84 libgcc
erikj@740 85
erikj@740 86
erikj@740 87 ifeq ($(ARCH),x86_64)
erikj@740 88 RPM_DIR ?= $(RPM_DIR_x86_64)
erikj@740 89 RPM_ARCHS := x86_64
erikj@740 90 ifeq ($(BUILD),$(HOST))
erikj@740 91 ifeq ($(TARGET),$(HOST))
erikj@740 92 # When building the native compiler for x86_64, enable mixed mode.
erikj@740 93 RPM_ARCHS += i386 i686
erikj@740 94 endif
erikj@740 95 endif
erikj@740 96 else
erikj@740 97 RPM_DIR ?= $(RPM_DIR_i686)
erikj@740 98 RPM_ARCHS := i386 i686
erikj@740 99 endif
erikj@740 100
erikj@740 101 # Sort to remove duplicates
erikj@740 102 RPM_FILE_LIST := $(sort $(foreach a,$(RPM_ARCHS),$(wildcard $(patsubst %,$(RPM_DIR)/%*$a.rpm,$(RPM_LIST)))))
erikj@740 103
erikj@740 104 ifeq ($(RPM_FILE_LIST),)
erikj@740 105 $(error Found no RPMs, RPM_DIR must point to list of directories to search for RPMs)
erikj@740 106 endif
erikj@740 107
erikj@740 108 ##########################################################################################
erikj@740 109 # Define common directories and files
erikj@740 110
erikj@740 111 # Ensure we have 32-bit libs also for x64. We enable mixed-mode.
erikj@740 112 ifeq (x86_64,$(ARCH))
erikj@740 113 LIBDIRS := lib64 lib
erikj@740 114 CFLAGS_lib := -m32
erikj@740 115 else
erikj@740 116 LIBDIRS := lib
erikj@740 117 endif
erikj@740 118
erikj@740 119 # Define directories
erikj@740 120 RESULT := $(OUTPUT_ROOT)/result
erikj@740 121 BUILDDIR := $(OUTPUT_ROOT)/$(HOST)/$(TARGET)
erikj@740 122 PREFIX := $(RESULT)/$(HOST)
erikj@740 123 TARGETDIR := $(PREFIX)/$(TARGET)
erikj@740 124 SYSROOT := $(TARGETDIR)/sys-root
erikj@740 125 DOWNLOAD := $(OUTPUT_ROOT)/download
erikj@740 126 SRCDIR := $(OUTPUT_ROOT)/src
erikj@740 127
erikj@740 128 # Marker file for unpacking rpms
erikj@740 129 rpms := $(SYSROOT)/rpms_unpacked
erikj@740 130
erikj@740 131 # Need to patch libs that are linker scripts to use non-absolute paths
erikj@740 132 libs := $(SYSROOT)/libs_patched
erikj@740 133
erikj@740 134 ##########################################################################################
erikj@740 135 # Unpack source packages
erikj@740 136
erikj@740 137 # Generate downloading + unpacking of sources.
erikj@740 138 define Download
erikj@740 139 $(1)_DIR = $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1))))))
erikj@740 140 $(1)_CFG = $$($(1)_DIR)/configure
erikj@740 141 $(1)_FILE = $(DOWNLOAD)/$(notdir $($(1)))
erikj@740 142
erikj@740 143 $$($(1)_CFG) : $$($(1)_FILE)
erikj@740 144 mkdir -p $$(SRCDIR)
erikj@740 145 tar -C $$(SRCDIR) -x$$(if $$(findstring .gz, $$<),z,j)f $$<
erikj@740 146 $$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)), \
erikj@740 147 echo PATCHING $$(p) ; \
erikj@740 148 patch -d $$($(1)_DIR) -p1 -i $$(p) ; \
erikj@740 149 )
erikj@740 150 touch $$@
erikj@740 151
erikj@740 152 $$($(1)_FILE) :
erikj@740 153 wget -P $(DOWNLOAD) $$($(1))
erikj@740 154 endef
erikj@740 155
erikj@740 156 # Download and unpack all source packages
erikj@740 157 $(foreach p,GCC BINUTILS CCACHE MPFR GMP MPC,$(eval $(call Download,$(p))))
erikj@740 158
erikj@740 159 ##########################################################################################
erikj@740 160 # Unpack RPMS
erikj@740 161
erikj@740 162 # Note. For building linux you should install rpm2cpio.
erikj@740 163 define unrpm
erikj@740 164 $(SYSROOT)/$(notdir $(1)).unpacked \
erikj@740 165 : $(1)
erikj@740 166 $$(rpms) : $(SYSROOT)/$(notdir $(1)).unpacked
erikj@740 167 endef
erikj@740 168
erikj@740 169 %.unpacked :
erikj@740 170 $(info Unpacking target rpms and libraries from $<)
erikj@740 171 @(mkdir -p $(@D); \
erikj@740 172 cd $(@D); \
erikj@740 173 rpm2cpio $< | \
erikj@740 174 cpio --extract --make-directories \
erikj@740 175 -f \
erikj@740 176 "./usr/share/doc/*" \
erikj@740 177 "./usr/share/man/*" \
erikj@740 178 "./usr/X11R6/man/*" \
erikj@740 179 "*/X11/locale/*" \
erikj@740 180 || die ; )
erikj@740 181 touch $@
erikj@740 182
erikj@740 183 $(foreach p,$(RPM_FILE_LIST),$(eval $(call unrpm,$(p))))
erikj@740 184
erikj@740 185 ##########################################################################################
erikj@740 186
erikj@740 187 # Note: MUST create a <sys-root>/usr/lib even if not really needed.
erikj@740 188 # gcc will use a path relative to it to resolve lib64. (x86_64).
erikj@740 189 # we're creating multi-lib compiler with 32bit libc as well, so we should
erikj@740 190 # have it anyway, but just to make sure...
erikj@740 191 # Patch libc.so and libpthread.so to force linking against libraries in sysroot
erikj@740 192 # and not the ones installed on the build machine.
erikj@740 193 $(libs) : $(rpms)
erikj@740 194 @echo Patching libc and pthreads
erikj@740 195 @(for f in `find $(SYSROOT) -name libc.so -o -name libpthread.so`; do \
erikj@740 196 (cat $$f | sed -e 's|/usr/lib64/||g' \
erikj@740 197 -e 's|/usr/lib/||g' \
erikj@740 198 -e 's|/lib64/||g' \
erikj@740 199 -e 's|/lib/||g' ) > $$f.tmp ; \
erikj@740 200 mv $$f.tmp $$f ; \
erikj@740 201 done)
erikj@740 202 @mkdir -p $(SYSROOT)/usr/lib
erikj@740 203 @touch $@
erikj@740 204
erikj@740 205 ##########################################################################################
erikj@740 206
erikj@740 207 # Define marker files for each source package to be compiled
erikj@740 208 $(foreach t,binutils mpfr gmp mpc gcc ccache,$(eval $(t) = $(TARGETDIR)/$($(t)_ver).done))
erikj@740 209
erikj@740 210 ##########################################################################################
erikj@740 211
erikj@740 212 # Default base config
erikj@740 213 CONFIG = --target=$(TARGET) \
erikj@740 214 --host=$(HOST) --build=$(BUILD) \
erikj@740 215 --prefix=$(PREFIX)
erikj@740 216
erikj@740 217 PATHEXT = $(RESULT)/$(BUILD)/bin:
erikj@740 218
erikj@740 219 PATHPRE = PATH=$(PATHEXT)$(PATH)
erikj@740 220 BUILDPAR = -j16
erikj@740 221
erikj@740 222 # Default commands to when making
erikj@740 223 MAKECMD =
erikj@740 224 INSTALLCMD = install
erikj@740 225
erikj@740 226
erikj@740 227 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
erikj@740 228
erikj@740 229 ifeq ($(HOST),$(BUILD))
erikj@740 230 ifeq ($(HOST),$(TARGET))
erikj@740 231 TOOLS = $(call declare_tools,_FOR_TARGET,)
erikj@740 232 endif
erikj@740 233 endif
erikj@740 234
erikj@740 235 TOOLS ?= $(call declare_tools,_FOR_TARGET,$(TARGET)-)
erikj@740 236
erikj@740 237 ##########################################################################################
erikj@740 238
erikj@740 239 # Create a TARGET bfd + libiberty only.
erikj@740 240 # Configure one or two times depending on mulitlib arch.
erikj@740 241 # If multilib, the second should be 32-bit, and we resolve
erikj@740 242 # CFLAG_<name> to most likely -m32.
erikj@740 243 define mk_bfd
erikj@740 244 $$(info Libs for $(1))
erikj@740 245 $$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \
erikj@740 246 : CFLAGS += $$(CFLAGS_$(1))
erikj@740 247 $$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \
erikj@740 248 : LIBDIRS = --libdir=$(TARGETDIR)/$(1)
erikj@740 249
erikj@740 250 bfdlib += $$(TARGETDIR)/$$(binutils_ver)-$(subst /,-,$(1)).done
erikj@740 251 bfdmakes += $$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile
erikj@740 252 endef
erikj@740 253
erikj@740 254 # Create one set of bfds etc for each multilib arch
erikj@740 255 $(foreach l,$(LIBDIRS),$(eval $(call mk_bfd,$(l))))
erikj@740 256
erikj@740 257 # Only build these two libs.
erikj@740 258 $(bfdlib) : MAKECMD = all-libiberty all-bfd
erikj@740 259 $(bfdlib) : INSTALLCMD = install-libiberty install-bfd
erikj@740 260
erikj@740 261 # Building targets libbfd + libiberty. HOST==TARGET, i.e not
erikj@740 262 # for a cross env.
erikj@740 263 $(bfdmakes) : CONFIG = --target=$(TARGET) \
erikj@740 264 --host=$(TARGET) --build=$(BUILD) \
erikj@740 265 --prefix=$(TARGETDIR) \
erikj@740 266 --with-sysroot=$(SYSROOT) \
erikj@740 267 $(LIBDIRS)
erikj@740 268
erikj@740 269 $(bfdmakes) : TOOLS = $(call declare_tools,_FOR_TARGET,$(TARGET)-) $(call declare_tools,,$(TARGET)-)
erikj@740 270
erikj@740 271 ##########################################################################################
erikj@740 272
erikj@740 273 $(gcc) \
erikj@740 274 $(binutils) \
erikj@740 275 $(gmp) \
erikj@740 276 $(mpfr) \
erikj@740 277 $(mpc) \
erikj@740 278 $(bfdmakes) \
erikj@740 279 $(ccache) : ENVS += $(TOOLS)
erikj@740 280
erikj@740 281 # libdir to work around hateful bfd stuff installing into wrong dirs...
erikj@740 282 # ensure we have 64 bit bfd support in the HOST library. I.e our
erikj@740 283 # compiler on i686 will know 64 bit symbols, BUT later
erikj@740 284 # we build just the libs again for TARGET, then with whatever the arch
erikj@740 285 # wants.
erikj@740 286 $(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS))
erikj@740 287
erikj@740 288 # Makefile creation. Simply run configure in build dir.
erikj@740 289 $(bfdmakes) \
erikj@740 290 $(BUILDDIR)/$(binutils_ver)/Makefile \
erikj@740 291 : $(BINUTILS_CFG)
erikj@740 292 $(info Configuring $@. Log in $(@D)/log.config)
erikj@740 293 @mkdir -p $(@D)
erikj@740 294 ( \
erikj@740 295 cd $(@D) ; \
erikj@740 296 $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
erikj@740 297 $(BINUTILS_CFG) \
erikj@740 298 $(CONFIG) \
erikj@740 299 --with-sysroot=$(SYSROOT) \
erikj@740 300 --disable-nls \
erikj@740 301 --program-prefix=$(TARGET)- \
erikj@740 302 --enable-multilib \
erikj@740 303 ) > $(@D)/log.config 2>&1
erikj@740 304 @echo 'done'
erikj@740 305
erikj@740 306 $(BUILDDIR)/$(mpfr_ver)/Makefile \
erikj@740 307 : $(MPFR_CFG)
erikj@740 308 $(info Configuring $@. Log in $(@D)/log.config)
erikj@740 309 @mkdir -p $(@D)
erikj@740 310 ( \
erikj@740 311 cd $(@D) ; \
erikj@740 312 $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
erikj@740 313 $(MPFR_CFG) \
erikj@740 314 $(CONFIG) \
erikj@740 315 --program-prefix=$(TARGET)- \
erikj@740 316 --enable-shared=no \
erikj@740 317 --with-gmp=$(PREFIX) \
erikj@740 318 ) > $(@D)/log.config 2>&1
erikj@740 319 @echo 'done'
erikj@740 320
erikj@740 321 $(BUILDDIR)/$(gmp_ver)/Makefile \
erikj@740 322 : $(GMP_CFG)
erikj@740 323 $(info Configuring $@. Log in $(@D)/log.config)
erikj@740 324 @mkdir -p $(@D)
erikj@740 325 ( \
erikj@740 326 cd $(@D) ; \
erikj@740 327 $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
erikj@740 328 $(GMP_CFG) \
erikj@740 329 --host=$(HOST) --build=$(BUILD) \
erikj@740 330 --prefix=$(PREFIX) \
erikj@740 331 --disable-nls \
erikj@740 332 --program-prefix=$(TARGET)- \
erikj@740 333 --enable-shared=no \
erikj@740 334 --with-mpfr=$(PREFIX) \
erikj@740 335 ) > $(@D)/log.config 2>&1
erikj@740 336 @echo 'done'
erikj@740 337
erikj@740 338 $(BUILDDIR)/$(mpc_ver)/Makefile \
erikj@740 339 : $(MPC_CFG)
erikj@740 340 $(info Configuring $@. Log in $(@D)/log.config)
erikj@740 341 @mkdir -p $(@D)
erikj@740 342 ( \
erikj@740 343 cd $(@D) ; \
erikj@740 344 $(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \
erikj@740 345 $(MPC_CFG) \
erikj@740 346 $(CONFIG) \
erikj@740 347 --program-prefix=$(TARGET)- \
erikj@740 348 --enable-shared=no \
erikj@740 349 --with-mpfr=$(PREFIX) \
erikj@740 350 --with-gmp=$(PREFIX) \
erikj@740 351 ) > $(@D)/log.config 2>&1
erikj@740 352 @echo 'done'
erikj@740 353
erikj@740 354 # Only valid if glibc target -> linux
erikj@740 355 # proper destructor handling for c++
erikj@740 356 ifneq (,$(findstring linux,$(TARGET)))
erikj@740 357 $(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG += --enable-__cxa_atexit
erikj@740 358 endif
erikj@740 359
erikj@740 360 # Want:
erikj@740 361 # c,c++
erikj@740 362 # shared libs
erikj@740 363 # multilib (-m32/-m64 on x64)
erikj@740 364 # skip native language.
erikj@740 365 # and link and assemble with the binutils we created
erikj@740 366 # earlier, so --with-gnu*
erikj@740 367 $(BUILDDIR)/$(gcc_ver)/Makefile \
erikj@740 368 : $(GCC_CFG)
erikj@740 369 $(info Configuring $@. Log in $(@D)/log.config)
erikj@740 370 mkdir -p $(@D)
erikj@740 371 ( \
erikj@740 372 cd $(@D) ; \
erikj@740 373 $(PATHPRE) $(ENVS) $(GCC_CFG) $(EXTRA_CFLAGS) \
erikj@740 374 $(CONFIG) \
erikj@740 375 --with-sysroot=$(SYSROOT) \
erikj@740 376 --enable-languages=c,c++ \
erikj@740 377 --enable-shared \
erikj@740 378 --enable-multilib \
erikj@740 379 --disable-nls \
erikj@740 380 --with-gnu-as \
erikj@740 381 --with-gnu-ld \
erikj@740 382 --with-mpfr=$(PREFIX) \
erikj@740 383 --with-gmp=$(PREFIX) \
erikj@740 384 --with-mpc=$(PREFIX) \
erikj@740 385 ) > $(@D)/log.config 2>&1
erikj@740 386 @echo 'done'
erikj@740 387
erikj@740 388 # need binutils for gcc
erikj@740 389 $(gcc) : $(binutils)
erikj@740 390
erikj@740 391 # as of 4.3 or so need these for doing config
erikj@740 392 $(BUILDDIR)/$(gcc_ver)/Makefile : $(gmp) $(mpfr) $(mpc)
erikj@740 393 $(mpfr) : $(gmp)
erikj@740 394 $(mpc) : $(gmp) $(mpfr)
erikj@740 395
erikj@740 396 ##########################################################################################
erikj@740 397 # very straightforward. just build a ccache. it is only for host.
erikj@740 398 $(BUILDDIR)/$(ccache_ver)/Makefile \
erikj@740 399 : $(CCACHE_CFG)
erikj@740 400 $(info Configuring $@. Log in $(@D)/log.config)
erikj@740 401 @mkdir -p $(@D)
erikj@740 402 @( \
erikj@740 403 cd $(@D) ; \
erikj@740 404 $(PATHPRE) $(ENVS) $(CCACHE_CFG) \
erikj@740 405 $(CONFIG) \
erikj@740 406 ) > $(@D)/log.config 2>&1
erikj@740 407 @echo 'done'
erikj@740 408
erikj@740 409 gccpatch = $(TARGETDIR)/gcc-patched
erikj@740 410
erikj@740 411 ##########################################################################################
erikj@740 412 # For some reason cpp is not created as a target-compiler
erikj@740 413 ifeq ($(HOST),$(TARGET))
erikj@740 414 $(gccpatch) : $(gcc) link_libs
erikj@740 415 @echo -n 'Creating compiler symlinks...'
erikj@740 416 @for f in cpp; do \
erikj@740 417 if [ ! -e $(PREFIX)/bin/$(TARGET)-$$f ];\
erikj@740 418 then \
erikj@740 419 cd $(PREFIX)/bin && \
erikj@740 420 ln -s $$f $(TARGET)-$$f ; \
erikj@740 421 fi \
erikj@740 422 done
erikj@740 423 @touch $@
erikj@740 424 @echo 'done'
erikj@740 425
erikj@740 426 ##########################################################################################
erikj@740 427 # Ugly at best. Seems that when we compile host->host compiler, that are NOT
erikj@740 428 # the BUILD compiler, the result will not try searching for libs in package root.
erikj@740 429 # "Solve" this by create links from the target libdirs to where they are.
erikj@740 430 link_libs:
erikj@740 431 @echo -n 'Creating library symlinks...'
erikj@740 432 @$(foreach l,$(LIBDIRS), \
erikj@740 433 for f in `cd $(PREFIX)/$(l) && ls`; do \
erikj@740 434 if [ ! -e $(TARGETDIR)/$(l)/$$f ]; then \
erikj@740 435 mkdir -p $(TARGETDIR)/$(l) && \
erikj@740 436 cd $(TARGETDIR)/$(l)/ && \
erikj@740 437 ln -s $(if $(findstring /,$(l)),../,)../../$(l)/$$f $$f; \
erikj@740 438 fi \
erikj@740 439 done;)
erikj@740 440 @echo 'done'
erikj@740 441 else
erikj@740 442 $(gccpatch) :
erikj@740 443 @echo 'done'
erikj@740 444 endif
erikj@740 445
erikj@740 446 ##########################################################################################
erikj@740 447 # Build in two steps.
erikj@740 448 # make <default>
erikj@740 449 # make install.
erikj@740 450 # Use path to our build hosts cross tools
erikj@740 451 # Always need to build cross tools for build host self.
erikj@740 452 $(TARGETDIR)/%.done : $(BUILDDIR)/%/Makefile
erikj@740 453 $(info Building $(basename $@). Log in $(<D)/log.build)
erikj@740 454 $(PATHPRE) $(ENVS) $(MAKE) $(BUILDPAR) -f $< -C $(<D) $(MAKECMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.build 2>&1
erikj@740 455 @echo -n 'installing...'
erikj@740 456 $(PATHPRE) $(MAKE) $(INSTALLPAR) -f $< -C $(<D) $(INSTALLCMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.install 2>&1
erikj@740 457 @touch $@
erikj@740 458 @echo 'done'
erikj@740 459
erikj@740 460 ##########################################################################################
erikj@740 461
erikj@740 462 bfdlib : $(bfdlib)
erikj@740 463 binutils : $(binutils)
erikj@740 464 rpms : $(rpms)
erikj@740 465 libs : $(libs)
erikj@740 466 sysroot : rpms libs
erikj@740 467 gcc : sysroot $(gcc) $(gccpatch)
erikj@740 468 all : binutils gcc bfdlib
erikj@740 469
erikj@740 470 # this is only built for host. so separate.
erikj@740 471 ccache : $(ccache)
erikj@740 472
erikj@740 473 .PHONY : gcc all binutils bfdlib link_libs rpms libs sysroot

mercurial