Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset a0bb65af in mainline


Ignore:
Timestamp:
2011-05-20T01:04:24Z (11 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master
Children:
98e4507
Parents:
10a530cc
Message:

Added automatic download and extraction of binutils redistributable package.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/binutils/Makefile

    r10a530cc ra0bb65af  
    3030space = $(nullstring) # space
    3131
    32 # Symlink to the sources of the ported application.
    33 APP_DIR = ./src
     32# Information for obtaining specific binutils redistributable package.
     33# Might be subject to change in the future.
     34REDIST_VERSION = 2.21
     35REDIST_NAME = binutils-$(REDIST_VERSION)
     36REDIST_FILENAME = $(REDIST_NAME).tar.bz2
     37REDIST_SOURCE = ftp://ftp.gnu.org/gnu/binutils/
    3438
    35 # Default directory for the binutils source tree.
     39# Directory for the binutils source tree.
    3640REDIST_DIR = ./redist
    3741
    38 # Absolute path to the binutils source tree.
    39 # Can be set externally, defaults to $REDIST_DIR.
    40 BINUTILS_ABS_PATH ?= $(subst $(space),\ ,$(PWD))/$(REDIST_DIR)
     42# File to detect the presence of binutils source tree.
     43REDIST_DETECT = $(REDIST_DIR)/configure
    4144
    4245# $USPACE_PREFIX have to be based on the absolute path,
     
    9497
    9598# Patch native Makefile.common.
     99# Download and extract binutils.
    96100# Check presence of gcc compiler.
    97101# Patch $PATH to intercept toolchain calls.
    98102# Generate false toolchain.
    99 # Create symlink to the binutils directory.
    100103# Patch binutils.
    101104# Configure binutils for target architecture.
    102105# Make binutils.
    103106# Copy binaries.
    104 all: $(COMMON_MAKEFILE_PATCHED) all_
     107all: $(COMMON_MAKEFILE_PATCHED) all_ $(REDIST_FILENAME) $(REDIST_DETECT)
    105108ifeq ($(COMPILER),$(findstring $(COMPILER),$(SUPPORTED_COMPILERS)))
    106109        OLDPATH = $(PATH)
     
    115118        ./toolchain.sh objcopy $(OBJCOPY)
    116119        ./toolchain.sh strip $(STRIP)
    117         ln -s -T $(BINUTILS_ABS_PATH) $(APP_DIR)
    118         ./intrusive.sh do $(APP_DIR)
     120        ./intrusive.sh do $(REDIST_DIR)
    119121        ORIG_DIR = $(subst $(space),\ ,$(PWD))
    120         cd $(APP_DIR)
     122        cd $(REDIST_DIR)
    121123        ./configure --target=$(TARGET) $(CONF_FLAGS)
    122124        make $(MAKE_TARGETS)
    123125        cd $(ORIG_DIR)
    124         cp $(APP_DIR)/gas/as-new ./as
    125         cp $(APP_DIR)/ld/ld-new ./ld
     126        cp $(REDIST_DIR)/gas/as-new ./as
     127        cp $(REDIST_DIR)/ld/ld-new ./ld
    126128        PATH = $(OLDPATH)
    127129        export PATH
     
    134136        awk -f $^ > $@
    135137
     138# Download binutils redistributable package.
     139$(REDIST_FILENAME):
     140        wget -c $(REDIST_SOURCE)$(REDIST_FILENAME)
     141
     142# Extract binutils source tree.
     143$(REDIST_DETECT): $(REDIST_FILENAME)
     144        tar -x -j -f $<
     145        mv -f $(REDIST_NAME) $(REDIST_DIR)
     146
    136147# Delete binaries.
    137148# Clean binutils.
    138149# Unpatch binutils.
    139 # Delete symlink
    140150# Delete generated scripts.
    141151clean:
    142152        rm -f as ld
    143153        ORIG_DIR = $(subst $(space),\ ,$(PWD))
    144         cd $(APP_DIR)
     154        cd $(REDIST_DIR)
    145155        make distclean
    146156        cd $(ORIG_DIR)
    147         ./intrusive.sh undo $(APP_DIR)
    148         rm -f $(APP_DIR)
     157        ./intrusive.sh undo $(REDIST_DIR)
    149158        rm -f gcc as ar ranlib ld objdump objcopy strip
    150159        rm -f $(COMMON_MAKEFILE_PATCHED)
Note: See TracChangeset for help on using the changeset viewer.