Changeset 2431f30 in mainline for uspace/app/binutils/Makefile


Ignore:
Timestamp:
2011-06-13T01:32:54Z (14 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c1198c2
Parents:
df56f5c
Message:

Build process debugged and improved.
Added intrusive patches to pass configure scripts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/binutils/Makefile

    rdf56f5c r2431f30  
    4646# because targets derived from it will be referenced from
    4747# other than the current directory.
    48 USPACE_PREFIX = $(subst $(space),\ ,$(PWD))/../..
     48USPACE_PREFIX = $(subst $(space),\ ,$(shell pwd))/../..
    4949
    5050# Ensure static configuration of Makefile.common.
     
    7070
    7171# Patch $PATH to intercept toolchain calls.
    72 PATH := $(PWD):$(PATH)
     72PATH := $(shell pwd):$(PATH)
     73export PATH
    7374
    7475# Shell script for false toolchain generation.
     
    8990# Map the HelenOS target to binutils target.
    9091ifeq ($(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
     92TARGET = amd64-linux-gnu
     93endif
     94ifeq ($(PLATFORM),arm32)
     95TARGET = arm-linux-gnu
     96endif
     97ifeq ($(PLATFORM),ia32)
     98TARGET = i686-pc-linux-gnu
     99endif
     100ifeq ($(PLATFORM),ia64)
     101TARGET = ia64-pc-linux-gnu
     102endif
     103ifeq ($(PLATFORM),mips32)
     104TARGET = mipsel-linux-gnu
     105endif
     106ifeq ($(PLATFORM),mips32eb)
     107TARGET = mips-linux-gnu
     108endif
     109ifeq ($(PLATFORM),mips64)
     110TARGET = mips64el-linux-gnu
     111endif
     112ifeq ($(PLATFORM),ppc32)
     113TARGET = ppc-linux-gnu
     114endif
     115ifeq ($(PLATFORM),ppc64)
     116TARGET = ppc64-linux-gnu
     117endif
     118ifeq ($(PLATFORM),sparc64)
     119TARGET = sparc64-linux-gnu
    110120endif
    111121
    112122# Binutils configure flags.
    113123CONF_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
    115126
    116127# Binutils make targets.
     
    123134all: $(COMMON_MAKEFILE_PATCHED) all_ $(TOOLCHAIN) $(BINUTILS_PATCHED) \
    124135                $(BINUTILS_CONFIGURED) $(REDIST_DETECT)
    125         export PATH
    126136        make -C $(REDIST_DIR) $(MAKE_TARGETS)
    127137        cp -f $(REDIST_DIR)/gas/as-new ./as
     
    143153$(REDIST_DETECT): $(REDIST_FILENAME)
    144154        tar -x -j -f $<
    145         mv -f $(REDIST_NAME) $(REDIST_DIR)
     155        mv -f -T $(REDIST_NAME) $(REDIST_DIR)
     156        touch $@
    146157
    147158# Generate false toolchain scripts.
    148159$(TOOLCHAIN): $(TOOLCHAIN_SCRIPT)
    149         $^ gcc $(CC) '$(CFLAGS)'
    150         $^ as $(AS)
    151         $^ ar $(AR)
    152         $^ ranlib
    153         $^ 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)
    157168
    158169# Patch binutils source tree.
    159170$(BINUTILS_PATCHED): $(BINUTILS_PATCH) $(REDIST_DETECT)
    160         $^ do $(REDIST_DIR)
     171        ./$< do $(REDIST_DIR)
    161172        touch $@
    162173
    163174# Configure binutils.
     175# $LD variable have to exported to override configure script caching.
    164176$(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)
    166180
    167181# Delete binaries.
     
    169183# Unpatch binutils.
    170184# Delete generated scripts.
    171 clean: $(BINUTILS_PATCH)
     185clean: $(BINUTILS_PATCH) clean_
    172186        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; \
    175189        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); \
    179193        fi
    180194        rm -f $(TOOLCHAIN)
Note: See TracChangeset for help on using the changeset viewer.