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
88
89
90
|
################################################################################
# Embtoolkit
# Copyright(C) 2009-2014 Abdoulaye Walsimou GAYE <awg@embtoolkit.org>.
#
# This program is free software; you can distribute it and/or modify it
# under the terms of the GNU General Public License
# (Version 2 or later) published by the Free Software Foundation.
#
# 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 host-support.mk
# \brief Host support
# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
# \date October 2014
################################################################################
#
# Host development machine info
#
CONFIG_EMBTK_SHELL := \
$(shell \
if [ -n "$$(command -v bash 2>/dev/null)" ]; then \
echo "$$(command -v bash)"; \
else \
echo "/bin/sh"; \
fi)
HOST_ARCH := $(shell $(CONFIG_EMBTK_SHELL) $(EMBTK_ROOT)/scripts/config.guess)
HOST_BUILD := $(HOST_ARCH)
export HOST_ARCH HOST_BUILD
ifeq ($(findstring linux,$(HOST_ARCH)),linux)
embtk_buildhost_os := linux
embtk_buildhost_os_type := linux
else ifeq ($(findstring freebsd,$(HOST_ARCH)),freebsd)
embtk_buildhost_os := freebsd
embtk_buildhost_os_type := bsd
else ifeq ($(findstring netbsd,$(HOST_ARCH)),netbsd)
embtk_buildhost_os := netbsd
embtk_buildhost_os_type := bsd
else ifeq ($(findstring openbsd,$(HOST_ARCH)),openbsd)
embtk_buildhost_os := openbsd
embtk_buildhost_os_type := bsd
else ifeq ($(findstring apple,$(HOST_ARCH)),apple)
embtk_buildhost_os := macos
embtk_buildhost_os_type := bsd
else
embtk_buildhost_os := unknown-host-os
endif
HOSTCC := \
$(shell \
if [ -n "$$(command -v gcc 2>/dev/null)" ]; then \
echo "$$(command -v gcc)"; \
elif [ -n "$$(command -v cc 2>/dev/null)" ]; then \
echo "$$(command -v cc)"; \
else \
echo gcc; \
fi)
HOSTCXX := \
$(shell \
if [ -n "$$(command -v g++ 2>/dev/null)" ]; then \
echo "$$(command -v g++)"; \
elif [ -n "$$(command -v c++ 2>/dev/null)" ]; then \
echo "$$(command -v c++)"; \
else \
echo g++; \
fi)
HOSTCFLAGS = -Wall -O2 -I$(embtk_htools)/usr/include
HOSTCXXFLAGS = -Wall -O2 -I$(embtk_htools)/usr/include
HOSTLDFLAGS =
ifeq ($(embtk_buildhost_os),macos)
HOSTCFLAGS += -I/opt/local/include -I$(embtk_includedir)
HOSTLDFLAGS += -L/opt/local/lib -lintl
endif
HOSTCXXFLAGS = $(HOSTCFLAGS)
export HOSTCC HOSTCXX HOSTCFLAGS HOSTCXXFLAGS HOSTLDFLAGS
|