ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Oct 27 18:42:26 2008 +0000 (2008-10-27)
changeset 1001 c8ac48ba1411
parent 953 edd62c121892
child 1008 0e6d7a8fdecc
permissions -rw-r--r--
Enhance the make fragments:
- comment the different parts
- re-order the code so that it is homogeneous amogst fragments
- eye-candy in some existing comments

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