ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Sep 04 17:27:16 2009 +0200 (2009-09-04)
changeset 1512 439a6b292917
parent 1155 21e86e18f344
child 1618 7f52e1cca71e
permissions -rw-r--r--
TODO: update

Add TODO list for m4, autoconf, automake and libtool.
Building our own versions would remove burden from the users
who have older versions on their distributions, and are not
ready/able/allowed to upgrade.
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@1101
    59
.FORCE: $(FORCE)
yann@182
    60
.PHONY: $(PHONY)
yann@182
    61
PHONY += all
yann@197
    62
all: help
yann@182
    63
yann@182
    64
# Help system
yann@229
    65
help:: help-head help-config help-samples help-build help-clean help-distrib help-env help-tail
yann@182
    66
yann@544
    67
help-head:: version
yann@544
    68
	@echo  'See below for a list of available actions, listed by category:'
yann@182
    69
yann@182
    70
help-config::
yann@182
    71
	@echo
yann@197
    72
	@echo  'Configuration actions:'
yann@182
    73
yann@182
    74
help-samples::
yann@182
    75
	@echo
yann@1024
    76
	@echo  'Preconfigured toolchains (#: force number of // jobs):'
yann@182
    77
yann@182
    78
help-build::
yann@182
    79
	@echo
yann@333
    80
	@echo  'Build actions (#: force number of // jobs):'
yann@182
    81
yann@229
    82
help-clean::
yann@229
    83
	@echo
yann@229
    84
	@echo  'Clean actions:'
yann@229
    85
yann@182
    86
help-distrib::
yann@182
    87
	@echo
yann@197
    88
	@echo  'Distribution actions:'
yann@182
    89
yann@182
    90
help-env::
yann@182
    91
	@echo
yann@182
    92
	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
yann@182
    93
yann@182
    94
help-tail::
yann@182
    95
	@echo
yann@932
    96
	@echo  'Use action "config" or "menuconfig" to configure crosstool-NG'
yann@932
    97
	@echo  'Use action "build" to build your toolchain'
yann@932
    98
	@echo  'Use action "version" to see the version'
yann@185
    99
	@echo  'See "man 1 ct-ng" for some help as well'
yann@182
   100
yann@182
   101
help-build::
yann@1024
   102
	@echo  '  build[.#]          - Build the currently configured toolchain'
yann@229
   103
yann@229
   104
help-clean::
yann@333
   105
	@echo  '  clean              - Remove generated files'
yann@333
   106
	@echo  '  distclean          - Remove generated files, configuration and build directories'
yann@182
   107
yann@945
   108
include $(CT_LIB_DIR)/config/config.mk
yann@261
   109
include $(CT_LIB_DIR)/kconfig/kconfig.mk
yann@333
   110
include $(CT_LIB_DIR)/steps.mk
yann@261
   111
include $(CT_LIB_DIR)/samples/samples.mk
yann@1101
   112
include $(CT_LIB_DIR)/scripts/scripts.mk
yann@182
   113
yann@1336
   114
help-config::
yann@1336
   115
	@echo  '  show-tuple         - Print the tuple of the currently configured toolchain'
yann@1336
   116
yann@182
   117
help-distrib::
yann@333
   118
	@echo  '  tarball            - Build a tarball of the configured toolchain'
yann@182
   119
yann@182
   120
help-env::
yann@182
   121
yann@940
   122
# End help system
yann@940
   123
yann@182
   124
.config:
yann@1336
   125
	@echo "There is no existing .config file!"
yann@1336
   126
	@echo "You need to either run 'menuconfig',"
yann@1336
   127
	@echo "or configure an existing sample."
yann@182
   128
	@false
yann@182
   129
yann@1336
   130
show-tuple: .config
yann@1336
   131
	$(SILENT)$(bash) $(CT_LIB_DIR)/scripts/showTuple.sh
yann@1336
   132
yann@182
   133
# Actual build
yann@372
   134
build: .config
yann@1143
   135
	$(SILENT)$(CT_LIB_DIR)/scripts/crosstool-NG.sh
yann@182
   136
yann@372
   137
build.%:
yann@1155
   138
	$(SILENT)$(MAKE) -rf $(CT_NG) $(shell echo "$(@)" |$(sed) -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
yann@333
   139
yann@182
   140
PHONY += tarball
yann@214
   141
#tarball:
yann@214
   142
#	@$(CT_LIB_DIR)/scripts/tarball.sh
yann@182
   143
tarball:
yann@940
   144
	@echo 'Tarball creation disabled for now... Sorry.'
yann@214
   145
	@true
yann@182
   146
yann@268
   147
PHONY += version
yann@268
   148
version:
yann@273
   149
	@echo 'This is crosstool-NG version $(CT_VERSION)'
yann@675
   150
	@echo
yann@675
   151
	@echo 'Copyright (C) 2008  Yann E. MORIN <yann.morin.1998@anciens.enib.fr>'
yann@675
   152
	@echo 'This is free software; see the source for copying conditions.'
yann@675
   153
	@echo 'There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A'
yann@675
   154
	@echo 'PARTICULAR PURPOSE.'
yann@931
   155
	@echo
yann@268
   156
yann@182
   157
PHONY += clean
yann@182
   158
clean::
yann@953
   159
	@$(ECHO) "  CLEAN log"
yann@953
   160
	$(SILENT)rm -f log.* .config.* ..config*
yann@182
   161
yann@182
   162
PHONY += distclean
yann@182
   163
distclean:: clean
yann@953
   164
	@$(ECHO) "  CLEAN .config"
yann@953
   165
	$(SILENT)rm -f .config .config.* ..config*
yann@940
   166
	@$(ECHO) "  CLEAN targets"
yann@940
   167
	$(SILENT)chmod -R u+w targets >/dev/null 2>&1 || true
yann@940
   168
	$(SILENT)rm -rf targets