ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Oct 18 18:37:28 2008 +0000 (2008-10-18)
changeset 945 d0e5f04d2e06
parent 943 1cca90ce0481
child 953 edd62c121892
permissions -rw-r--r--
Extract the config files related stuff from the kconfig stuff
- create config/config.mk, with all the config.gen/ rules
- the only common points between config files and configurators:
- the top-level config file to include, stored in KCONFIG_TOP
- the config_file rules, which makes config files available to configurators
- dependency-files are renamed from %.d to %.dep (.d is reserved for directories)
- a few eye-candy here and there

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