scripts/scripts.mk
author Daniel Price <daniel.price@gmail.com>
Tue Nov 20 16:59:17 2012 -0800 (2012-11-20)
changeset 3126 333d3e40cbd1
parent 1618 7f52e1cca71e
permissions -rw-r--r--
scripts: refine static linking check to better guide the user

The current mechanism to check if static linking is possible, and the mesage
displayed on failure, can be puzzling to the unsuspecting user.

Also, the current implementation is not using the existing infrastructure,
and is thus difficult to enhance with new tests.

So, switch to using the standard CT_DoExecLog infra, and use four tests to
check for the host compiler:
- check we can run it
- check it can build a trivial program
- check it can statically link that program
- check if it statically link with libstdc++

That should cover most of the problems. Hopefully.

(At the same time, fix a typo in a comment)

Signed-off-by: Daniel Price <daniel.price@gmail.com>
[yann.morin.1998@free.fr: split original patch for self-contained changes]
[yann.morin.1998@free.fr: use steps to better see gcc's output]
[yann.morin.1998@free.fr: commit log]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <163f86b5216fc08c672a.1353459722@nipigon.dssd.com>
Patchwork-Id: 200536
     1 # Makefile for the scripts/ sub-directory
     2 
     3 # Here, we can update the config.* scripts.
     4 # If we're in CT_LIB_DIR, then CT_LIB_DIR == CT_TOP_DIR, and we can update those
     5 # scripts for later inclusion mainline. If CT_LIB_DIR != CT_TOP_DIR, then those
     6 # scripts are downloaded only for use in CT_TOP_DIR.
     7 
     8 # ----------------------------------------------------------
     9 # The tools help entry
    10 
    11 help-distrib::
    12 	@echo  '  updatetools        - Update the config tools'
    13 
    14 # ----------------------------------------------------------
    15 # Where to get tools from, and where to store them into
    16 # The tools are: config.guess and config.sub
    17 
    18 CONFIG_SUB_SRC="http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"
    19 CONFIG_SUB_DEST=scripts/config.sub
    20 CONFIG_GUESS_SRC="http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"
    21 CONFIG_GUESS_DEST=scripts/config.guess
    22 
    23 PHONY += updatetools
    24 updatetools: $(CONFIG_SUB_DEST) $(CONFIG_GUESS_DEST)
    25 
    26 # ----------------------------------------------------------
    27 # How to retrieve the tools
    28 
    29 wget_opt=-o /dev/null
    30 ifeq ($(strip $(V)),2)
    31   wget_opt=
    32 endif
    33 
    34 PHONY += scripts
    35 scripts:
    36 	@$(ECHO) '  MKDIR $@'
    37 	$(SILENT)mkdir -p $@
    38 
    39 $(CONFIG_SUB_DEST): scripts FORCE
    40 	@$(ECHO) '  WGET  $@'
    41 	$(SILENT)wget $(wget_opt) -O $@ $(CONFIG_SUB_SRC)
    42 	$(SILENT)chmod u+rwx,go+rx-w $@
    43 
    44 $(CONFIG_GUESS_DEST): scripts FORCE
    45 	@$(ECHO) '  WGET  $@'
    46 	$(SILENT)wget $(wget_opt) -O $@ $(CONFIG_GUESS_SRC)
    47 	$(SILENT)chmod u+rwx,go+rx-w $@
    48 
    49 # ----------------------------------------------------------
    50 # Clean up the mess
    51 
    52 distclean::
    53 	@$(ECHO) "  CLEAN scripts"
    54 	$(SILENT)[ $(CT_TOP_DIR) = $(CT_LIB_DIR) ] || rm -rf $(CT_TOP_DIR)/scripts