ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Aug 15 15:39:44 2007 +0000 (2007-08-15)
changeset 334 49b354cfd34d
parent 333 d647d0e6021e
child 348 9fcb5046b4b5
permissions -rw-r--r--
Fix printing the version string when configured with --local.
     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 # 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)))/,,;')
    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 ifeq ($(CT_JOBS),)
    92 CT_JOBS:=1
    93 endif
    94 export CT_JOBS
    95 build:: .config
    96 	@$(CT_LIB_DIR)/scripts/crosstool.sh
    97 
    98 build.%::
    99 	@$(CT_NG) $(shell echo "$(@)" |sed -r -e 's|^([^.]+)\.([[:digit:]]+)$$|\1 CT_JOBS=\2|;')
   100 
   101 PHONY += tarball
   102 #tarball:
   103 #	@$(CT_LIB_DIR)/scripts/tarball.sh
   104 tarball:
   105 	@echo 'Tarbal creation disabled for now... Sorry.'
   106 	@true
   107 
   108 PHONY += version
   109 version:
   110 	@echo 'This is crosstool-NG version $(CT_VERSION)'
   111 
   112 PHONY += clean
   113 clean::
   114 	@rm -f $(CT_TOP_DIR)/.config.*
   115 
   116 PHONY += distclean
   117 distclean:: clean
   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"