ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Sep 11 17:50:18 2007 +0000 (2007-09-11)
changeset 374 3538bcdf24cf
parent 348 9fcb5046b4b5
child 411 e0816bfc311b
permissions -rw-r--r--
Update credits to give adequate credit to Al Stone.
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@289
     6
MAKEFLAGS += --no-print-directory --no-builtin-rules
yann@182
     7
yann@372
     8
# This is where ct-ng is.
yann@372
     9
# Don't bother to change it other than with a new ./configure!
yann@372
    10
CT_NG:=@@CT_BINDIR@@/ct-ng
yann@182
    11
yann@182
    12
export CT_TOP_DIR:=$(shell pwd)
yann@182
    13
export CT_LIB_DIR:=@@CT_LIBDIR@@
yann@182
    14
export CT_DOC_DIR:=@@CT_DOCDIR@@
yann@182
    15
yann@197
    16
# This is crosstool-NG version string
yann@334
    17
export CT_VERSION:=$(shell cat $(CT_LIB_DIR)/.version)
yann@182
    18
yann@334
    19
export CT_STOP:=$(STOP)
yann@334
    20
export CT_RESTART:=$(RESTART)
yann@182
    21
yann@182
    22
.PHONY: $(PHONY)
yann@182
    23
PHONY += all
yann@197
    24
all: help
yann@182
    25
yann@284
    26
HOST_CC := gcc -funsigned-char
yann@182
    27
yann@182
    28
# Help system
yann@229
    29
help:: help-head help-config help-samples help-build help-clean help-distrib help-env help-tail
yann@182
    30
yann@182
    31
help-head::
yann@197
    32
	@echo  'Available actions:'
yann@182
    33
yann@182
    34
help-config::
yann@182
    35
	@echo
yann@197
    36
	@echo  'Configuration actions:'
yann@182
    37
yann@182
    38
help-samples::
yann@182
    39
	@echo
yann@229
    40
	@echo  'Preconfigured toolchains:'
yann@182
    41
yann@182
    42
help-build::
yann@182
    43
	@echo
yann@333
    44
	@echo  'Build actions (#: force number of // jobs):'
yann@182
    45
yann@229
    46
help-clean::
yann@229
    47
	@echo
yann@229
    48
	@echo  'Clean actions:'
yann@229
    49
yann@182
    50
help-distrib::
yann@182
    51
	@echo
yann@197
    52
	@echo  'Distribution actions:'
yann@182
    53
yann@182
    54
help-env::
yann@182
    55
	@echo
yann@182
    56
	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
yann@182
    57
yann@182
    58
help-tail::
yann@182
    59
	@echo
yann@197
    60
	@echo  'Execute "$(CT_NG) config" or "$(CT_NG) menuconfig" to configure crosstool-NG'
yann@197
    61
	@echo  'Execute "$(CT_NG) build" to build your toolchain'
yann@268
    62
	@echo  'Execute "$(CT_NG) version" to see the version'
yann@185
    63
	@echo  'See "man 1 ct-ng" for some help as well'
yann@182
    64
yann@182
    65
# End help system
yann@182
    66
yann@182
    67
help-build::
yann@333
    68
	@echo  '  build[.#]          - Build the toolchain'
yann@229
    69
yann@229
    70
help-clean::
yann@333
    71
	@echo  '  clean              - Remove generated files'
yann@333
    72
	@echo  '  distclean          - Remove generated files, configuration and build directories'
yann@182
    73
yann@261
    74
include $(CT_LIB_DIR)/kconfig/kconfig.mk
yann@333
    75
include $(CT_LIB_DIR)/steps.mk
yann@261
    76
include $(CT_LIB_DIR)/samples/samples.mk
yann@261
    77
include $(CT_LIB_DIR)/tools/tools.mk
yann@182
    78
yann@182
    79
help-distrib::
yann@333
    80
	@echo  '  tarball            - Build a tarball of the configured toolchain'
yann@182
    81
yann@182
    82
help-env::
yann@333
    83
	@echo  '  STOP               - Stop the build just after this step'
yann@333
    84
	@echo  '  RESTART            - Restart the build just before this step'
yann@182
    85
yann@182
    86
.config:
yann@182
    87
	@echo  'You must run either one of "$(CT_NG) config" or "$(CT_NG) menuconfig" first'
yann@182
    88
	@false
yann@182
    89
yann@182
    90
# Actual build
yann@372
    91
build: .config
yann@182
    92
	@$(CT_LIB_DIR)/scripts/crosstool.sh
yann@182
    93
yann@372
    94
build.%:
yann@333
    95
	@$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
yann@333
    96
yann@182
    97
PHONY += tarball
yann@214
    98
#tarball:
yann@214
    99
#	@$(CT_LIB_DIR)/scripts/tarball.sh
yann@182
   100
tarball:
yann@268
   101
	@echo 'Tarbal creation disabled for now... Sorry.'
yann@214
   102
	@true
yann@182
   103
yann@268
   104
PHONY += version
yann@268
   105
version:
yann@273
   106
	@echo 'This is crosstool-NG version $(CT_VERSION)'
yann@268
   107
yann@182
   108
PHONY += clean
yann@182
   109
clean::
yann@182
   110
	@rm -f $(CT_TOP_DIR)/.config.*
yann@182
   111
yann@182
   112
PHONY += distclean
yann@182
   113
distclean:: clean
yann@182
   114
	@rm -f $(CT_TOP_DIR)/.config* $(CT_TOP_DIR)/..config.tmp
yann@182
   115
	@rm -f $(CT_TOP_DIR)/log.*
yann@182
   116
	@[ ! -d "$(CT_TOP_DIR)/targets" ] || chmod -R u+w "$(CT_TOP_DIR)/targets"
yann@182
   117
	@rm -rf "$(CT_TOP_DIR)/targets"