ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Feb 17 22:08:06 2008 +0000 (2008-02-17)
changeset 431 8bde4c6ea47a
parent 372 f635b165bf18
child 543 1df70ed4510d
permissions -rw-r--r--
Robert P. J. DAY says:

apparently, the patchset for gcc 4.2.1 applies properly to the
source for gcc 4.2.2 and gcc 4.2.3. so, if you want, you can simply
add support for those last two just by augmenting menuconfig and
adding a couple symlinks for those two directories. seems like a
cheap way to add a couple new versions.
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@334
    25
export CT_VERSION:=$(shell cat $(CT_LIB_DIR)/.version)
yann@182
    26
yann@334
    27
export CT_STOP:=$(STOP)
yann@334
    28
export CT_RESTART:=$(RESTART)
yann@182
    29
yann@182
    30
.PHONY: $(PHONY)
yann@182
    31
PHONY += all
yann@197
    32
all: help
yann@182
    33
yann@284
    34
HOST_CC := gcc -funsigned-char
yann@182
    35
yann@182
    36
# Help system
yann@229
    37
help:: help-head help-config help-samples help-build help-clean help-distrib help-env help-tail
yann@182
    38
yann@182
    39
help-head::
yann@197
    40
	@echo  'Available actions:'
yann@182
    41
yann@182
    42
help-config::
yann@182
    43
	@echo
yann@197
    44
	@echo  'Configuration actions:'
yann@182
    45
yann@182
    46
help-samples::
yann@182
    47
	@echo
yann@229
    48
	@echo  'Preconfigured toolchains:'
yann@182
    49
yann@182
    50
help-build::
yann@182
    51
	@echo
yann@333
    52
	@echo  'Build actions (#: force number of // jobs):'
yann@182
    53
yann@229
    54
help-clean::
yann@229
    55
	@echo
yann@229
    56
	@echo  'Clean actions:'
yann@229
    57
yann@182
    58
help-distrib::
yann@182
    59
	@echo
yann@197
    60
	@echo  'Distribution actions:'
yann@182
    61
yann@182
    62
help-env::
yann@182
    63
	@echo
yann@182
    64
	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
yann@182
    65
yann@182
    66
help-tail::
yann@182
    67
	@echo
yann@197
    68
	@echo  'Execute "$(CT_NG) config" or "$(CT_NG) menuconfig" to configure crosstool-NG'
yann@197
    69
	@echo  'Execute "$(CT_NG) build" to build your toolchain'
yann@268
    70
	@echo  'Execute "$(CT_NG) version" to see the version'
yann@185
    71
	@echo  'See "man 1 ct-ng" for some help as well'
yann@182
    72
yann@182
    73
# End help system
yann@182
    74
yann@182
    75
help-build::
yann@333
    76
	@echo  '  build[.#]          - Build the toolchain'
yann@229
    77
yann@229
    78
help-clean::
yann@333
    79
	@echo  '  clean              - Remove generated files'
yann@333
    80
	@echo  '  distclean          - Remove generated files, configuration and build directories'
yann@182
    81
yann@261
    82
include $(CT_LIB_DIR)/kconfig/kconfig.mk
yann@333
    83
include $(CT_LIB_DIR)/steps.mk
yann@261
    84
include $(CT_LIB_DIR)/samples/samples.mk
yann@261
    85
include $(CT_LIB_DIR)/tools/tools.mk
yann@182
    86
yann@182
    87
help-distrib::
yann@333
    88
	@echo  '  tarball            - Build a tarball of the configured toolchain'
yann@182
    89
yann@182
    90
help-env::
yann@333
    91
	@echo  '  STOP               - Stop the build just after this step'
yann@333
    92
	@echo  '  RESTART            - Restart the build just before this step'
yann@182
    93
yann@182
    94
.config:
yann@182
    95
	@echo  'You must run either one of "$(CT_NG) config" or "$(CT_NG) menuconfig" first'
yann@182
    96
	@false
yann@182
    97
yann@182
    98
# Actual build
yann@372
    99
build: .config
yann@182
   100
	@$(CT_LIB_DIR)/scripts/crosstool.sh
yann@182
   101
yann@372
   102
build.%:
yann@333
   103
	@$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
yann@333
   104
yann@182
   105
PHONY += tarball
yann@214
   106
#tarball:
yann@214
   107
#	@$(CT_LIB_DIR)/scripts/tarball.sh
yann@182
   108
tarball:
yann@268
   109
	@echo 'Tarbal creation disabled for now... Sorry.'
yann@214
   110
	@true
yann@182
   111
yann@268
   112
PHONY += version
yann@268
   113
version:
yann@273
   114
	@echo 'This is crosstool-NG version $(CT_VERSION)'
yann@268
   115
yann@182
   116
PHONY += clean
yann@182
   117
clean::
yann@182
   118
	@rm -f $(CT_TOP_DIR)/.config.*
yann@182
   119
yann@182
   120
PHONY += distclean
yann@182
   121
distclean:: clean
yann@182
   122
	@rm -f $(CT_TOP_DIR)/.config* $(CT_TOP_DIR)/..config.tmp
yann@182
   123
	@rm -f $(CT_TOP_DIR)/log.*
yann@182
   124
	@[ ! -d "$(CT_TOP_DIR)/targets" ] || chmod -R u+w "$(CT_TOP_DIR)/targets"
yann@182
   125
	@rm -rf "$(CT_TOP_DIR)/targets"