ct-ng.in
changeset 182 223c84ec2d90
child 185 ade232db1313
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ct-ng.in	Sun Jul 01 19:04:20 2007 +0000
     1.3 @@ -0,0 +1,99 @@
     1.4 +#!@@CT_MAKE@@ -f
     1.5 +# Makefile for crosstool-NG.
     1.6 +# Copyright 2006 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
     1.7 +
     1.8 +# Don't print directory as we descend into them
     1.9 +MAKEFLAGS += --no-print-directory
    1.10 +
    1.11 +# Remember the name of the Makefile
    1.12 +CT_MAKEFILE := $(lastword $(MAKEFILE_LIST))
    1.13 +CT_NG := $(shell echo '$(CT_MAKEFILE)' |sed -r -e 's,($(subst :,|,$(PATH)))/,,;')
    1.14 +
    1.15 +export CT_TOP_DIR:=$(shell pwd)
    1.16 +export CT_LIB_DIR:=@@CT_LIBDIR@@
    1.17 +export CT_DOC_DIR:=@@CT_DOCDIR@@
    1.18 +
    1.19 +# This is crosstool-ng version string
    1.20 +export CT_VERSION=$(shell cat $(CT_LIB_DIR)/version)
    1.21 +
    1.22 +export CT_STOP=$(STOP)
    1.23 +export CT_RESTART=$(RESTART)
    1.24 +
    1.25 +.PHONY: $(PHONY)
    1.26 +PHONY += all
    1.27 +all: build
    1.28 +
    1.29 +HOST_CC = gcc -funsigned-char
    1.30 +
    1.31 +# Help system
    1.32 +help:: help-head help-config help-samples help-build help-distrib help-env help-tail
    1.33 +
    1.34 +help-head::
    1.35 +	@echo  'Available make rules:'
    1.36 +
    1.37 +help-config::
    1.38 +	@echo
    1.39 +	@echo  'Configuration rules:'
    1.40 +
    1.41 +help-samples::
    1.42 +	@echo
    1.43 +	@echo  'Preconfigured rules:'
    1.44 +
    1.45 +help-build::
    1.46 +	@echo
    1.47 +	@echo  'Build rules:'
    1.48 +
    1.49 +help-distrib::
    1.50 +	@echo
    1.51 +	@echo  'Distribution rules:'
    1.52 +
    1.53 +help-env::
    1.54 +	@echo
    1.55 +	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
    1.56 +
    1.57 +help-tail::
    1.58 +	@echo
    1.59 +	@echo  'Execute "$(CT_NG) config" or "$(CT_NG) menuconfig" to configure ct-ng'
    1.60 +	@echo  'Execute "$(CT_NG)" or "$(CT_NG) all" to build all targets marked with [*]'
    1.61 +
    1.62 +# End help system
    1.63 +
    1.64 +help-build::
    1.65 +	@echo  '* build          - Build the toolchain'
    1.66 +	@echo  '  clean          - Remove generated files'
    1.67 +	@echo  '  distclean      - Remove generated files, configuration and build directories'
    1.68 +
    1.69 +include $(CT_LIB_DIR)/kconfig/Makefile
    1.70 +include $(CT_LIB_DIR)/samples/Makefile
    1.71 +include $(CT_LIB_DIR)/tools/Makefile
    1.72 +include $(CT_LIB_DIR)/Makefile.steps
    1.73 +
    1.74 +help-distrib::
    1.75 +	@echo  '  tarball        - Build a tarball of the configured toolchain'
    1.76 +
    1.77 +help-env::
    1.78 +	@echo  '  STOP           - Stop the build just after this step'
    1.79 +	@echo  '  RESTART        - Restart the build just before this step'
    1.80 +
    1.81 +.config:
    1.82 +	@echo  'You must run either one of "$(CT_NG) config" or "$(CT_NG) menuconfig" first'
    1.83 +	@false
    1.84 +
    1.85 +# Actual build
    1.86 +build:: .config
    1.87 +	@$(CT_LIB_DIR)/scripts/crosstool.sh
    1.88 +
    1.89 +PHONY += tarball
    1.90 +tarball:
    1.91 +	@$(CT_LIB_DIR)/scripts/tarball.sh
    1.92 +
    1.93 +PHONY += clean
    1.94 +clean::
    1.95 +	@rm -f $(CT_TOP_DIR)/.config.*
    1.96 +
    1.97 +PHONY += distclean
    1.98 +distclean:: clean
    1.99 +	@rm -f $(CT_TOP_DIR)/.config* $(CT_TOP_DIR)/..config.tmp
   1.100 +	@rm -f $(CT_TOP_DIR)/log.*
   1.101 +	@[ ! -d "$(CT_TOP_DIR)/targets" ] || chmod -R u+w "$(CT_TOP_DIR)/targets"
   1.102 +	@rm -rf "$(CT_TOP_DIR)/targets"