ct-ng.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 01 19:04:20 2007 +0000 (2007-07-01)
changeset 182 223c84ec2d90
child 185 ade232db1313
permissions -rw-r--r--
Merge the build system to trunk: ct-ng is now installable:
- ./configure --prefix=/some/place
- make
- make install
- export PATH="${PATH}:/some/place/bin"
- ct-ng <action>
yann@182
     1
#!@@CT_MAKE@@ -f
yann@182
     2
# Makefile for crosstool-NG.
yann@182
     3
# Copyright 2006 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
yann@182
     4
yann@182
     5
# Don't print directory as we descend into them
yann@182
     6
MAKEFLAGS += --no-print-directory
yann@182
     7
yann@182
     8
# Remember the name of the Makefile
yann@182
     9
CT_MAKEFILE := $(lastword $(MAKEFILE_LIST))
yann@182
    10
CT_NG := $(shell echo '$(CT_MAKEFILE)' |sed -r -e 's,($(subst :,|,$(PATH)))/,,;')
yann@182
    11
yann@182
    12
export CT_TOP_DIR:=$(shell pwd)
yann@182
    13
export CT_LIB_DIR:=@@CT_LIBDIR@@
yann@182
    14
export CT_DOC_DIR:=@@CT_DOCDIR@@
yann@182
    15
yann@182
    16
# This is crosstool-ng version string
yann@182
    17
export CT_VERSION=$(shell cat $(CT_LIB_DIR)/version)
yann@182
    18
yann@182
    19
export CT_STOP=$(STOP)
yann@182
    20
export CT_RESTART=$(RESTART)
yann@182
    21
yann@182
    22
.PHONY: $(PHONY)
yann@182
    23
PHONY += all
yann@182
    24
all: build
yann@182
    25
yann@182
    26
HOST_CC = gcc -funsigned-char
yann@182
    27
yann@182
    28
# Help system
yann@182
    29
help:: help-head help-config help-samples help-build help-distrib help-env help-tail
yann@182
    30
yann@182
    31
help-head::
yann@182
    32
	@echo  'Available make rules:'
yann@182
    33
yann@182
    34
help-config::
yann@182
    35
	@echo
yann@182
    36
	@echo  'Configuration rules:'
yann@182
    37
yann@182
    38
help-samples::
yann@182
    39
	@echo
yann@182
    40
	@echo  'Preconfigured rules:'
yann@182
    41
yann@182
    42
help-build::
yann@182
    43
	@echo
yann@182
    44
	@echo  'Build rules:'
yann@182
    45
yann@182
    46
help-distrib::
yann@182
    47
	@echo
yann@182
    48
	@echo  'Distribution rules:'
yann@182
    49
yann@182
    50
help-env::
yann@182
    51
	@echo
yann@182
    52
	@echo  'Environement variables (see @@CT_DOCDIR@@/overview.txt):'
yann@182
    53
yann@182
    54
help-tail::
yann@182
    55
	@echo
yann@182
    56
	@echo  'Execute "$(CT_NG) config" or "$(CT_NG) menuconfig" to configure ct-ng'
yann@182
    57
	@echo  'Execute "$(CT_NG)" or "$(CT_NG) all" to build all targets marked with [*]'
yann@182
    58
yann@182
    59
# End help system
yann@182
    60
yann@182
    61
help-build::
yann@182
    62
	@echo  '* build          - Build the toolchain'
yann@182
    63
	@echo  '  clean          - Remove generated files'
yann@182
    64
	@echo  '  distclean      - Remove generated files, configuration and build directories'
yann@182
    65
yann@182
    66
include $(CT_LIB_DIR)/kconfig/Makefile
yann@182
    67
include $(CT_LIB_DIR)/samples/Makefile
yann@182
    68
include $(CT_LIB_DIR)/tools/Makefile
yann@182
    69
include $(CT_LIB_DIR)/Makefile.steps
yann@182
    70
yann@182
    71
help-distrib::
yann@182
    72
	@echo  '  tarball        - Build a tarball of the configured toolchain'
yann@182
    73
yann@182
    74
help-env::
yann@182
    75
	@echo  '  STOP           - Stop the build just after this step'
yann@182
    76
	@echo  '  RESTART        - Restart the build just before this step'
yann@182
    77
yann@182
    78
.config:
yann@182
    79
	@echo  'You must run either one of "$(CT_NG) config" or "$(CT_NG) menuconfig" first'
yann@182
    80
	@false
yann@182
    81
yann@182
    82
# Actual build
yann@182
    83
build:: .config
yann@182
    84
	@$(CT_LIB_DIR)/scripts/crosstool.sh
yann@182
    85
yann@182
    86
PHONY += tarball
yann@182
    87
tarball:
yann@182
    88
	@$(CT_LIB_DIR)/scripts/tarball.sh
yann@182
    89
yann@182
    90
PHONY += clean
yann@182
    91
clean::
yann@182
    92
	@rm -f $(CT_TOP_DIR)/.config.*
yann@182
    93
yann@182
    94
PHONY += distclean
yann@182
    95
distclean:: clean
yann@182
    96
	@rm -f $(CT_TOP_DIR)/.config* $(CT_TOP_DIR)/..config.tmp
yann@182
    97
	@rm -f $(CT_TOP_DIR)/log.*
yann@182
    98
	@[ ! -d "$(CT_TOP_DIR)/targets" ] || chmod -R u+w "$(CT_TOP_DIR)/targets"
yann@182
    99
	@rm -rf "$(CT_TOP_DIR)/targets"