ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Nov 10 19:32:11 2009 +0100 (2009-11-10)
changeset 1622 9ad2a3fd1fcc
parent 1336 bc8b9381f637
child 1667 a5020a1facff
permissions -rw-r--r--
scripts: output renumbered patches in a new directory

When renumbering patches, the original patches get removed and replaced
with the new ones. This can be annoying to loose the original patches.
Fix this by putting the new patchs in a directory of their own.
yann@1141
     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@1155
     9
# Don't go parallel
yann@1155
    10
.NOTPARALLEL:
yann@411
    11
yann@1144
    12
# This is where ct-ng is:
yann@1144
    13
export CT_NG:=$(lastword $(MAKEFILE_LIST))
yann@1144
    14
# and this is where we're working in:
yann@1144
    15
export CT_TOP_DIR:=$(shell pwd)
yann@1144
    16
yann@1144
    17
# Paths and values set by ./configure
yann@372
    18
# Don't bother to change it other than with a new ./configure!
yann@182
    19
export CT_LIB_DIR:=@@CT_LIBDIR@@
yann@182
    20
export CT_DOC_DIR:=@@CT_DOCDIR@@
yann@182
    21
yann@197
    22
# This is crosstool-NG version string
yann@543
    23
export CT_VERSION:=@@CT_VERSION@@
yann@182
    24
yann@1155
    25
# Paths found by ./configure
yann@1155
    26
include $(CT_LIB_DIR)/paths.mk
yann@953
    27
yann@1155
    28
# Some distributions (eg. Ubuntu) thought it wise to point /bin/sh to
yann@1155
    29
# a truly POSIX-conforming shell, ash in this case. This is not so good
yann@1155
    30
# as we, smart (haha!) developers (as smart we ourselves think we are),
yann@1155
    31
# got used to bashisms, and are enclined to easiness... So force use of
yann@1155
    32
# bash.
yann@1155
    33
export SHELL=$(bash)
yann@1155
    34
yann@1155
    35
# Make the restart/stop steps availabe to scripts/crostool-NG.sh
yann@334
    36
export CT_STOP:=$(STOP)
yann@334
    37
export CT_RESTART:=$(RESTART)
yann@182
    38
yann@954
    39
SILENT=@
yann@954
    40
ECHO=echo
yann@954
    41
ifeq ($(strip $(origin V)),command line)
yann@940
    42
  ifeq ($(strip $(V)),0)
yann@940
    43
    SILENT=@
yann@940
    44
    ECHO=:
yann@940
    45
  else
yann@940
    46
    ifeq ($(strip $(V)),1)
yann@940
    47
      SILENT=
yann@940
    48
      ECHO=:
yann@953
    49
    else
yann@953
    50
      ifeq ($(strip $(V)),2)
yann@953
    51
        SILENT=
yann@953
    52
        ECHO=echo
yann@954
    53
      endif # V == 2
yann@954
    54
    endif # V== 1
yann@954
    55
  endif # V == 0
yann@954
    56
endif # origin V
yann@1008
    57
export V SILENT ECHO
yann@940
    58
yann@1618
    59
all: help
yann@1618
    60
yann@182
    61
.PHONY: $(PHONY)
yann@182
    62
PHONY += all
yann@1618
    63
FORCE:
yann@182
    64
yann@182
    65
# Help system
yann@229
    66
help:: help-head help-config help-samples help-build help-clean help-distrib help-env help-tail
yann@182
    67
yann@544
    68
help-head:: version
yann@544
    69
	@echo  'See below for a list of available actions, listed by category:'
yann@182
    70
yann@182
    71
help-config::
yann@182
    72
	@echo
yann@197
    73
	@echo  'Configuration actions:'
yann@182
    74
yann@182
    75
help-samples::
yann@182
    76
	@echo
yann@1024
    77
	@echo  'Preconfigured toolchains (#: force number of // jobs):'
yann@182
    78
yann@182
    79
help-build::
yann@182
    80
	@echo
yann@333
    81
	@echo  'Build actions (#: force number of // jobs):'
yann@182
    82
yann@229
    83
help-clean::
yann@229
    84
	@echo
yann@229
    85
	@echo  'Clean actions:'
yann@229
    86
yann@182
    87
help-distrib::
yann@182
    88
	@echo
yann@197
    89
	@echo  'Distribution actions:'
yann@182
    90
yann@182
    91
help-env::
yann@182
    92
	@echo
yann@182
    93
	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
yann@182
    94
yann@182
    95
help-tail::
yann@182
    96
	@echo
yann@932
    97
	@echo  'Use action "config" or "menuconfig" to configure crosstool-NG'
yann@932
    98
	@echo  'Use action "build" to build your toolchain'
yann@932
    99
	@echo  'Use action "version" to see the version'
yann@185
   100
	@echo  'See "man 1 ct-ng" for some help as well'
yann@182
   101
yann@182
   102
help-build::
yann@1024
   103
	@echo  '  build[.#]          - Build the currently configured toolchain'
yann@229
   104
yann@229
   105
help-clean::
yann@333
   106
	@echo  '  clean              - Remove generated files'
yann@333
   107
	@echo  '  distclean          - Remove generated files, configuration and build directories'
yann@182
   108
yann@945
   109
include $(CT_LIB_DIR)/config/config.mk
yann@261
   110
include $(CT_LIB_DIR)/kconfig/kconfig.mk
yann@333
   111
include $(CT_LIB_DIR)/steps.mk
yann@261
   112
include $(CT_LIB_DIR)/samples/samples.mk
yann@1101
   113
include $(CT_LIB_DIR)/scripts/scripts.mk
yann@182
   114
yann@1336
   115
help-config::
yann@1336
   116
	@echo  '  show-tuple         - Print the tuple of the currently configured toolchain'
yann@1336
   117
yann@182
   118
help-distrib::
yann@333
   119
	@echo  '  tarball            - Build a tarball of the configured toolchain'
yann@182
   120
yann@182
   121
help-env::
yann@182
   122
yann@940
   123
# End help system
yann@940
   124
yann@182
   125
.config:
yann@1336
   126
	@echo "There is no existing .config file!"
yann@1336
   127
	@echo "You need to either run 'menuconfig',"
yann@1336
   128
	@echo "or configure an existing sample."
yann@182
   129
	@false
yann@182
   130
yann@1336
   131
show-tuple: .config
yann@1336
   132
	$(SILENT)$(bash) $(CT_LIB_DIR)/scripts/showTuple.sh
yann@1336
   133
yann@182
   134
# Actual build
yann@372
   135
build: .config
yann@1143
   136
	$(SILENT)$(CT_LIB_DIR)/scripts/crosstool-NG.sh
yann@182
   137
yann@372
   138
build.%:
yann@1155
   139
	$(SILENT)$(MAKE) -rf $(CT_NG) $(shell echo "$(@)" |$(sed) -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
yann@333
   140
yann@182
   141
PHONY += tarball
yann@214
   142
#tarball:
yann@214
   143
#	@$(CT_LIB_DIR)/scripts/tarball.sh
yann@182
   144
tarball:
yann@940
   145
	@echo 'Tarball creation disabled for now... Sorry.'
yann@214
   146
	@true
yann@182
   147
yann@268
   148
PHONY += version
yann@268
   149
version:
yann@273
   150
	@echo 'This is crosstool-NG version $(CT_VERSION)'
yann@675
   151
	@echo
yann@675
   152
	@echo 'Copyright (C) 2008  Yann E. MORIN <yann.morin.1998@anciens.enib.fr>'
yann@675
   153
	@echo 'This is free software; see the source for copying conditions.'
yann@675
   154
	@echo 'There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A'
yann@675
   155
	@echo 'PARTICULAR PURPOSE.'
yann@931
   156
	@echo
yann@268
   157
yann@182
   158
PHONY += clean
yann@182
   159
clean::
yann@953
   160
	@$(ECHO) "  CLEAN log"
yann@953
   161
	$(SILENT)rm -f log.* .config.* ..config*
yann@182
   162
yann@182
   163
PHONY += distclean
yann@182
   164
distclean:: clean
yann@953
   165
	@$(ECHO) "  CLEAN .config"
yann@953
   166
	$(SILENT)rm -f .config .config.* ..config*
yann@940
   167
	@$(ECHO) "  CLEAN targets"
yann@940
   168
	$(SILENT)chmod -R u+w targets >/dev/null 2>&1 || true
yann@940
   169
	$(SILENT)rm -rf targets