Fix restoring the environment.
2 # Makefile for crosstool-NG.
3 # Copyright 2006 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
5 # Don't print directory as we descend into them
6 MAKEFLAGS += --no-print-directory --no-builtin-rules
8 # Remember the name of the Makefile
9 CT_MAKEFILE := $(lastword $(MAKEFILE_LIST))
10 CT_NG := $(shell echo '$(CT_MAKEFILE)' |sed -r -e 's,($(subst :,|,$(PATH)))/,,;')
12 export CT_TOP_DIR:=$(shell pwd)
13 export CT_LIB_DIR:=@@CT_LIBDIR@@
14 export CT_DOC_DIR:=@@CT_DOCDIR@@
16 # This is crosstool-NG version string
17 export CT_VERSION:=$(shell cat $(CT_LIB_DIR)/.version)
19 export CT_STOP:=$(STOP)
20 export CT_RESTART:=$(RESTART)
26 HOST_CC := gcc -funsigned-char
29 help:: help-head help-config help-samples help-build help-clean help-distrib help-env help-tail
32 @echo 'Available actions:'
36 @echo 'Configuration actions:'
40 @echo 'Preconfigured toolchains:'
44 @echo 'Build actions (#: force number of // jobs):'
48 @echo 'Clean actions:'
52 @echo 'Distribution actions:'
56 @echo 'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
60 @echo 'Execute "$(CT_NG) config" or "$(CT_NG) menuconfig" to configure crosstool-NG'
61 @echo 'Execute "$(CT_NG) build" to build your toolchain'
62 @echo 'Execute "$(CT_NG) version" to see the version'
63 @echo 'See "man 1 ct-ng" for some help as well'
68 @echo ' build[.#] - Build the toolchain'
71 @echo ' clean - Remove generated files'
72 @echo ' distclean - Remove generated files, configuration and build directories'
74 include $(CT_LIB_DIR)/kconfig/kconfig.mk
75 include $(CT_LIB_DIR)/steps.mk
76 include $(CT_LIB_DIR)/samples/samples.mk
77 include $(CT_LIB_DIR)/tools/tools.mk
80 @echo ' tarball - Build a tarball of the configured toolchain'
83 @echo ' STOP - Stop the build just after this step'
84 @echo ' RESTART - Restart the build just before this step'
87 @echo 'You must run either one of "$(CT_NG) config" or "$(CT_NG) menuconfig" first'
96 @$(CT_LIB_DIR)/scripts/crosstool.sh
99 @$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
103 # @$(CT_LIB_DIR)/scripts/tarball.sh
105 @echo 'Tarbal creation disabled for now... Sorry.'
110 @echo 'This is crosstool-NG version $(CT_VERSION)'
114 @rm -f $(CT_TOP_DIR)/.config.*
118 @rm -f $(CT_TOP_DIR)/.config* $(CT_TOP_DIR)/..config.tmp
119 @rm -f $(CT_TOP_DIR)/log.*
120 @[ ! -d "$(CT_TOP_DIR)/targets" ] || chmod -R u+w "$(CT_TOP_DIR)/targets"
121 @rm -rf "$(CT_TOP_DIR)/targets"