ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Oct 15 21:29:56 2008 +0000 (2008-10-15)
changeset 940 f0f9ba3f98f2
parent 932 264d38e5b5ba
child 941 a00f5d821024
permissions -rw-r--r--
Cheesy kconfig stuff:
- silent/quiet/verbose build:
- ct-ng by default only prints quit messages, such as "CC xxx",
- if using V=0, nothing is printed,
- if using V=1, the full command lines are printed,
- other values are indeterminate,
- should help in debugging the kconfig stuff;
- complete kconfig/{,m}conf generation:
- fully dynamic dependencies on source files,
- compilation of .c into .o, then linking (instead of direct linking),
- VPATH usage when not --local;
Typo + a coment moved.

/trunk/kconfig/kconfig.mk | 140 87 53 0 +++++++++++++++++++++++++++++++++--------------------
/trunk/tools/tools.mk | 12 6 6 0 ++--
/trunk/steps.mk | 6 3 3 0 +-
/trunk/samples/samples.mk | 30 15 15 0 +++++-----
/trunk/ct-ng.in | 40 28 12 0 +++++++++++----
5 files changed, 139 insertions(+), 89 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 export CT_STOP:=$(STOP)
    28 export CT_RESTART:=$(RESTART)
    29 
    30 ifeq ($(strip $(V)),)
    31   SILENT=@
    32   ECHO=echo
    33 else
    34   ifeq ($(strip $(V)),0)
    35     SILENT=@
    36     ECHO=:
    37   else
    38     ifeq ($(strip $(V)),1)
    39       SILENT=
    40       ECHO=:
    41     endif)
    42   endif
    43 endif
    44 export V
    45 
    46 .FORCE:
    47 .PHONY: $(PHONY)
    48 PHONY += all
    49 all: help
    50 
    51 # Help system
    52 help:: help-head help-config help-samples help-build help-clean help-distrib help-env help-tail
    53 
    54 help-head:: version
    55 	@echo  'See below for a list of available actions, listed by category:'
    56 
    57 help-config::
    58 	@echo
    59 	@echo  'Configuration actions:'
    60 
    61 help-samples::
    62 	@echo
    63 	@echo  'Preconfigured toolchains:'
    64 
    65 help-build::
    66 	@echo
    67 	@echo  'Build actions (#: force number of // jobs):'
    68 
    69 help-clean::
    70 	@echo
    71 	@echo  'Clean actions:'
    72 
    73 help-distrib::
    74 	@echo
    75 	@echo  'Distribution actions:'
    76 
    77 help-env::
    78 	@echo
    79 	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
    80 
    81 help-tail::
    82 	@echo
    83 	@echo  'Use action "config" or "menuconfig" to configure crosstool-NG'
    84 	@echo  'Use action "build" to build your toolchain'
    85 	@echo  'Use action "version" to see the version'
    86 	@echo  'See "man 1 ct-ng" for some help as well'
    87 
    88 help-build::
    89 	@echo  '  build[.#]          - Build the toolchain'
    90 
    91 help-clean::
    92 	@echo  '  clean              - Remove generated files'
    93 	@echo  '  distclean          - Remove generated files, configuration and build directories'
    94 
    95 include $(CT_LIB_DIR)/kconfig/kconfig.mk
    96 include $(CT_LIB_DIR)/steps.mk
    97 include $(CT_LIB_DIR)/samples/samples.mk
    98 include $(CT_LIB_DIR)/tools/tools.mk
    99 
   100 help-distrib::
   101 	@echo  '  tarball            - Build a tarball of the configured toolchain'
   102 
   103 help-env::
   104 	@echo  '  STOP               - Stop the build just after this step'
   105 	@echo  '  RESTART            - Restart the build just before this step'
   106 
   107 # End help system
   108 
   109 .config:
   110 	@echo  'You must run either one of "$(CT_NG) config" or "$(CT_NG) menuconfig" first'
   111 	@false
   112 
   113 # Actual build
   114 build: .config
   115 	$(SILENT)$(CT_LIB_DIR)/scripts/crosstool.sh
   116 
   117 build.%:
   118 	$(SILENT)$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
   119 
   120 PHONY += tarball
   121 #tarball:
   122 #	@$(CT_LIB_DIR)/scripts/tarball.sh
   123 tarball:
   124 	@echo 'Tarball creation disabled for now... Sorry.'
   125 	@true
   126 
   127 PHONY += version
   128 version:
   129 	@echo 'This is crosstool-NG version $(CT_VERSION)'
   130 	@echo
   131 	@echo 'Copyright (C) 2008  Yann E. MORIN <yann.morin.1998@anciens.enib.fr>'
   132 	@echo 'This is free software; see the source for copying conditions.'
   133 	@echo 'There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A'
   134 	@echo 'PARTICULAR PURPOSE.'
   135 	@echo
   136 
   137 PHONY += clean
   138 clean::
   139 	$(SILENT)rm -f .config.*
   140 
   141 PHONY += distclean
   142 distclean:: clean
   143 	@$(ECHO) "  CLEAN .config log"
   144 	$(SILENT)rm -f .config* ..config.tmp
   145 	$(SILENT)rm -f log.*
   146 	@$(ECHO) "  CLEAN targets"
   147 	$(SILENT)chmod -R u+w targets >/dev/null 2>&1 || true
   148 	$(SILENT)rm -rf targets