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