summaryrefslogtreecommitdiff
path: root/core/toolchain/toolchain.mk
blob: 3d9d28d14bf6056eb6d9d145775e1fcb8e018cee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
################################################################################
# Copyright(C) 2009-2014 Abdoulaye Walsimou GAYE <awg@embtoolkit.org>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
#
# \file         toolchain.mk
# \brief	toolchain.mk of Embtoolkit
# \author       Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
# \date         May 2009
################################################################################

embtk_pkgincdir := toolchain

#
# Toolchain variables and macros
#
include core/toolchain/vars.mk
include core/toolchain/common.mk

include packages/htools/ccache/vars.mk
include packages/htools/m4/vars.mk
include packages/htools/libtool/vars.mk
include packages/htools/autoconf/vars.mk
include packages/htools/automake/vars.mk

include core/toolchain/core.mk
include core/toolchain/addons.mk

__embtk_toolchain_predeps-y = $(patsubst %_install,%,$(EMBTK_TOOLCHAIN_PREDEPS-y))
define __embtk_toolchain_build
	$(eval __xtool_build        := $(if $(__embtk_toolchain_runrecipe-y),core))
	$(eval __xtool_addons_build := $(if $(__embtk_toolchain_addons_runrecipe-y),addons))
	$(eval __xtool_build_args   := $(strip $(__xtool_build) $(__xtool_addons_build)))
	$(if $(__xtool_build),
		$(call embtk_pinfo,"Building new $(GNU_TARGET)/$(EMBTK_MCU_FLAG) CORE toolchain - please wait..."))
	$(__embtk_toolchain_mkinitdirs)
	$(foreach pdep,$(__embtk_toolchain_predeps-y),$(call embtk_install_xpkg,$(pdep)))
	$(if $(__xtool_build),
		$(call __embtk_toolchain_core_build,$(__xtool_build_args)))
	$(if $(__xtool_addons_build),
		$(call embtk_pinfo,"Building new $(GNU_TARGET)/$(EMBTK_MCU_FLAG) toolchain ADDONS - please wait...")
		$(call __embtk_toolchain_addons_build,$(__xtool_build_args)))
	$(if $(__xtool_build_args),
		$(call embtk_pinfo,"Packaging new $(GNU_TARGET)/$(EMBTK_MCU_FLAG) toolchain - please wait...")
		$(__embtk_toolchain_compress)
		$(call __embtk_setdecompressed_pkg,toolchain)
		$(call __embtk_setdecompressed_pkg,toolchain_addons)
		$(__embtk_toolchain_built_msg),
		$(__embtk_toolchain_decompress))
endef

toolchain_install:
	$(Q)$(__embtk_toolchain_build)

define __embtk_toolchain_clean
	$(call __embtk_unsetdecompressed_pkg,toolchain)
	$(call __embtk_unsetdecompressed_pkg,toolchain_addons)
endef

toolchain_clean:
	$(Q)$(__embtk_toolchain_clean)

pembtk_toolchain_mkinitdirs:
	$(__embtk_toolchain_mkinitdirs)

pembtk_toolchain_predeps_install:
	$(__embtk_toolchain_mkinitdirs)
	$(MAKE) $(EMBTK_TOOLCHAIN_PREDEPS-y)

# Download target for offline build
TOOLCHAIN_ALL_DEPS := $(EMBTK_TOOLCHAIN_PREDEPS-y) $(EMBTK_TOOLCHAIN_DEPS-y)
TOOLCHAIN_ALL_DEPS += $(EMBTK_TOOLCHAIN_ADDONS_DEPS-y)

packages_fetch:: $(patsubst %_install,download_%,$(TOOLCHAIN_ALL_DEPS))