ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 17 23:06:02 2010 +0100 (2010-01-17)
changeset 1740 c57458bb354d
parent 1618 7f52e1cca71e
child 1876 a6a4beab3125
permissions -rw-r--r--
configure: do not require hg when configuring in an hg clone

When configuring in an hg clone, we need hg to compute the version string.
It can happen that users do not have Mercurial (eg. if they got a snapshot
rather that they did a full clone). In this case, we can still run, of
course, so simply fill the version string with a sufficiently explicit
value, that does not require hg. The date is a good candidate.
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@1667
    35
# GREP_OPTIONS=--color=always will break the generated .in files
yann@1667
    36
# We do not need any GREP_OPTIONS anyway, so set it to empty.
yann@1667
    37
export GREP_OPTIONS=
yann@1667
    38
yann@1155
    39
# Make the restart/stop steps availabe to scripts/crostool-NG.sh
yann@334
    40
export CT_STOP:=$(STOP)
yann@334
    41
export CT_RESTART:=$(RESTART)
yann@182
    42
yann@954
    43
SILENT=@
yann@954
    44
ECHO=echo
yann@954
    45
ifeq ($(strip $(origin V)),command line)
yann@940
    46
  ifeq ($(strip $(V)),0)
yann@940
    47
    SILENT=@
yann@940
    48
    ECHO=:
yann@940
    49
  else
yann@940
    50
    ifeq ($(strip $(V)),1)
yann@940
    51
      SILENT=
yann@940
    52
      ECHO=:
yann@953
    53
    else
yann@953
    54
      ifeq ($(strip $(V)),2)
yann@953
    55
        SILENT=
yann@953
    56
        ECHO=echo
yann@954
    57
      endif # V == 2
yann@954
    58
    endif # V== 1
yann@954
    59
  endif # V == 0
yann@954
    60
endif # origin V
yann@1008
    61
export V SILENT ECHO
yann@940
    62
yann@1618
    63
all: help
yann@1618
    64
yann@182
    65
.PHONY: $(PHONY)
yann@182
    66
PHONY += all
yann@1618
    67
FORCE:
yann@182
    68
yann@182
    69
# Help system
yann@229
    70
help:: help-head help-config help-samples help-build help-clean help-distrib help-env help-tail
yann@182
    71
yann@544
    72
help-head:: version
yann@544
    73
	@echo  'See below for a list of available actions, listed by category:'
yann@182
    74
yann@182
    75
help-config::
yann@182
    76
	@echo
yann@197
    77
	@echo  'Configuration actions:'
yann@182
    78
yann@182
    79
help-samples::
yann@182
    80
	@echo
yann@1024
    81
	@echo  'Preconfigured toolchains (#: force number of // jobs):'
yann@182
    82
yann@182
    83
help-build::
yann@182
    84
	@echo
yann@333
    85
	@echo  'Build actions (#: force number of // jobs):'
yann@182
    86
yann@229
    87
help-clean::
yann@229
    88
	@echo
yann@229
    89
	@echo  'Clean actions:'
yann@229
    90
yann@182
    91
help-distrib::
yann@182
    92
	@echo
yann@197
    93
	@echo  'Distribution actions:'
yann@182
    94
yann@182
    95
help-env::
yann@182
    96
	@echo
yann@182
    97
	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
yann@182
    98
yann@182
    99
help-tail::
yann@182
   100
	@echo
yann@932
   101
	@echo  'Use action "config" or "menuconfig" to configure crosstool-NG'
yann@932
   102
	@echo  'Use action "build" to build your toolchain'
yann@932
   103
	@echo  'Use action "version" to see the version'
yann@185
   104
	@echo  'See "man 1 ct-ng" for some help as well'
yann@182
   105
yann@182
   106
help-build::
yann@1024
   107
	@echo  '  build[.#]          - Build the currently configured toolchain'
yann@229
   108
yann@229
   109
help-clean::
yann@333
   110
	@echo  '  clean              - Remove generated files'
yann@333
   111
	@echo  '  distclean          - Remove generated files, configuration and build directories'
yann@182
   112
yann@945
   113
include $(CT_LIB_DIR)/config/config.mk
yann@261
   114
include $(CT_LIB_DIR)/kconfig/kconfig.mk
yann@333
   115
include $(CT_LIB_DIR)/steps.mk
yann@261
   116
include $(CT_LIB_DIR)/samples/samples.mk
yann@1101
   117
include $(CT_LIB_DIR)/scripts/scripts.mk
yann@182
   118
yann@1336
   119
help-config::
yann@1336
   120
	@echo  '  show-tuple         - Print the tuple of the currently configured toolchain'
yann@1336
   121
yann@182
   122
help-distrib::
yann@333
   123
	@echo  '  tarball            - Build a tarball of the configured toolchain'
yann@182
   124
yann@182
   125
help-env::
yann@182
   126
yann@940
   127
# End help system
yann@940
   128
yann@182
   129
.config:
yann@1336
   130
	@echo "There is no existing .config file!"
yann@1336
   131
	@echo "You need to either run 'menuconfig',"
yann@1336
   132
	@echo "or configure an existing sample."
yann@182
   133
	@false
yann@182
   134
yann@1336
   135
show-tuple: .config
yann@1336
   136
	$(SILENT)$(bash) $(CT_LIB_DIR)/scripts/showTuple.sh
yann@1336
   137
yann@182
   138
# Actual build
yann@372
   139
build: .config
yann@1143
   140
	$(SILENT)$(CT_LIB_DIR)/scripts/crosstool-NG.sh
yann@182
   141
yann@372
   142
build.%:
yann@1155
   143
	$(SILENT)$(MAKE) -rf $(CT_NG) $(shell echo "$(@)" |$(sed) -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
yann@333
   144
yann@182
   145
PHONY += tarball
yann@214
   146
#tarball:
yann@214
   147
#	@$(CT_LIB_DIR)/scripts/tarball.sh
yann@182
   148
tarball:
yann@940
   149
	@echo 'Tarball creation disabled for now... Sorry.'
yann@214
   150
	@true
yann@182
   151
yann@268
   152
PHONY += version
yann@268
   153
version:
yann@273
   154
	@echo 'This is crosstool-NG version $(CT_VERSION)'
yann@675
   155
	@echo
yann@675
   156
	@echo 'Copyright (C) 2008  Yann E. MORIN <yann.morin.1998@anciens.enib.fr>'
yann@675
   157
	@echo 'This is free software; see the source for copying conditions.'
yann@675
   158
	@echo 'There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A'
yann@675
   159
	@echo 'PARTICULAR PURPOSE.'
yann@931
   160
	@echo
yann@268
   161
yann@182
   162
PHONY += clean
yann@182
   163
clean::
yann@953
   164
	@$(ECHO) "  CLEAN log"
yann@953
   165
	$(SILENT)rm -f log.* .config.* ..config*
yann@182
   166
yann@182
   167
PHONY += distclean
yann@182
   168
distclean:: clean
yann@953
   169
	@$(ECHO) "  CLEAN .config"
yann@953
   170
	$(SILENT)rm -f .config .config.* ..config*
yann@940
   171
	@$(ECHO) "  CLEAN targets"
yann@940
   172
	$(SILENT)chmod -R u+w targets >/dev/null 2>&1 || true
yann@940
   173
	$(SILENT)rm -rf targets