ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Oct 21 16:13:46 2008 +0000 (2008-10-21)
changeset 953 edd62c121892
parent 945 d0e5f04d2e06
child 954 a9e7de970e5e
permissions -rw-r--r--
Eye-candy when {,dist}clean.

/trunk/tools/tools.mk | 1 1 0 0 +
/trunk/ct-ng.in | 16 12 4 0 ++++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
     1 #!@@CT_MAKE@@ -rf
     2 # Makefile for crosstool-NG.
     3 # Copyright 2006 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
     4 
     5 # Don't print directory as we descend into them
     6 # Don't use built-in rules, we know what we're doing
     7 MAKEFLAGS += --no-print-directory --no-builtin-rules
     8 
     9 # Some distributions (eg. Ubuntu) thought it wise to point /bin/sh to
    10 # a truly POSIX-conforming shell, ash in this case. This is not so good
    11 # as we, smart (haha!) developers (as smart we ourselves think we are),
    12 # got used to bashisms, and are enclined to easiness... So force use of
    13 # bash. (Note: this is ugly, but ./configure checks for it).
    14 export SHELL=/bin/bash
    15 
    16 # This is where ct-ng is.
    17 # Don't bother to change it other than with a new ./configure!
    18 CT_NG:=@@CT_BINDIR@@/ct-ng
    19 
    20 export CT_TOP_DIR:=$(shell pwd)
    21 export CT_LIB_DIR:=@@CT_LIBDIR@@
    22 export CT_DOC_DIR:=@@CT_DOCDIR@@
    23 
    24 # This is crosstool-NG version string
    25 export CT_VERSION:=@@CT_VERSION@@
    26 
    27 # Don't go parallel
    28 .NOTPARALLEL:
    29 
    30 export CT_STOP:=$(STOP)
    31 export CT_RESTART:=$(RESTART)
    32 
    33 ifeq ($(strip $(V)),)
    34   SILENT=@
    35   ECHO=echo
    36 else
    37   ifeq ($(strip $(V)),0)
    38     SILENT=@
    39     ECHO=:
    40   else
    41     ifeq ($(strip $(V)),1)
    42       SILENT=
    43       ECHO=:
    44     else
    45       ifeq ($(strip $(V)),2)
    46         SILENT=
    47         ECHO=echo
    48       endif
    49     endif
    50   endif
    51 endif
    52 export V
    53 
    54 .FORCE:
    55 .PHONY: $(PHONY)
    56 PHONY += all
    57 all: help
    58 
    59 # Help system
    60 help:: help-head help-config help-samples help-build help-clean help-distrib help-env help-tail
    61 
    62 help-head:: version
    63 	@echo  'See below for a list of available actions, listed by category:'
    64 
    65 help-config::
    66 	@echo
    67 	@echo  'Configuration actions:'
    68 
    69 help-samples::
    70 	@echo
    71 	@echo  'Preconfigured toolchains:'
    72 
    73 help-build::
    74 	@echo
    75 	@echo  'Build actions (#: force number of // jobs):'
    76 
    77 help-clean::
    78 	@echo
    79 	@echo  'Clean actions:'
    80 
    81 help-distrib::
    82 	@echo
    83 	@echo  'Distribution actions:'
    84 
    85 help-env::
    86 	@echo
    87 	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
    88 
    89 help-tail::
    90 	@echo
    91 	@echo  'Use action "config" or "menuconfig" to configure crosstool-NG'
    92 	@echo  'Use action "build" to build your toolchain'
    93 	@echo  'Use action "version" to see the version'
    94 	@echo  'See "man 1 ct-ng" for some help as well'
    95 
    96 help-build::
    97 	@echo  '  build[.#]          - Build the toolchain'
    98 
    99 help-clean::
   100 	@echo  '  clean              - Remove generated files'
   101 	@echo  '  distclean          - Remove generated files, configuration and build directories'
   102 
   103 include $(CT_LIB_DIR)/config/config.mk
   104 include $(CT_LIB_DIR)/kconfig/kconfig.mk
   105 include $(CT_LIB_DIR)/steps.mk
   106 include $(CT_LIB_DIR)/samples/samples.mk
   107 include $(CT_LIB_DIR)/tools/tools.mk
   108 
   109 help-distrib::
   110 	@echo  '  tarball            - Build a tarball of the configured toolchain'
   111 
   112 help-env::
   113 	@echo  '  STOP               - Stop the build just after this step'
   114 	@echo  '  RESTART            - Restart the build just before this step'
   115 
   116 # End help system
   117 
   118 .config:
   119 	@echo ' There is no existing .config file!'
   120 	@false
   121 
   122 # Actual build
   123 build: .config
   124 	$(SILENT)$(CT_LIB_DIR)/scripts/crosstool.sh
   125 
   126 build.%:
   127 	$(SILENT)$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
   128 
   129 PHONY += tarball
   130 #tarball:
   131 #	@$(CT_LIB_DIR)/scripts/tarball.sh
   132 tarball:
   133 	@echo 'Tarball creation disabled for now... Sorry.'
   134 	@true
   135 
   136 PHONY += version
   137 version:
   138 	@echo 'This is crosstool-NG version $(CT_VERSION)'
   139 	@echo
   140 	@echo 'Copyright (C) 2008  Yann E. MORIN <yann.morin.1998@anciens.enib.fr>'
   141 	@echo 'This is free software; see the source for copying conditions.'
   142 	@echo 'There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A'
   143 	@echo 'PARTICULAR PURPOSE.'
   144 	@echo
   145 
   146 PHONY += clean
   147 clean::
   148 	@$(ECHO) "  CLEAN log"
   149 	$(SILENT)rm -f log.* .config.* ..config*
   150 
   151 PHONY += distclean
   152 distclean:: clean
   153 	@$(ECHO) "  CLEAN .config"
   154 	$(SILENT)rm -f .config .config.* ..config*
   155 	@$(ECHO) "  CLEAN targets"
   156 	$(SILENT)chmod -R u+w targets >/dev/null 2>&1 || true
   157 	$(SILENT)rm -rf targets