Makefile
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jun 17 16:24:23 2007 +0000 (2007-06-17)
changeset 176 59676cfb4ada
parent 172 7214624eb7b4
permissions -rw-r--r--
Rework the help system. For now, this is mostly a no-op (it only re-organise the help entries), but later, that may come in handy when we want ct-ng to be installable).
yann@1
     1
# Makefile for crosstool-NG.
yann@1
     2
# Copyright 2006 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
yann@1
     3
yann@65
     4
# Don't print directory as we descend into them
yann@65
     5
MAKEFLAGS += --no-print-directory
yann@65
     6
yann@88
     7
export CT_TOP_DIR=$(shell pwd)
yann@1
     8
yann@88
     9
# This is crosstool-ng version string
yann@88
    10
export CT_VERSION=$(shell cat $(CT_TOP_DIR)/version)
yann@1
    11
yann@135
    12
export CT_STOP=$(STOP)
yann@121
    13
export CT_RESTART=$(RESTART)
yann@121
    14
yann@1
    15
.PHONY: all
yann@85
    16
all: build
yann@1
    17
yann@1
    18
HOST_CC = gcc -funsigned-char
yann@1
    19
yann@176
    20
# Help system
yann@176
    21
help:: help-head help-config help-samples help-build help-distrib help-env help-tail
yann@176
    22
yann@176
    23
help-head::
yann@63
    24
	@echo  'Available make targets:'
yann@176
    25
yann@176
    26
help-config::
yann@1
    27
	@echo
yann@176
    28
	@echo  'Configuration targets:'
yann@176
    29
yann@176
    30
help-samples::
yann@176
    31
	@echo
yann@176
    32
	@echo  'Preconfigured targets:'
yann@176
    33
yann@176
    34
help-build::
yann@176
    35
	@echo
yann@176
    36
	@echo  'Build targets:'
yann@176
    37
yann@176
    38
help-distrib::
yann@176
    39
	@echo
yann@176
    40
	@echo  'Distribution targets:'
yann@176
    41
yann@176
    42
help-env::
yann@176
    43
	@echo
yann@176
    44
	@echo  'Environement variables (see docs/overview.txt):'
yann@176
    45
yann@176
    46
help-tail::
yann@176
    47
	@echo
yann@176
    48
	@echo  'Execute "make" or "make all" to build all targets marked with [*]'
yann@176
    49
yann@176
    50
# End help system
yann@176
    51
yann@176
    52
help-build::
yann@176
    53
	@echo  '* build          - Build the toolchain'
yann@176
    54
	@echo  '  clean          - Remove generated files'
yann@176
    55
	@echo  '  distclean      - Remove generated files, configuration and build directories'
yann@1
    56
yann@1
    57
include $(CT_TOP_DIR)/kconfig/Makefile
yann@63
    58
include $(CT_TOP_DIR)/samples/Makefile
yann@1
    59
include $(CT_TOP_DIR)/tools/Makefile
yann@136
    60
include $(CT_TOP_DIR)/Makefile.steps
yann@1
    61
yann@176
    62
help-distrib::
yann@129
    63
	@echo  '  tarball        - Build a tarball of the configured toolchain'
yann@176
    64
yann@176
    65
help-env::
yann@136
    66
	@echo  '  STOP           - Stop the build just after this step'
yann@136
    67
	@echo  '  RESTART        - Restart the build just before this step'
yann@63
    68
yann@158
    69
.config:
yann@158
    70
	@echo "You must run either one of \"make config\" or \"make menuconfig\" first"
yann@172
    71
	@false
yann@1
    72
yann@1
    73
# Actual build
yann@85
    74
build: .config
yann@1
    75
	@$(CT_TOP_DIR)/scripts/crosstool.sh
yann@1
    76
yann@87
    77
.PHONY: tarball
yann@87
    78
tarball:
yann@87
    79
	@$(CT_TOP_DIR)/scripts/tarball.sh
yann@87
    80
yann@1
    81
.PHONY: distclean
yann@1
    82
distclean:: clean
yann@1
    83
	@rm -f .config* ..config.tmp
yann@136
    84
	@rm -f log.*
yann@158
    85
	@[ ! -d "$(CT_TOP_DIR)/targets" ] || chmod -R u+w "$(CT_TOP_DIR)/targets"
yann@85
    86
	@rm -rf "$(CT_TOP_DIR)/targets"