ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jul 03 22:16:42 2007 +0000 (2007-07-03)
changeset 199 d799643901c3
parent 185 ade232db1313
child 214 b73a4d9a98ea
permissions -rw-r--r--
Make checking the linux installed headers optional (instead of systematic).
     1 #!@@CT_MAKE@@ -f
     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
     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-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 actions:'
    41 
    42 help-build::
    43 	@echo
    44 	@echo  'Build actions:'
    45 
    46 help-distrib::
    47 	@echo
    48 	@echo  'Distribution actions:'
    49 
    50 help-env::
    51 	@echo
    52 	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
    53 
    54 help-tail::
    55 	@echo
    56 	@echo  'Execute "$(CT_NG) config" or "$(CT_NG) menuconfig" to configure crosstool-NG'
    57 	@echo  'Execute "$(CT_NG) build" to build your toolchain'
    58 	@echo  'See "man 1 ct-ng" for some help as well'
    59 
    60 # End help system
    61 
    62 help-build::
    63 	@echo  '  build          - Build the toolchain'
    64 	@echo  '  clean          - Remove generated files'
    65 	@echo  '  distclean      - Remove generated files, configuration and build directories'
    66 
    67 include $(CT_LIB_DIR)/kconfig/Makefile
    68 include $(CT_LIB_DIR)/samples/Makefile
    69 include $(CT_LIB_DIR)/tools/Makefile
    70 include $(CT_LIB_DIR)/Makefile.steps
    71 
    72 help-distrib::
    73 	@echo  '  tarball        - Build a tarball of the configured toolchain'
    74 
    75 help-env::
    76 	@echo  '  STOP           - Stop the build just after this step'
    77 	@echo  '  RESTART        - Restart the build just before this step'
    78 
    79 .config:
    80 	@echo  'You must run either one of "$(CT_NG) config" or "$(CT_NG) menuconfig" first'
    81 	@false
    82 
    83 # Actual build
    84 build:: .config
    85 	@$(CT_LIB_DIR)/scripts/crosstool.sh
    86 
    87 PHONY += tarball
    88 tarball:
    89 	@$(CT_LIB_DIR)/scripts/tarball.sh
    90 
    91 PHONY += clean
    92 clean::
    93 	@rm -f $(CT_TOP_DIR)/.config.*
    94 
    95 PHONY += distclean
    96 distclean:: clean
    97 	@rm -f $(CT_TOP_DIR)/.config* $(CT_TOP_DIR)/..config.tmp
    98 	@rm -f $(CT_TOP_DIR)/log.*
    99 	@[ ! -d "$(CT_TOP_DIR)/targets" ] || chmod -R u+w "$(CT_TOP_DIR)/targets"
   100 	@rm -rf "$(CT_TOP_DIR)/targets"