summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2014-03-18 23:45:27 +0100
committerAbdoulaye Walsimou Gaye <awg@embtoolkit.org>2014-03-18 23:45:27 +0100
commitef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35 (patch)
treee8e85268168e09221e23cdbb4639e47109988d04 /core
parentfb516edcaeaa02e435316622b2bcc5314b42d529 (diff)
downloadembtoolkit-ef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35.tar.gz
embtoolkit-ef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35.tar.bz2
embtoolkit-ef94bcb8905c8c8fefc272dbcb2d5ee0c4efbe35.tar.xz
Move mk/ to core/
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
Diffstat (limited to 'core')
-rw-r--r--core/mk/arch/arm/arm.mk88
-rw-r--r--core/mk/arch/mips/mips.mk150
-rw-r--r--core/mk/autoconf.mk46
-rw-r--r--core/mk/automake.mk40
-rw-r--r--core/mk/bmake.mk51
-rw-r--r--core/mk/buildsystem.mk209
-rw-r--r--core/mk/eglibc.mk127
l---------core/mk/eglibc/eglibc-2.17-options.mk1
-rw-r--r--core/mk/eglibc/eglibc-trunk-options.mk64
-rw-r--r--core/mk/glibc.mk106
-rw-r--r--core/mk/gmake.mk39
-rw-r--r--core/mk/gmp.mk41
-rw-r--r--core/mk/gperf_host.mk35
-rw-r--r--core/mk/gsed.mk35
-rw-r--r--core/mk/help.mk104
-rw-r--r--core/mk/libtool.mk41
-rw-r--r--core/mk/linux.mk138
-rw-r--r--core/mk/m4.mk42
-rw-r--r--core/mk/macros.mk132
-rw-r--r--core/mk/makedevs.mk49
-rw-r--r--core/mk/mkimage.mk50
-rw-r--r--core/mk/mpc.mk43
-rw-r--r--core/mk/mpfr.mk42
-rw-r--r--core/mk/musl.mk78
-rw-r--r--core/mk/packages.mk123
-rw-r--r--core/mk/pkg-macros/clean.mk63
-rw-r--r--core/mk/pkg-macros/configure.mk142
-rw-r--r--core/mk/pkg-macros/download.mk207
-rw-r--r--core/mk/pkg-macros/incl.mk90
-rw-r--r--core/mk/pkg-macros/install.mk327
-rw-r--r--core/mk/pkg-macros/libtool.mk54
-rw-r--r--core/mk/pkg-macros/pkg-config.mk63
-rw-r--r--core/mk/pkg-macros/vars.mk124
-rw-r--r--core/mk/rootfs/README.busybox.inittab6
-rw-r--r--core/mk/rootfs/fs.mk100
-rw-r--r--core/mk/rootfs/rootfs.mk194
-rw-r--r--core/mk/squashfs.mk59
-rw-r--r--core/mk/strace.mk33
-rw-r--r--core/mk/target-mcu.mk33
-rw-r--r--core/mk/targetsys.mk56
-rwxr-xr-xcore/mk/uclibc.mk145
41 files changed, 3570 insertions, 0 deletions
diff --git a/core/mk/arch/arm/arm.mk b/core/mk/arch/arm/arm.mk
new file mode 100644
index 0000000..f3a3e48
--- /dev/null
+++ b/core/mk/arch/arm/arm.mk
@@ -0,0 +1,88 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2013 Abdoulaye Walsimou GAYE.
+#
+# 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 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, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
+################################################################################
+#
+# \file arm-arch.mk
+# \brief arm-arch.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date June 2009
+################################################################################
+
+__embtk_arm_endian := $(if $(CONFIG_EMBTK_TARGET_ARCH_BIG_ENDIAN),eb)
+__embtk_arm_abi-$(CONFIG_EMBTK_CLIB_EGLIBC) := gnueabi
+__embtk_arm_abi-$(CONFIG_EMBTK_CLIB_GLIBC) := gnueabi
+__embtk_arm_abi := $(or $(__embtk_arm_abi-y),$(embtk_clib)eabi)
+
+LINUX_ARCH := arm
+GNU_TARGET_ARCH := arm
+EMBTK_MCU_FLAG := $(call __embtk_mk_uquote,$(CONFIG_EMBTK_ARM_MCU_STRING))
+GNU_TARGET := arm$(__embtk_arm_endian)-$(embtk_os)
+STRICT_GNU_TARGET := arm$(__embtk_arm_endian)-unknown-$(embtk_os)-$(__embtk_arm_abi)
+
+#
+# GCC/LLVM configure options
+#
+GCC_WITH_CPU := --with-cpu=$(EMBTK_MCU_FLAG)
+LLVM_WITH_CPU := --with-default-cpu=$(EMBTK_MCU_FLAG)
+
+# GCC extra configure options for arm
+GCC3_CONFIGURE_EXTRA_OPTIONS += $(strip $(if $(CONFIG_EMBTK_GCC_LANGUAGE_JAVA), \
+ --enable-sjlj-exceptions))
+
+# Hard or soft floating point for GCC/LLVM?
+GCC_WITH_FLOAT-$(CONFIG_EMBTK_SOFTFLOAT) := soft
+GCC_WITH_FLOAT-$(CONFIG_EMBTK_HARDFLOAT) := softfp
+GCC_WITH_FLOAT := --with-float=$(GCC_WITH_FLOAT-y)
+LLVM_WITH_FLOAT := --with-default-float=$(GCC_WITH_FLOAT-y)
+
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_VFP) := vfp
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_VFPV3) := vfpv3
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_VFPV3_D16) := vfpv3-d16
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_VFPV3_FP16) := vfpv3-fp16
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_VFPV3_D16FP16) := vfpv3-d16-fp16
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_VFPV3_XD) := vfpv3xd
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_VFPV3_XDFP16) := vfpv3xd-fp16
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_VFPV4) := vfpv4
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_VFPV4_D16) := vfpv4-d16
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_FPV4_SPD16) := fpv4-sp-d16
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_NEON) := neon
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_NEON_FP16) := neon-fp16
+GCC_WITH_FPU-$(CONFIG_EMBTK_ARCH_ARM_FPU_NEON_VFPV4) := neon-vfpv4
+GCC_WITH_FPU := $(if $(GCC_WITH_FPU-y),--with-fpu=$(GCC_WITH_FPU-y))
+LLVM_WITH_FPU := $(if $(GCC_WITH_FPU-y),--with-default-fpu=$(GCC_WITH_FPU-y))
+
+# Hard or soft floating point?
+EMBTK_TARGET_FLOAT_CFLAGS := $(strip $(if $(CONFIG_EMBTK_SOFTFLOAT), \
+ -mfloat-abi=soft,-mfloat-abi=softfp))
+
+# Some other flags for TARGET_CFLAGS
+EMBTK_TARGET_MCPU := -mcpu=$(EMBTK_MCU_FLAG)
+EMBTK_TARGET_MARCH :=
+
+#
+# musl options
+#
+embtk_musl_dlinker := ld-musl-arm$(__embtk_arm_endian)$(if $(CONFIG_EMBTK_HARDFLOAT),hf)
+
+#
+# misc
+#
+
+# Some cross compiler variables
+__xtools_env_float := $(if $(CONFIG_EMBTK_SOFTFLOAT),sf,hf)
+__xtools_archos := $(GNU_TARGET)
+__xtools_env := $(EMBTK_MCU_FLAG)-$(__xtools_env_float)
diff --git a/core/mk/arch/mips/mips.mk b/core/mk/arch/mips/mips.mk
new file mode 100644
index 0000000..6914579
--- /dev/null
+++ b/core/mk/arch/mips/mips.mk
@@ -0,0 +1,150 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2013 Abdoulaye Walsimou GAYE.
+#
+# 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 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, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
+################################################################################
+#
+# \file mips.mk
+# \brief mips.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date May 2009
+################################################################################
+
+LINUX_ARCH := mips
+
+__embtk_mips_endian := $(if $(CONFIG_EMBTK_TARGET_ARCH_LITTLE_ENDIAN),el)
+__embtk_mips_abi-$(CONFIG_EMBTK_CLIB_EGLIBC) := gnu
+__embtk_mips_abi-$(CONFIG_EMBTK_CLIB_GLIBC) := gnu
+__embtk_mips_abi := $(or $(__embtk_mips_abi-y),$(embtk_clib))
+__embtk_mips_64bit := $(if $(CONFIG_EMBTK_TARGET_ARCH_64BITS),64)
+
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS_MIPS1),y)
+GNU_TARGET := mips$(__embtk_mips_endian)-$(embtk_os)
+STRICT_GNU_TARGET := mips$(__embtk_mips_endian)-unknown-$(embtk_os)-$(__embtk_mips_abi)
+GNU_TARGET_ARCH := mips1
+endif
+
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS_MIPS2),y)
+GNU_TARGET := mips$(__embtk_mips_endian)-$(embtk_os)
+STRICT_GNU_TARGET := mips$(__embtk_mips_endian)-unknown-$(embtk_os)-$(__embtk_mips_abi)
+GNU_TARGET_ARCH := mips2
+endif
+
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS_MIPS3),y)
+GNU_TARGET := mips64$(__embtk_mips_endian)-$(embtk_os)
+STRICT_GNU_TARGET := mips64$(__embtk_mips_endian)-unknown-$(embtk_os)-$(__embtk_mips_abi)
+GNU_TARGET_ARCH := mips3
+endif
+
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS_MIPS4),y)
+GNU_TARGET := mips64$(__embtk_mips_endian)-$(embtk_os)
+STRICT_GNU_TARGET := mips64$(__embtk_mips_endian)-unknown-$(embtk_os)-$(__embtk_mips_abi)
+GNU_TARGET_ARCH := mips4
+endif
+
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS_MIPS32),y)
+GNU_TARGET := mips$(__embtk_mips_endian)-$(embtk_os)
+STRICT_GNU_TARGET := mipsisa32$(__embtk_mips_endian)-unknown-$(embtk_os)-$(__embtk_mips_abi)
+GNU_TARGET_ARCH := mips32
+endif
+
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS_MIPS32R2),y)
+GNU_TARGET := mips$(__embtk_mips_endian)-$(embtk_os)
+STRICT_GNU_TARGET := mipsisa32r2$(__embtk_mips_endian)-unknown-$(embtk_os)-$(__embtk_mips_abi)
+GNU_TARGET_ARCH := mips32r2
+endif
+
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS_MIPS64),y)
+GNU_TARGET := mips64$(__embtk_mips_endian)-$(embtk_os)
+STRICT_GNU_TARGET := mipsisa64$(__embtk_mips_endian)-unknown-$(embtk_os)-$(__embtk_mips_abi)
+GNU_TARGET_ARCH := mips64
+endif
+
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS_MIPS64R2),y)
+GNU_TARGET := mips64$(__embtk_mips_endian)-$(embtk_os)
+STRICT_GNU_TARGET := mipsisa64r2$(__embtk_mips_endian)-unknown-$(embtk_os)-$(__embtk_mips_abi)
+GNU_TARGET_ARCH := mips64r2
+endif
+
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS_OCTEON),y)
+GNU_TARGET := mips64octeon$(__embtk_mips_endian)-$(embtk_os)
+STRICT_GNU_TARGET := mips64octeon$(__embtk_mips_endian)-unknown-$(embtk_os)-$(__embtk_mips_abi)
+GNU_TARGET_ARCH := octeon
+endif
+
+EMBTK_MCU_FLAG := $(GNU_TARGET_ARCH)
+
+#
+# GCC configure options
+#
+GCC_WITH_ARCH := --with-arch=$(GNU_TARGET_ARCH)
+
+# Hard or soft floating point for GCC?
+ifeq ($(CONFIG_EMBTK_HARDFLOAT),y)
+GCC_WITH_FLOAT := --with-float=hard
+LLVM_WITH_FLOAT := --with-default-float=hard
+EMBTK_TARGET_FLOAT_CFLAGS := -mhard-float
+__xtools_env_float := hf
+else
+GCC_WITH_FLOAT := --with-float=soft
+LLVM_WITH_FLOAT := --with-default-float=soft
+EMBTK_TARGET_FLOAT_CFLAGS := -msoft-float
+__xtools_env_float := sf
+endif
+
+# ABI part
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS_ABI_O32),y)
+GCC_WITH_ABI := --with-abi=32
+LLVM_WITH_ABI := --with-default-abi=o32
+EMBTK_TARGET_ABI := -mabi=32
+__xtools_env_abi := o32
+
+else ifeq ($(CONFIG_EMBTK_ARCH_MIPS_ABI_N32),y)
+GCC_WITH_ABI := --with-abi=n32
+LLVM_WITH_ABI := --with-default-abi=n32
+EMBTK_TARGET_ABI := -mabi=n32
+__xtools_env_abi := n32
+
+#else ifeq ($(CONFIG_EMBTK_ARCH_MIPS_ABI_EABI),y)
+#GCC_WITH_ABI := --with-abi=eabi
+#EMBTK_TARGET_ABI := -mabi=eabi
+
+#else ifeq ($(CONFIG_EMBTK_ARCH_MIPS_ABI_O64),y)
+#GCC_WITH_ABI := --with-abi=o64
+#EMBTK_TARGET_ABI := -mabi=o64
+
+else
+GCC_WITH_ABI := --with-abi=64
+LLVM_WITH_ABI := --with-default-abi=n64
+EMBTK_TARGET_ABI := -mabi=64
+__xtools_env_abi := n64
+endif
+
+# Some other flags for TARGET_CFLAGS
+EMBTK_TARGET_MCPU :=
+EMBTK_TARGET_MARCH := -march=$(EMBTK_MCU_FLAG)
+
+#
+# musl options
+#
+embtk_musl_dlinker := ld-musl-mips$(__embtk_mips_endian)$(if $(CONFIG_EMBTK_SOFTFLOAT),-sf)
+
+#
+# misc
+#
+
+# Some cross compiler variables
+__xtools_archos := mips$(__embtk_mips_64bit)$(__embtk_mips_endian)-$(embtk_os)
+__xtools_env := $(GNU_TARGET_ARCH)$(__xtools_env_float)-$(__xtools_env_abi)
diff --git a/core/mk/autoconf.mk b/core/mk/autoconf.mk
new file mode 100644
index 0000000..d4bd6c7
--- /dev/null
+++ b/core/mk/autoconf.mk
@@ -0,0 +1,46 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2010-2011 Abdoulaye Walsimou GAYE.
+#
+# 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 autoconf.mk
+# \brief autoconf.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date February 2010
+################################################################################
+
+AUTOCONF_NAME := autoconf
+AUTOCONF_VERSION := $(call embtk_get_pkgversion,autoconf)
+AUTOCONF_SITE := http://ftp.gnu.org/gnu/autoconf
+AUTOCONF_PACKAGE := autoconf-$(AUTOCONF_VERSION).tar.bz2
+AUTOCONF_SRC_DIR := $(embtk_toolsb)/autoconf-$(AUTOCONF_VERSION)
+AUTOCONF_BUILD_DIR := $(embtk_toolsb)/autoconf-$(AUTOCONF_VERSION)
+
+# autoconf binaries
+AUTOCONF_DIR := $(embtk_htools)/usr
+AUTOCONF := $(AUTOCONF_DIR)/bin/autoconf
+AUTOHEADER := $(AUTOCONF_DIR)/bin/autoheader
+AUTOM4TE := $(AUTOCONF_DIR)/bin/autom4te
+AUTORECONF := $(AUTOCONF_DIR)/bin/autoreconf
+AUTOSCAN := $(AUTOCONF_DIR)/bin/autoscan
+AUTOUPDATE := $(AUTOCONF_DIR)/bin/autoupdate
+IFNAMES := $(AUTOCONF_DIR)/bin/ifnames
+export AUTOCONF AUTOHEADER AUTOM4TE AUTORECONF AUTOSCAN AUTOUPDATE IFNAMES
+
+define embtk_install_autoconf
+ $(call __embtk_install_hostpkg,autoconf)
+endef
diff --git a/core/mk/automake.mk b/core/mk/automake.mk
new file mode 100644
index 0000000..3d3f1a2
--- /dev/null
+++ b/core/mk/automake.mk
@@ -0,0 +1,40 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2010-2011 Abdoulaye Walsimou GAYE.
+#
+# 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 automake.mk
+# \brief automake.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date February 2010
+################################################################################
+
+AUTOMAKE_NAME := automake
+AUTOMAKE_VERSION := $(call embtk_get_pkgversion,AUTOMAKE)
+AUTOMAKE_SITE := http://ftp.gnu.org/gnu/automake
+AUTOMAKE_PACKAGE := automake-$(AUTOMAKE_VERSION).tar.xz
+AUTOMAKE_SRC_DIR := $(embtk_toolsb)/automake-$(AUTOMAKE_VERSION)
+AUTOMAKE_BUILD_DIR := $(embtk_toolsb)/automake-$(AUTOMAKE_VERSION)
+
+AUTOMAKE_DIR := $(embtk_htools)/usr
+ACLOCAL := $(AUTOMAKE_DIR)/bin/aclocal
+AUTOMAKE := $(AUTOMAKE_DIR)/bin/automake
+export ACLOCAL AUTOMAKE
+
+define embtk_install_automake
+ $(call __embtk_install_hostpkg,automake)
+endef
diff --git a/core/mk/bmake.mk b/core/mk/bmake.mk
new file mode 100644
index 0000000..4dccf83
--- /dev/null
+++ b/core/mk/bmake.mk
@@ -0,0 +1,51 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2013 Abdoulaye Walsimou GAYE.
+#
+# 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 bmake.mk
+# \brief bmake.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date April 2013
+################################################################################
+
+BMAKE_NAME := bmake
+BMAKE_VERSION := $(call embtk_get_pkgversion,bmake)
+BMAKE_SITE := http://ftp.netbsd.org/pub/NetBSD/misc/sjg
+BMAKE_PACKAGE := bmake-$(BMAKE_VERSION).tar.gz
+BMAKE_SRC_DIR := $(embtk_toolsb)/bmake
+BMAKE_BUILD_DIR := $(embtk_toolsb)/bmake-build
+
+define __embtk_install_bmake
+ $(call embtk_pinfo,"Install bmake-$(BMAKE_VERSION)...")
+ $(call embtk_download_pkg,bmake)
+ $(call embtk_decompress_pkg,bmake)
+ cd $(BMAKE_BUILD_DIR) && MAKEFLAGS="" \
+ $(BMAKE_SRC_DIR)/boot-strap \
+ --prefix=$(embtk_htools)/usr --install
+ $(call __embtk_setinstalled_pkg,bmake)
+ $(call __embtk_pkg_gen_dotkconfig_f,bmake)
+ $(eval __embtk_bmake_installed := y)
+endef
+
+define embtk_install_bmake
+ $(if $(call __embtk_pkg_runrecipe-y,bmake),$(__embtk_install_bmake))
+endef
+
+define embtk_cleanup_bmake
+ rm -rf $(BMAKE_BUILD_DIR)
+endef
diff --git a/core/mk/buildsystem.mk b/core/mk/buildsystem.mk
new file mode 100644
index 0000000..8bada7e
--- /dev/null
+++ b/core/mk/buildsystem.mk
@@ -0,0 +1,209 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2013 Abdoulaye Walsimou GAYE.
+#
+# 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 buildsystem.mk
+# \brief buildsystem.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date May 2009
+################################################################################
+
+TOOLS_BUILD := $(EMBTK_ROOT)/build/tools_build-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)
+PACKAGES_BUILD := $(EMBTK_ROOT)/build/packages_build-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)
+DOWNLOAD_DIR := $(patsubst %/,%,$(subst ",,$(strip $(CONFIG_EMBTK_DOWNLOAD_DIR))))
+J := -j$(or $(CONFIG_EMBTK_NUMBER_BUILD_JOBS),1)
+
+#
+# New version of above variables names. The old names are scheduled for removal
+#
+embtk_generated := $(EMBTK_ROOT)/generated
+embtk_sysroot := $(embtk_generated)/sysroot-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)
+embtk_tools := $(embtk_generated)/tools-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)
+embtk_htools := $(embtk_generated)/host-tools-$(EMBTK_MCU_FLAG)
+embtk_toolsb := $(TOOLS_BUILD)
+embtk_pkgb := $(PACKAGES_BUILD)
+embtk_rootfs := $(embtk_generated)/rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)
+__embtk_dldir := $(patsubst %/,%,$(call __embtk_mk_uquote,$(CONFIG_EMBTK_DOWNLOAD_DIR)))
+embtk_dldir := $(or $(__embtk_dldir),$(EMBTK_ROOT)/dl)
+
+
+define __embtk_kconfig_buildrun
+ PKG_CONFIG_PATH=$(EMBTK_HOST_PKG_CONFIG_PATH) \
+ $(MAKE) -f scripts/Makefile.build \
+ obj=$(EMBTK_ROOT)/scripts/kconfig \
+ EMBTK_DEFAULT_DL="$(EMBTK_ROOT)/dl/" \
+ EMBTK_VERSION=$(EMBTK_VERSION) \
+ CONFIG_SHELL=$(CONFIG_EMBTK_SHELL) \
+ quiet=quiet_ KBUILD_VERBOSE=0 $(1)
+endef
+
+define __embtk_mk_xconfig
+ $(if $(CONFIG_EMBTK_DOTCONFIG),true,
+ if [ -e $(EMBTK_DOTCONFIG).old ]; then \
+ cp $(EMBTK_DOTCONFIG).old $(EMBTK_DOTCONFIG); \
+ fi)
+ $(call __embtk_kconfig_buildrun,$(1))
+endef
+
+xconfig menuconfig olddefconfig: embtk_kconfig_basic
+ $(Q)$(call __embtk_mk_xconfig,$@)
+
+embtk_kconfig_basic:
+ $(Q)$(MAKE) -f scripts/Makefile.build \
+ obj=$(EMBTK_ROOT)/scripts/basic quiet=quiet_ KBUILD_VERBOSE=0
+
+__bsystem_xtoolchain_decompressed := $(wildcard $(embtk_generated)/toolchain-*/.*.embtk.decompressed)
+clean: toolchain_clean rmallpath
+ $(Q)$(__embtk_kconfig_clean)
+ [ -e .config ] && cp .config .config.old || true
+ $(Q)rm -rf .config kbuild.log .fakeroot*
+ $(Q)$(if $(__bsystem_xtoolchain_decompressed),rm -rf $(__bsystem_xtoolchain_decompressed))
+
+distclean: clean
+ $(Q)rm -rf dl/* src/*.git src/*.svn .config.old
+ $(Q)rm -rf $(embtk_generated)
+
+define __embtk_mk_pwarning_restartbuild
+ $(call embtk_pwarning,"Wrong make target - Use correct make target")
+ $(call embtk_echo_yellow,"You are trying to restart all the build while it is already")
+ $(call embtk_echo_yellow,"done. Please use the correct make target!!!")
+ echo
+ $(MAKE) help
+endef
+
+define __embtk_mk_print_selectedfeatures
+ $(call embtk_pinfo,"Starting build of selected features...")
+ $(call embtk_echo_blue," ~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"| Toolchain |")
+ $(call embtk_echo_blue," ~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"\tEmbToolkit : v$(EMBTK_VERSION)")
+ $(call embtk_echo_blue,"\tArchitecture : $(LINUX_ARCH) ($(EMBTK_MCU_FLAG))")
+ $(call embtk_echo_blue,"\tLinux kernel headers: linux-$(call __embtk_pkg_version,linux)")
+ $(call embtk_echo_blue,"\tBinutils : binutils-$(call __embtk_pkg_version,binutils)")
+ $(if $(CONFIG_EMBTK_HAVE_LLVM),
+ $(call embtk_echo_blue,"\tCLANG/LLVM : clang/llvm-$(call __embtk_pkg_version,llvm)"))
+ $(call embtk_echo_blue,"\tGCC : gcc-$(call __embtk_pkg_version,gcc)")
+ $(call embtk_echo_blue,"\tC library : $(call __embtk_pkg_name,$(embtk_clib))-$(call __embtk_pkg_version,$(embtk_clib))")
+ $(if $(CONFIG_EMBTK_HAVE_GDB_SYSTEM),
+ $(call embtk_echo_blue,"\tGDB : gdb-$(call __embtk_pkg_version,gdb)"))
+ $(if $(CONFIG_EMBTK_HAVE_STRACE),
+ $(call embtk_echo_blue,"\tStrace : strace-$(call __embtk_pkg_version,strace)"))
+ $(call embtk_echo_blue," ~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"| Host tools |")
+ $(call embtk_echo_blue," ~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"\tNumber of host tools packages needed:$(__embtk_hosttools_nrpkgs-y)")
+ $(if $(CONFIG_EMBTK_HAVE_ROOTFS),
+ $(call embtk_echo_blue," ~~~~~~~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"| Root FS packages |")
+ $(call embtk_echo_blue," ~~~~~~~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"\tNumber of root FS packages:$(__embtk_rootfs_nrpkgs-y)")
+ $(call embtk_echo_blue," ~~~~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"| Root FS types |")
+ $(call embtk_echo_blue," ~~~~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"\tTAR.BZ2 : Yes")
+ $(call embtk_echo_blue,"\tInitramfs : $(if $(CONFIG_EMBTK_ROOTFS_HAVE_INITRAMFS_CPIO),Yes,No)")
+ $(call embtk_echo_blue,"\tsquashFS : $(if $(CONFIG_EMBTK_ROOTFS_HAVE_SQUASHFS),Yes,No)")
+ $(call embtk_echo_blue,"\tJFFS2 : $(if $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2),Yes,No)"))
+endef
+
+__embtk_mk_startbuild-y := toolchain_install
+__embtk_mk_startbuild-$(CONFIG_EMBTK_BUILD_LINUX_KERNEL) += linux_install
+__embtk_mk_startbuild-$(CONFIG_EMBTK_HAVE_ROOTFS) += rootfs_build
+__embtk_mk_startbuild-y += successful_build
+define __embtk_mk_startbuild
+ $(__embtk_mk_print_selectedfeatures)
+ $(MAKE) $(__embtk_mk_startbuild-y)
+endef
+
+__bsystem_toolchain_decompressed := $(wildcard $(call __embtk_pkg_dotdecompressed_f,toolchain))
+startbuild:
+ $(if $(__bsystem_toolchain_decompressed), \
+ $(__embtk_mk_pwarning_restartbuild),$(__embtk_mk_startbuild))
+
+define __embtk_mk_initsysrootdirs
+ mkdir -p $(embtk_generated)
+ mkdir -p $(embtk_sysroot)
+ [ -L $(EMBTK_ROOT)/$(notdir $(embtk_sysroot)) ] || \
+ ln -sf $(embtk_sysroot) $(EMBTK_ROOT)/$(notdir $(embtk_sysroot))
+ mkdir -p $(embtk_sysroot)/etc
+ mkdir -p $(embtk_sysroot)/lib
+ mkdir -p $(embtk_sysroot)/usr
+ mkdir -p $(embtk_sysroot)/root
+ mkdir -p $(embtk_sysroot)/usr/lib
+ $(if $(CONFIG_EMBTK_32BITS_FS),, \
+ cd $(embtk_sysroot); rm -rf lib64; ln -sf lib lib64; \
+ cd $(embtk_sysroot)/usr; rm -rf lib64; ln -sf lib lib64)
+ $(if $(CONFIG_EMBTK_64BITS_FS_COMPAT32), \
+ cd $(embtk_sysroot); \
+ rm -rf lib64; ln -sf lib lib64; mkdir -p lib32; \
+ cd $(embtk_sysroot)/usr; \
+ rm -rf lib64; ln -sf lib lib64; mkdir -p lib32)
+endef
+
+define __embtk_mk_inittoolsdirs
+ mkdir -p $(embtk_generated)
+ mkdir -p $(embtk_generated)/toolchains
+ mkdir -p $(embtk_tools)
+ mkdir -p $(embtk_toolsb)
+ [ -L $(EMBTK_ROOT)/$(notdir $(embtk_tools)) ] || \
+ ln -sf $(embtk_tools) $(EMBTK_ROOT)/$(notdir $(embtk_tools))
+endef
+
+define __embtk_mk_initpkgdirs
+ mkdir -p $(EMBTK_ROOT)/build
+ mkdir -p $(embtk_pkgb)
+endef
+
+define __embtk_mk_inithosttoolsdirs
+ mkdir -p $(embtk_generated)
+ mkdir -p $(embtk_htools)
+ mkdir -p $(embtk_htools)/usr
+ mkdir -p $(embtk_htools)/usr/include
+ mkdir -p $(embtk_htools)/usr/local
+ [ -L $(EMBTK_ROOT)/$(notdir $(embtk_htools)) ] || \
+ ln -sf $(embtk_htools) $(EMBTK_ROOT)/$(notdir $(embtk_htools))
+endef
+
+define __embtk_kconfig_clean
+ rm -rf $(EMBTK_ROOT)/scripts/basic/fixdep
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name 'config*')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name 'lex.*.c')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name 'zconf.lex.c')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name '*.tab.c')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name '*.tab.h')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name 'zconf.hash.c')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name '*.moc')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name 'lkc_defs.h')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name '*.o')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name '*.tmp_qtcheck')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name '*.tmp_gtkcheck')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name 'conf')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name 'mconf')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name 'qconf')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name 'gconf')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/kconfig -type f -name 'kxgettext')
+ rm -rf $$(find $(EMBTK_ROOT)/scripts/ -type f -name '*.*.cmd')
+endef
+
+rmallpath:
+ $(Q)rm -rf $(embtk_pkgb)* $(embtk_rootfs)* $(embtk_tools)* $(embtk_toolsb)*
+ $(Q)rm -rf $(EMBTK_ROOT)/host-tools-*
+ $(Q)rm -rf $(EMBTK_ROOT)/sysroot-*
+ $(Q)rm -rf $(EMBTK_ROOT)/tools-*
+ $(Q)rm -rf $(embtk_sysroot)* $(embtk_htools)* $(embtk_generated)/rootfs-*
+ $(Q)$(if $(CONFIG_EMBTK_CACHE_PATCHES),,rm -rf $(embtk_dldir)/*.patch)
diff --git a/core/mk/eglibc.mk b/core/mk/eglibc.mk
new file mode 100644
index 0000000..959283d
--- /dev/null
+++ b/core/mk/eglibc.mk
@@ -0,0 +1,127 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2014 Abdoulaye Walsimou GAYE.
+#
+# 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 eglibc.mk
+# \brief eglibc.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date May 2009
+################################################################################
+
+EGLIBC_NAME := eglibc
+EGLIBC_VERSION := $(call embtk_get_pkgversion,eglibc)
+EGLIBC_SVN_SITE := http://www.eglibc.org/svn
+EGLIBC_SRC_DIR := $(call __embtk_pkg_localsvn,eglibc)
+EGLIBC_BUILD_DIR := $(embtk_toolsb)/eglibc-build
+
+__embtk_eglibc_cflags := $(filter-out $(__clang_cflags),$(TARGET_CFLAGS))
+__embtk_eglibc_cflags += $(EMBTK_TARGET_MCPU)
+__embtk_eglibc_cflags += $(EMBTK_TARGET_ABI) $(EMBTK_TARGET_FLOAT_CFLAGS)
+__embtk_eglibc_cflags += $(EMBTK_TARGET_MARCH) -pipe
+# eglibc does not support -O0 optimization
+embtk_eglibc_cflags := $(subst -O0,-O1,$(__embtk_eglibc_cflags))
+
+# Hard or soft floating point in eglibc?
+embtk_eglibc_floattype := $(if $(CONFIG_EMBTK_SOFTFLOAT),--with-fp=no,--with-fp=yes)
+
+# Versioning in eglibc
+embtk_eglibc_versioning-$(CONFIG_EMBTK_EGLIBC_DISABLE_VERSIONING) := \
+ --disable-versioning
+embtk_eglibc-sunrpc-$(CONFIG_KEMBTK_EGLIBC_OPTION_EGLIBC_SUNRPC) := \
+ --enable-obsolete-rpc=yes
+
+embtk_eglibc_optgroups_f := $(EMBTK_ROOT)/core/mk/eglibc/eglibc-$(EGLIBC_VERSION)-options.mk
+eglibc_optgroups_f := $(EGLIBC_BUILD_DIR)/option-groups.config
+
+ifeq ($(embtk_buildhost_os_type),bsd)
+embtk_eglibc_buildcflags := -I/usr/local/include
+embtk_eglibc_buildldflags := -L/usr/local/lib -lintl
+endif
+
+#
+# eglibc install
+#
+
+define embtk_configure_eglibc
+ cd $(EGLIBC_BUILD_DIR); \
+ BUILD_CC="$(hostcc_cached)" \
+ CFLAGS="$(embtk_eglibc_cflags)" \
+ CC=$(TARGETGCC_CACHED) \
+ CXX=$(TARGETGCXX_CACHED) \
+ AR=$(TARGETAR) \
+ RANLIB=$(TARGETRANLIB) \
+ READELF=$(TARGETREADELF) \
+ NM=$(TARGETNM) \
+ OBJCOPY=$(TARGETOBJCOPY) \
+ OBJDUMP=$(TARGETDUMP) \
+ $(CONFIG_EMBTK_SHELL) $(EGLIBC_SRC_DIR)/libc/configure \
+ --prefix=/usr --with-headers=$(embtk_sysroot)/usr/include \
+ --host=$(STRICT_GNU_TARGET) \
+ --target=$(STRICT_GNU_TARGET) \
+ --build=$(HOST_BUILD) \
+ $(embtk_eglibc_floattype) --disable-profile --without-gd --without-cvs \
+ --enable-add-ons --enable-kernel="2.6.27" \
+ $(embtk_eglibc_versioning-y) \
+ $(embtk_eglibc-sunrpc-y) \
+ --with-bugurl=$(EMBTK_BUGURL) \
+ --with-pkgversion="EGLIBC from embtoolkit-$(EMBTK_VERSION)"
+ $(call __embtk_setconfigured_pkg,eglibc)
+endef
+
+define __embtk_install_eglibc
+ $(call embtk_pinfo,"Installing eglibc...")
+ $(call embtk_download_pkg,eglibc)
+ touch `find $(EGLIBC_SRC_DIR) -name configure`
+ $(embtk_parse_eglibc_optgroups)
+ $(embtk_configure_eglibc)
+ PATH=$(PATH):$(embtk_tools)/bin/ $(MAKE) -C $(EGLIBC_BUILD_DIR) $(J) \
+ BUILD_CFLAGS="$(embtk_eglibc_buildcflags)" \
+ BUILD_LDFLAGS="$(embtk_eglibc_buildldflags)"
+ PATH=$(PATH):$(embtk_tools)/bin/ $(MAKE) -C $(EGLIBC_BUILD_DIR) \
+ BUILD_CFLAGS="$(embtk_eglibc_buildcflags)" \
+ BUILD_LDFLAGS="$(embtk_eglibc_buildldflags)" \
+ install_root=$(embtk_sysroot) install
+ $(call __embtk_setinstalled_pkg,eglibc)
+ $(call __embtk_pkg_gen_dotkconfig_f,eglibc)
+ $(eval __embtk_eglibc_installed := y)
+endef
+
+define embtk_install_eglibc
+ $(if $(call __embtk_pkg_runrecipe-y,eglibc),$(__embtk_install_eglibc))
+endef
+
+#
+# clean targets
+#
+define embtk_cleanup_eglibc
+ rm -rf $(EGLIBC_BUILD_DIR)
+endef
+
+#
+# options groups parsing
+#
+__embtk_get_eglibc_optgroups = grep "CONFIG_KEMBTK_EGLIBC_" $(EMBTK_DOTCONFIG) \
+ | sed -e 's/CONFIG_KEMBTK_EGLIBC_*//g' | sed -e 's/"//g'
+define embtk_parse_eglibc_optgroups
+ mkdir -p $(EGLIBC_BUILD_DIR)
+ cat $(embtk_eglibc_optgroups_f) > $(eglibc_optgroups_f)
+ echo "###############################" >> $(eglibc_optgroups_f)
+ echo "# From embtk-$(EMBTK_VERSION) #" >> $(eglibc_optgroups_f)
+ echo "###############################" >> $(eglibc_optgroups_f)
+ $(__embtk_get_eglibc_optgroups) >> $(eglibc_optgroups_f)
+endef
diff --git a/core/mk/eglibc/eglibc-2.17-options.mk b/core/mk/eglibc/eglibc-2.17-options.mk
new file mode 120000
index 0000000..5604f57
--- /dev/null
+++ b/core/mk/eglibc/eglibc-2.17-options.mk
@@ -0,0 +1 @@
+eglibc-trunk-options.mk \ No newline at end of file
diff --git a/core/mk/eglibc/eglibc-trunk-options.mk b/core/mk/eglibc/eglibc-trunk-options.mk
new file mode 100644
index 0000000..9c3c7eb
--- /dev/null
+++ b/core/mk/eglibc/eglibc-trunk-options.mk
@@ -0,0 +1,64 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2013 GAYE Abdoulaye Walsimou.
+#
+# 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 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, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
+################################################################################
+#
+# \file eglibc-trunk-options.mk
+# \brief eglibc-trunk-options.mk. Here we define options supported by
+# \brief eglibc-trunk.
+# \author GAYE Abdoulaye Walsimou, <walsimou@walsimou.com>
+# \date August 2009
+################################################################################
+
+OPTION_EGLIBC_ADVANCED_INET6=n
+OPTION_EGLIBC_BACKTRACE=n
+OPTION_EGLIBC_BIG_MACROS=n
+OPTION_EGLIBC_BSD=n
+OPTION_EGLIBC_CXX_TESTS=n
+OPTION_EGLIBC_CATGETS=n
+OPTION_EGLIBC_CHARSETS=n
+OPTION_EGLIBC_CRYPT=n
+OPTION_EGLIBC_CRYPT_UFC=n
+OPTION_EGLIBC_DB_ALIASES=n
+OPTION_EGLIBC_ENVZ=n
+OPTION_EGLIBC_FCVT=n
+OPTION_EGLIBC_FMTMSG=n
+OPTION_EGLIBC_FSTAB=n
+OPTION_EGLIBC_FTRAVERSE=n
+OPTION_EGLIBC_GETLOGIN=n
+OPTION_EGLIBC_IDN=n
+OPTION_EGLIBC_INET=n
+OPTION_EGLIBC_INET_ANL=n
+OPTION_EGLIBC_LIBM=n
+OPTION_EGLIBC_LIBM_BIG=n
+OPTION_EGLIBC_LOCALES=n
+OPTION_EGLIBC_LOCALE_CODE=n
+OPTION_EGLIBC_MEMUSAGE=n
+OPTION_EGLIBC_NIS=n
+OPTION_EGLIBC_NSSWITCH=n
+OPTION_EGLIBC_RCMD=n
+OPTION_EGLIBC_RTLD_DEBUG=n
+OPTION_EGLIBC_SPAWN=n
+OPTION_EGLIBC_STREAMS=n
+OPTION_EGLIBC_SUNRPC=n
+OPTION_EGLIBC_UTMP=n
+OPTION_EGLIBC_UTMPX=n
+OPTION_EGLIBC_WORDEXP=n
+OPTION_POSIX_C_LANG_WIDE_CHAR=n
+OPTION_POSIX_REGEXP=n
+OPTION_POSIX_REGEXP_GLIBC=n
+OPTION_POSIX_WIDE_CHAR_DEVICE_IO=n
+
diff --git a/core/mk/glibc.mk b/core/mk/glibc.mk
new file mode 100644
index 0000000..ad72875
--- /dev/null
+++ b/core/mk/glibc.mk
@@ -0,0 +1,106 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2013 Abdoulaye Walsimou GAYE.
+#
+# 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 glibc.mk
+# \brief glibc.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date December 2013
+################################################################################
+
+GLIBC_NAME := glibc
+GLIBC_VERSION := $(call embtk_get_pkgversion,glibc)
+GLIBC_SITE := http://ftp.gnu.org/gnu/glibc
+GLIBC_GIT_SITE := git://sourceware.org/git/glibc.git
+GLIBC_PACKAGE := glibc-$(GLIBC_VERSION).tar.xz
+GLIBC_SRC_DIR := $(embtk_toolsb)/glibc-$(GLIBC_VERSION)
+GLIBC_BUILD_DIR := $(embtk_toolsb)/glibc-$(GLIBC_VERSION)-build
+
+
+__embtk_glibc_cflags := $(filter-out $(__clang_cflags),$(TARGET_CFLAGS))
+__embtk_glibc_cflags += $(EMBTK_TARGET_MCPU)
+__embtk_glibc_cflags += $(EMBTK_TARGET_ABI) $(EMBTK_TARGET_FLOAT_CFLAGS)
+__embtk_glibc_cflags += $(EMBTK_TARGET_MARCH)
+# glibc does not support -O0 optimization
+embtk_glibc_cflags := $(subst -O0,-O1,$(__embtk_glibc_cflags))
+
+# Hard or soft floating point in glibc?
+embtk_glibc_floattype := $(if $(CONFIG_EMBTK_SOFTFLOAT),--with-fp=no,--with-fp=yes)
+
+ifeq ($(embtk_buildhost_os_type),bsd)
+embtk_glibc_buildcflags := -I/usr/local/include
+embtk_glibc_buildldflags := -L/usr/local/lib -lintl
+endif
+
+#
+# glibc install
+#
+
+define embtk_configure_glibc
+ cd $(GLIBC_BUILD_DIR); \
+ BUILD_CC="$(hostcc_cached)" \
+ CFLAGS="$(embtk_glibc_cflags)" \
+ CC=$(TARGETGCC_CACHED) \
+ CXX=$(TARGETGCXX_CACHED) \
+ AR=$(TARGETAR) \
+ RANLIB=$(TARGETRANLIB) \
+ READELF=$(TARGETREADELF) \
+ NM=$(TARGETNM) \
+ OBJCOPY=$(TARGETOBJCOPY) \
+ OBJDUMP=$(TARGETDUMP) \
+ $(CONFIG_EMBTK_SHELL) $(GLIBC_SRC_DIR)/configure \
+ --prefix=/usr --with-headers=$(embtk_sysroot)/usr/include \
+ --host=$(STRICT_GNU_TARGET) \
+ --target=$(STRICT_GNU_TARGET) \
+ --build=$(HOST_BUILD) \
+ $(embtk_glibc_floattype) --disable-profile --without-gd --without-cvs \
+ --without-selinux --enable-add-ons --enable-kernel="2.6.27" \
+ --enable-obsolete-rpc --disable-build-nscd --disable-nscd \
+ --with-bugurl=$(EMBTK_BUGURL) \
+ --with-pkgversion="GLIBC from embtoolkit-$(EMBTK_VERSION)"
+ $(call __embtk_setconfigured_pkg,glibc)
+endef
+
+define __embtk_install_glibc
+ $(call embtk_pinfo,"Installing glibc...")
+ $(call embtk_download_pkg,glibc)
+ $(call embtk_decompress_pkg,glibc)
+ mkdir -p $(GLIBC_BUILD_DIR)
+ $(embtk_configure_glibc)
+ PATH=$(PATH):$(embtk_tools)/bin/ $(MAKE) -C $(GLIBC_BUILD_DIR) $(J) \
+ BUILD_CFLAGS="$(embtk_glibc_buildcflags)" \
+ BUILD_LDFLAGS="$(embtk_glibc_buildldflags)"
+ PATH=$(PATH):$(embtk_tools)/bin/ $(MAKE) -C $(GLIBC_BUILD_DIR) \
+ BUILD_CFLAGS="$(embtk_glibc_buildcflags)" \
+ BUILD_LDFLAGS="$(embtk_glibc_buildldflags)" \
+ install_root=$(embtk_sysroot) install
+ $(call __embtk_setinstalled_pkg,glibc)
+ $(call __embtk_pkg_gen_dotkconfig_f,glibc)
+ $(eval __embtk_glibc_installed := y)
+endef
+
+define embtk_install_glibc
+ $(if $(call __embtk_pkg_runrecipe-y,glibc),$(__embtk_install_glibc))
+endef
+
+#
+# clean targets
+#
+define embtk_cleanup_glibc
+ rm -rf $(GLIBC_BUILD_DIR)
+endef
diff --git a/core/mk/gmake.mk b/core/mk/gmake.mk
new file mode 100644
index 0000000..2451638
--- /dev/null
+++ b/core/mk/gmake.mk
@@ -0,0 +1,39 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2013 Abdoulaye Walsimou GAYE.
+#
+# 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 gmake.mk
+# \brief gmake.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date March 2013
+################################################################################
+
+GMAKE_NAME := gmake
+GMAKE_VERSION := $(call embtk_get_pkgversion,gmake)
+GMAKE_SITE := http://ftp.gnu.org/gnu/make
+GMAKE_PACKAGE := make-$(GMAKE_VERSION).tar.bz2
+GMAKE_SRC_DIR := $(embtk_toolsb)/make-$(GMAKE_VERSION)
+GMAKE_BUILD_DIR := $(embtk_toolsb)/make-$(GMAKE_VERSION)
+
+define embtk_install_gmake
+ $(call __embtk_install_hostpkg,gmake)
+endef
+
+define embtk_postinstallonce_gmake
+ mv $(embtk_htools)/usr/bin/make $(embtk_htools)/usr/bin/gmake
+endef
diff --git a/core/mk/gmp.mk b/core/mk/gmp.mk
new file mode 100644
index 0000000..aa48721
--- /dev/null
+++ b/core/mk/gmp.mk
@@ -0,0 +1,41 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2011 Abdoulaye Walsimou GAYE.
+#
+# 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 gmp.mk
+# \brief gmp.mk of Embtoolkit for toolchain
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date May 2009
+################################################################################
+
+GMP_HOST_NAME := gmp
+GMP_HOST_VERSION := $(call embtk_get_pkgversion,gmp_host)
+GMP_HOST_SITE := ftp://ftp.gmplib.org/pub/gmp-$(GMP_HOST_VERSION)
+GMP_HOST_PACKAGE := gmp-$(GMP_HOST_VERSION).tar.bz2
+GMP_HOST_SRC_DIR := $(embtk_toolsb)/gmp-$(GMP_HOST_VERSION)
+GMP_HOST_BUILD_DIR := $(embtk_toolsb)/gmp-build
+GMP_HOST_DIR := $(embtk_htools)/usr/local/gmp-host
+
+export GMP_HOST_DIR
+
+GMP_HOST_CONFIGURE_OPTS := --disable-shared --enable-static
+GMP_HOST_PREFIX := $(GMP_HOST_DIR)
+
+define embtk_cleanup_gmp_host
+ rm -rf $(GMP_HOST_BUILD_DIR)
+endef
diff --git a/core/mk/gperf_host.mk b/core/mk/gperf_host.mk
new file mode 100644
index 0000000..f4ab8c9
--- /dev/null
+++ b/core/mk/gperf_host.mk
@@ -0,0 +1,35 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2011-2012 Abdoulaye Walsimou GAYE.
+#
+# 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 gperf_host.mk
+# \brief gperf_host.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date June 2011
+################################################################################
+
+GPERF_HOST_NAME := gperf
+GPERF_HOST_VERSION := $(call embtk_get_pkgversion,gperf_host)
+GPERF_HOST_SITE := http://ftp.gnu.org/gnu/gperf
+GPERF_HOST_PACKAGE := gperf-$(GPERF_HOST_VERSION).tar.gz
+GPERF_HOST_SRC_DIR := $(embtk_toolsb)/gperf-$(GPERF_HOST_VERSION)
+GPERF_HOST_BUILD_DIR := $(embtk_toolsb)/gperf-$(GPERF_HOST_VERSION)
+
+define embtk_cleanup_gperf_host
+ rm -rf $(GPERF_HOST_BUILD_DIR)
+endef
diff --git a/core/mk/gsed.mk b/core/mk/gsed.mk
new file mode 100644
index 0000000..d028c9a
--- /dev/null
+++ b/core/mk/gsed.mk
@@ -0,0 +1,35 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2013 Abdoulaye Walsimou GAYE.
+#
+# 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 gsed.mk
+# \brief gsed.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date March 2013
+################################################################################
+
+GSED_NAME := gsed
+GSED_VERSION := $(call embtk_get_pkgversion,gsed)
+GSED_SITE := http://ftp.gnu.org/gnu/sed
+GSED_PACKAGE := sed-$(GSED_VERSION).tar.bz2
+GSED_SRC_DIR := $(embtk_toolsb)/sed-$(GSED_VERSION)
+GSED_BUILD_DIR := $(embtk_toolsb)/sed-$(GSED_VERSION)
+
+define embtk_install_gsed
+ $(call __embtk_install_hostpkg,gsed)
+endef
diff --git a/core/mk/help.mk b/core/mk/help.mk
new file mode 100644
index 0000000..02ccd6a
--- /dev/null
+++ b/core/mk/help.mk
@@ -0,0 +1,104 @@
+################################################################################
+# EmbToolkit
+# Copyright(C) 2011 Abdoulaye Walsimou GAYE.
+#
+# 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 help.mk
+# \brief help.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date August 2011
+################################################################################
+
+help:
+ $(call embtk_pinfo,"Embedded systems Toolkit help. Please \
+ visit - http://www.embtoolkit.org - for more details")
+ @echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~ "
+ @echo "| Building and configuring: |"
+ @echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~ "
+ @echo "make xconfig: Show EmbToolkit configure GUI and let you to"
+ @echo " configure your toolchain and your root"
+ @echo " filesystem (if selected)."
+ @echo
+ @echo "make menuconfig: Same as xconfig but using this time ncurse GUI."
+ @echo
+ @echo "make olddefconfig: Update silently current config utilising a"
+ @echo " provided .config as base, and sets new"
+ @echo " symbols to their default value."
+ @echo
+ @echo "make: Start building your toolchain and your root"
+ @echo " filesystem (if selected) or start xconfig if"
+ @echo " you did not configure before."
+ @echo
+ @echo " ~~~~~~~~~~~ "
+ @echo "| Cleaning: |"
+ @echo " ~~~~~~~~~~~ "
+ @echo "make clean: Remove all built files, but keep downloaded"
+ @echo " packages."
+ @echo
+ @echo "make distclean: WARNING: like clean, but remove all downloaded"
+ @echo " packages and .config.old files."
+ @echo
+ @echo " ~~~~~~~~~~~~~~~~~ "
+ @echo "| Root filesystem |"
+ @echo " ~~~~~~~~~~~~~~~~~ "
+ @echo "make rootfs_build:"
+ @echo " if after a first build of your toolchain and"
+ @echo " your root filesystem, you change the contents"
+ @echo " of the root filesystem, use this target to"
+ @echo " rebuild it."
+ @echo
+ @echo " ~~~~~~~~~~~~~~~ "
+ @echo "| miscellaneous |"
+ @echo " ~~~~~~~~~~~~~~~ "
+ @echo "make packages_fetch:"
+ @echo " This will download all needed packages tarball."
+ @echo " This should be used after configuration and if"
+ @echo " you want to do an offline build."
+ @echo
+
+# Successful build of EmbToolkit message
+successful_build:
+ $(call embtk_echo_blue," ~~~~~~~~~~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"| Toolchain build log |")
+ $(call embtk_echo_blue," ~~~~~~~~~~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"$(GNU_TARGET) ($(EMBTK_MCU_FLAG)) toolchain successfully generated.")
+ $(call embtk_echo_blue,"Generated tools (compilers, Binutils, etc.) are in:")
+ $(call embtk_echo_blue," $(embtk_tools)/bin")
+ $(call embtk_echo_blue,"The packaged toolchain (for external use) is in:")
+ $(call embtk_echo_blue," $(embtk_generated)")
+ @echo
+ $(call embtk_echo_blue," ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"| Root file system build log |")
+ $(call embtk_echo_blue," ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ")
+ifeq ($(CONFIG_EMBTK_HAVE_ROOTFS),y)
+ $(call embtk_echo_blue,"Generated root filesystems are located in the")
+ $(call embtk_echo_blue,"'generated' sub-directory of EmbToolkit.")
+else
+ $(call embtk_echo_green,"Build of root filesystem not selected.")
+endif
+ @echo
+ $(call embtk_echo_blue," ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"| Embedded systems Toolkit |")
+ $(call embtk_echo_blue," ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ")
+ $(call embtk_echo_blue,"We hope that EmbToolkit will be useful for your project !!!")
+ $(call embtk_echo_blue,"We will be happy to know it at embtk-users@embtoolkit.org")
+ $(call embtk_echo_blue,"Please report any bugs/suggestion at:")
+ $(call embtk_echo_blue," $(EMBTK_BUGURL)")
+ $(call embtk_echo_blue,"You can also visit the wiki at:")
+ $(call embtk_echo_blue," http://www.embtoolkit.org")
+ @echo
+ $(call embtk_echo_blue,$(__embtk_msg_h))
diff --git a/core/mk/libtool.mk b/core/mk/libtool.mk
new file mode 100644
index 0000000..cdcd29e
--- /dev/null
+++ b/core/mk/libtool.mk
@@ -0,0 +1,41 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2010-2013 Abdoulaye Walsimou GAYE.
+#
+# 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 libtool.mk
+# \brief libtool.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date March 2010
+################################################################################
+
+LIBTOOL_NAME := libtool
+LIBTOOL_VERSION := $(call embtk_get_pkgversion,libtool)
+LIBTOOL_SITE := http://ftp.gnu.org/gnu/libtool
+LIBTOOL_PACKAGE := libtool-$(LIBTOOL_VERSION).tar.gz
+LIBTOOL_SRC_DIR := $(embtk_toolsb)/libtool-$(LIBTOOL_VERSION)
+LIBTOOL_BUILD_DIR := $(embtk_toolsb)/libtool-$(LIBTOOL_VERSION)
+
+LIBTOOL := $(embtk_htools)/usr/bin/libtool
+LIBTOOLIZE := $(embtk_htools)/usr/bin/libtoolize
+export LIBTOOL LIBTOOLIZE
+
+LIBTOOL_CONFIGURE_OPTS := --disable-ltdl-install
+
+define embtk_install_libtool
+ $(call __embtk_install_hostpkg,libtool)
+endef
diff --git a/core/mk/linux.mk b/core/mk/linux.mk
new file mode 100644
index 0000000..b9a08ff
--- /dev/null
+++ b/core/mk/linux.mk
@@ -0,0 +1,138 @@
+#################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2014 Abdoulaye Walsimou GAYE.
+#
+# 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 linux.mk
+# \brief linux.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date May 2009
+################################################################################
+
+__LINUX_SITE_BASE = http://ftp.kernel.org/pub/linux/kernel
+__LINUX_SITE_LONGTERM = $(strip $(if $(LINUX_LONGTERMV), \
+ /longterm/$(LINUX_LONGTERMV)))
+__LINUX_SITE = $(strip $(if $(CONFIG_EMBTK_LINUX_HAVE_MIRROR), \
+ $(patsubst '"',,$(strip $(CONFIG_EMBTK_LINUX_HAVE_MIRROR_SITE))), \
+ $(__LINUX_SITE_BASE)/$(LINUX_MAJORV)$(__LINUX_SITE_LONGTERM)))
+
+LINUX_NAME := linux
+LINUX_MAJORV := $(call embtk_get_pkgversion,linux_major)
+LINUX_LONGTERMV := $(call embtk_get_pkgversion,linux_longterm)
+LINUX_VERSION := $(call embtk_get_pkgversion,linux)
+LINUX_SITE := $(call __LINUX_SITE)
+LINUX_PACKAGE := linux-$(LINUX_VERSION).tar.xz
+LINUX_SRC_DIR := $(embtk_toolsb)/linux-$(LINUX_VERSION)
+LINUX_BUILD_DIR := $(embtk_toolsb)/linux-$(LINUX_VERSION)
+LINUX_KEEP_SRC_DIR := $(CONFIG_EMBTK_BUILD_LINUX_KERNEL)
+
+LINUX_HEADERS_NAME := linux_headers
+LINUX_HEADERS_VERSION := $(LINUX_VERSION)
+LINUX_HEADERS_SITE := $(LINUX_SITE)
+LINUX_HEADERS_PACKAGE := $(LINUX_PACKAGE)
+LINUX_HEADERS_SRC_DIR := $(LINUX_SRC_DIR)
+LINUX_HEADERS_BUILD_DIR := $(LINUX_BUILD_DIR)
+LINUX_HEADERS_KCONFIGS_NAME := LINUX
+LINUX_HEADERS_KEEP_SRC_DIR := $(CONFIG_EMBTK_BUILD_LINUX_KERNEL)
+
+LINUX_MAKE_OPTS := quiet=quiet_
+LINUX_MAKE_OPTS += ARCH=$(LINUX_ARCH)
+LINUX_MAKE_OPTS += CROSS_COMPILE=$(CROSS_COMPILE_CACHED)
+LINUX_MAKE_OPTS += HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)"
+
+define __embtk_install_linux_headers
+ $(call embtk_pinfo,"Installing linux-$(LINUX_VERSION) headers...")
+ $(call embtk_download_pkg,linux)
+ $(call embtk_decompress_pkg,linux)
+ $(MAKE) -C $(LINUX_BUILD_DIR) $(LINUX_MAKE_OPTS) \
+ INSTALL_HDR_PATH=$(embtk_sysroot)/usr headers_install
+ $(call __embtk_setinstalled_pkg,linux_headers)
+ $(call __embtk_pkg_gen_dotkconfig_f,linux_headers)
+ $(eval __embtk_linux_headers_installed := y)
+endef
+define embtk_install_linux_headers
+ $(if $(call __embtk_pkg_runrecipe-y,linux_headers),$(__embtk_install_linux_headers))
+endef
+
+#
+# linux install macros
+#
+
+__embtk_linux_dotconfig_f := $(call __embtk_mk_uquote,$(CONFIG_EMBTK_LINUX_DOTCONFIG))
+__embtk_linux_srcdir := $(call __embtk_mk_uquote,$(or $(CONFIG_EMBTK_LINUX_BUILD_EXTSRC),$(LINUX_SRC_DIR)))
+__embtk_linux_support_modules := $(shell grep MODULES=y "$(__embtk_linux_dotconfig_f)" 2>/dev/null)
+
+define __embtk_install_linux_check_config
+ if [ "x" = "x$(__embtk_linux_dotconfig_f)" ]; then \
+ $(call embtk_perror,"Unable to build linux kernel image: no config file");\
+ exit 1; \
+ fi
+ if [ ! -e $(__embtk_linux_dotconfig_f) ]; then \
+ $(call embtk_perror,"Unable to build linux kernel image: config file $(__embtk_linux_dotconfig_f) not found");\
+ exit 1; \
+ fi
+endef
+
+define __embtk_install_linux_check_extsrc
+ if [ "x" = "x$(__embtk_linux_srcdir)" ]; then \
+ $(call embtk_perror,"Unable to build linux kernel image: External source tree not specified");\
+ exit 1; \
+ fi
+ if [ ! -d $(__embtk_linux_srcdir) ]; then \
+ $(call embtk_perror,"Unable to build linux kernel image: External source tree $(__embtk_linux_srcdir) not found");\
+ exit 1; \
+ fi
+endef
+
+define __embtk_install_linux
+ $(call embtk_pinfo,"Generating linux kernel image...")
+ $(__embtk_install_linux_check_config)
+ $(if $(CONFIG_EMBTK_LINUX_BUILD_USE_EXTSRC),
+ $(__embtk_install_linux_check_extsrc))
+ $(if $(CONFIG_EMBTK_LINUX_BUILD_TOOLCHAIN_SRC),
+ $(call embtk_download_pkg,linux)
+ $(call embtk_decompress_pkg,linux))
+ $(MAKE) -C $(__embtk_linux_srcdir) $(LINUX_MAKE_OPTS) distclean
+ cp $(CONFIG_EMBTK_LINUX_DOTCONFIG) $(__embtk_linux_srcdir)/.config
+ $(MAKE) -C $(__embtk_linux_srcdir) $(LINUX_MAKE_OPTS) silentoldconfig
+ $(MAKE) -C $(__embtk_linux_srcdir) $(LINUX_MAKE_OPTS) $(J)
+ $(call __embtk_setinstalled_pkg,linux)
+ $(call __embtk_pkg_gen_dotkconfig_f,linux)
+ $(eval __embtk_linux_installed := y)
+endef
+
+define embtk_install_linux
+ $(if $(call __embtk_pkg_runrecipe-y,linux),$(__embtk_install_linux))
+ $(if $(__embtk_linux_support_modules),$(embtk_postinstall_linux))
+endef
+
+define embtk_postinstall_linux
+ $(call embtk_pinfo,"Install linux kernel modules...")
+ $(MAKE) -C $(__embtk_linux_srcdir) $(LINUX_MAKE_OPTS) \
+ INSTALL_MOD_PATH=$(embtk_rootfs) modules_install
+endef
+
+#
+# clean target and macros
+#
+define embtk_cleanup_linux
+ [ -d $(LINUX_BUILD_DIR) ] && $(call __embtk_unsetinstalled_pkg,linux) ||:
+endef
+
+define embtk_cleanup_linux_headers
+ [ -d $(LINUX_BUILD_DIR) ] && $(call __embtk_unsetinstalled_pkg,linux_headers) ||:
+endef
diff --git a/core/mk/m4.mk b/core/mk/m4.mk
new file mode 100644
index 0000000..890b269
--- /dev/null
+++ b/core/mk/m4.mk
@@ -0,0 +1,42 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2010-2013 Abdoulaye Walsimou GAYE.
+#
+# 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 m4.mk
+# \brief m4.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date February 2010
+################################################################################
+
+M4_NAME := m4
+M4_VERSION := $(call embtk_get_pkgversion,m4)
+M4_SITE := http://ftp.gnu.org/gnu/m4
+M4_SITE_MIRROR3 := ftp://ftp.embtoolkit.org/embtoolkit.org/packages-mirror
+M4_PACKAGE := m4-$(M4_VERSION).tar.bz2
+M4_SRC_DIR := $(embtk_toolsb)/m4-$(M4_VERSION)
+M4_BUILD_DIR := $(embtk_toolsb)/m4-$(M4_VERSION)
+
+# m4 binaries
+M4_DIR := $(embtk_htools)/usr
+M4_BIN := $(M4_DIR)/bin/m4
+M4 := $(M4_BIN)
+export M4
+
+define embtk_install_m4
+ $(call __embtk_install_hostpkg,m4)
+endef
diff --git a/core/mk/macros.mk b/core/mk/macros.mk
new file mode 100644
index 0000000..f0e44cf
--- /dev/null
+++ b/core/mk/macros.mk
@@ -0,0 +1,132 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2014 Abdoulaye Walsimou GAYE.
+#
+# 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 macros.mk
+# \brief macros.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date May 2009
+################################################################################
+
+# Embtoolkit colors
+__embtk_color_red = "\033[1;31m"
+__embtk_color_green = "\033[1;32m"
+__embtk_color_yellow = "\033[0;33m"
+__embtk_color_blue = "\033[1;34m"
+__embtk_no_color = "\033[0m"
+
+#
+# echo colored text
+# usage: $(call embtk_echo_{color},msg)
+#
+embtk_echo_red = printf $(__embtk_color_red)$(1)$(__embtk_no_color)"\n"
+embtk_echo_green = printf $(__embtk_color_green)$(1)$(__embtk_no_color)"\n"
+embtk_echo_yellow = printf $(__embtk_color_yellow)$(1)$(__embtk_no_color)"\n"
+embtk_echo_blue = printf $(__embtk_color_blue)$(1)$(__embtk_no_color)"\n"
+
+__embtk_msg_h = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+
+#
+# __embtk_streq:
+# A macro for two strings comparison. It returns y if the strings are identical
+# and nothing if not.
+# Note: This macro strips passed parameters
+# Usage:
+# $(call __embtk_streq,str1,str2)
+#
+__embtk_streq = $(if $(subst $(1),,$(2))$(subst $(2),,$(1)),,y)
+
+#
+# __embtk_strneq:
+# A macro for two strings comparison. It returns y if the strings are different
+# and nothing if they are the same.
+# Note: This macro strips passed parameters
+# Usage:
+# $(call __embtk_strneq,str1,str2)
+#
+__embtk_strneq = $(if $(subst $(1),,$(2))$(subst $(2),,$(1)),y)
+
+#
+# __embtk_mk_pathexist
+# A macro to test if a path exists. It returns y if the path exists and nothing
+# if not.
+# Usage: $(call __embtk_mk_pathexist,/path/to/test)
+#
+__embtk_mk_pathexist = $(shell test -e $(1) && echo y)
+
+#
+# __embtk_mk_pathnotexist
+# A macro to test if a path does not exist. It returns y if the path does not
+# exist and nothing if it exists.
+# Usage: $(call __embtk_mk_pathnotexist,/path/to/test)
+#
+__embtk_mk_pathnotexist = $(shell test -e $(1) || echo y)
+
+#
+# __embtk_mk_uquote
+# A macro to unquote a string.
+# Usage: $(call __embtk_mk_uquote,$(myquotedvar))
+#
+__embtk_mk_uquote = $(subst ",,$(strip $(1)))
+
+# Macro to print messages
+embtk_pwarning = $(call embtk_echo_yellow,"$(__embtk_msg_h)\\n~~ EmbToolkit ~~ WARNING: $(call __embtk_mk_uquote,$(1))\\n$(__embtk_msg_h)")
+embtk_perror = $(call embtk_echo_red,"$(__embtk_msg_h)\\n~~ EmbToolkit ~~ ERROR: $(call __embtk_mk_uquote,$(1))\\n$(__embtk_msg_h)")
+embtk_pinfo = $(call embtk_echo_blue,"$(__embtk_msg_h)\\n~~ EmbToolkit ~~ $(call __embtk_mk_uquote,$(1))\\n$(__embtk_msg_h)")
+embtk_pdone = $(call embtk_echo_blue,"[✔] Done : $(call __embtk_mk_uquote,$(1))")
+embtk_pfailed = $(call embtk_echo_red,"[✘] Failed: $(call __embtk_mk_uquote,$(1))")
+
+# Macros for emmpty, space and comma
+embtk_empty :=
+embtk_space := $(embtk_empty) $(embtk_empty)
+embtk_comma := ,
+
+#
+# Macros to change strings case (upper->lower or lower to upper)
+#
+[U-l] := A,a B,b C,c D,d E,e F,f G,g H,h I,i J,j K,k L,l M,m N,n O,o P,p Q,q R,r S,s T,t U,u V,v W,w X,x Y,y Z,z
+[l-U] := a,A b,B c,C d,D e,E f,F g,G h,H i,I j,J k,K l,L m,M n,N o,O p,P q,Q r,R s,S t,T u,U v,V w,W x,X y,Y z,Z
+
+embtk_lcase = $(strip $(call __embtk_lcase,$(1)))
+define __embtk_lcase
+ $(eval __lcase := $(1))
+ $(foreach __c,$([U-l]),
+ $(eval __c1 := $(word 1,$(subst $(embtk_comma),$(embtk_space),$(__c))))
+ $(eval __c2 := $(word 2,$(subst $(embtk_comma),$(embtk_space),$(__c))))
+ $(eval __lcase := $(subst $(__c1),$(__c2),$(__lcase))))$(__lcase)
+endef
+
+embtk_ucase = $(strip $(call __embtk_ucase,$(1)))
+define __embtk_ucase
+ $(eval __ucase := $(1))
+ $(foreach __c,$([l-U]),
+ $(eval __c1 := $(word 1,$(subst $(embtk_comma),$(embtk_space),$(__c))))
+ $(eval __c2 := $(word 2,$(subst $(embtk_comma),$(embtk_space),$(__c))))
+ $(eval __ucase := $(subst $(__c1),$(__c2),$(__ucase))))$(__ucase)
+endef
+
+#
+# Packages management macros
+include core/mk/pkg-macros/vars.mk
+include core/mk/pkg-macros/incl.mk
+include core/mk/pkg-macros/pkg-config.mk
+include core/mk/pkg-macros/libtool.mk
+include core/mk/pkg-macros/download.mk
+include core/mk/pkg-macros/configure.mk
+include core/mk/pkg-macros/install.mk
+include core/mk/pkg-macros/clean.mk
diff --git a/core/mk/makedevs.mk b/core/mk/makedevs.mk
new file mode 100644
index 0000000..ebee7ad
--- /dev/null
+++ b/core/mk/makedevs.mk
@@ -0,0 +1,49 @@
+#########################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2013 Abdoulaye Walsimou GAYE.
+#
+# 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 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, write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
+#########################################################################################
+#
+# \file makedevs.mk
+# \brief makedevs.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date May 2009
+#########################################################################################
+
+MAKEDEVS_NAME := makedevs
+MAKEDEVS_BUILD_DIR := $(embtk_toolsb)/makedevs-build
+MAKEDEVS_SRC := $(EMBTK_ROOT)/src/makedevs
+
+MAKEDEVS_DIR := $(embtk_htools)/usr/bin
+MAKEDEVS_BIN := $(MAKEDEVS_DIR)/makedevs
+
+define embtk_install_makedevs
+ $(MAKE) makedevs_install
+endef
+
+makedevs_install:
+ [ -e $(MAKEDEVS_BUILD_DIR)/.makedevs.embtk.installed ] || \
+ $(MAKE) $(MAKEDEVS_BUILD_DIR)/.makedevs.embtk.installed
+
+$(MAKEDEVS_BUILD_DIR)/.makedevs.embtk.installed:
+ $(call embtk_pinfo,"Installing makedevs...")
+ $(Q)mkdir -p $(MAKEDEVS_BUILD_DIR)
+ $(Q)mkdir -p $(embtk_htools)/usr
+ $(Q)mkdir -p $(embtk_htools)/usr/bin
+ $(hostcc_cached) -o $(MAKEDEVS_BIN) $(wildcard $(MAKEDEVS_SRC)/*.c)
+ $(Q)touch $@
+
+download_makedevs:
+ $(call embtk_pinfo,"makedevs is in embtk source, download not needed...")
diff --git a/core/mk/mkimage.mk b/core/mk/mkimage.mk
new file mode 100644
index 0000000..a83e42e
--- /dev/null
+++ b/core/mk/mkimage.mk
@@ -0,0 +1,50 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2010-2013 Abdoulaye Walsimou GAYE.
+#
+# 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 mkimage.mk
+# \brief mkimage.mk of Embtoolkit. u-boot makimage tool, needed to create
+# \brief uImage.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date August 2010
+################################################################################
+
+MAKEIMAGE_VERSION := 0.4
+MAKEIMAGE_SITE := http://ftp.debian.org/debian/pool/main/u/uboot-mkimage
+MAKEIMAGE_PACKAGE := mkimage-$(MAKEIMAGE_VERSION)-nosource-need.tar.bz2
+MAKEIMAGE_BUILD_DIR := $(embtk_toolsb)/mkimage
+MAKEIMAGE_BIN := $(embtk_htools)/usr/bin/mkimage
+export MAKEIMAGE_BIN
+
+define embtk_install_mkimage
+ $(MAKE) mkimage_install
+endef
+
+mkimage_install:
+ test -e $(MAKEIMAGE_BUILD_DIR)/.installed || \
+ $(MAKE) $(MAKEIMAGE_BUILD_DIR)/.installed
+
+$(MAKEIMAGE_BUILD_DIR)/.installed: zlib_host_install
+ $(Q)cp -R $(EMBTK_ROOT)/src/mkimage $(embtk_toolsb)/
+ $(Q)$(MAKE) -C $(MAKEIMAGE_BUILD_DIR) \
+ CPPFLAGS="-I$(embtk_htools)/usr/include"
+ $(Q)$(MAKE) -C $(MAKEIMAGE_BUILD_DIR) \
+ DESTDIR=$(embtk_htools) install
+ @touch $@
+
+download_mkimage:
diff --git a/core/mk/mpc.mk b/core/mk/mpc.mk
new file mode 100644
index 0000000..8f465ba
--- /dev/null
+++ b/core/mk/mpc.mk
@@ -0,0 +1,43 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2012 Abdoulaye Walsimou GAYE.
+#
+# 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 mpc.mk
+# \brief mpch.mk of Embtoolkit for toolchain
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date Jan 2010
+################################################################################
+
+MPC_HOST_NAME := mpc
+MPC_HOST_VERSION := $(call embtk_get_pkgversion,mpc_host)
+MPC_HOST_SITE := http://www.multiprecision.org/mpc/download
+MPC_HOST_PACKAGE := mpc-$(MPC_HOST_VERSION).tar.gz
+MPC_HOST_SRC_DIR := $(embtk_toolsb)/mpc-$(MPC_HOST_VERSION)
+MPC_HOST_BUILD_DIR := $(embtk_toolsb)/mpc-build
+MPC_HOST_DIR := $(embtk_htools)/usr/local/mpc-host
+
+export MPC_HOST_DIR
+
+MPC_HOST_CONFIGURE_OPTS := --disable-shared --enable-static \
+ --with-gmp=$(GMP_HOST_DIR) \
+ --with-mpfr=$(MPFR_HOST_DIR)
+MPC_HOST_PREFIX := $(MPC_HOST_DIR)
+
+define embtk_cleanup_mpc_host
+ rm -rf $(MPC_HOST_BUILD_DIR)
+endef
diff --git a/core/mk/mpfr.mk b/core/mk/mpfr.mk
new file mode 100644
index 0000000..fc242f6
--- /dev/null
+++ b/core/mk/mpfr.mk
@@ -0,0 +1,42 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2012 Abdoulaye Walsimou GAYE.
+#
+# 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 mpfr.mk
+# \brief mpfr.mk of Embtoolkit for toolchain
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date May 2009
+################################################################################
+
+MPFR_HOST_NAME := mpfr
+MPFR_HOST_VERSION := $(call embtk_get_pkgversion,mpfr_host)
+MPFR_HOST_SITE := http://www.mpfr.org/mpfr-$(MPFR_HOST_VERSION)
+MPFR_HOST_PACKAGE := mpfr-$(MPFR_HOST_VERSION).tar.bz2
+MPFR_HOST_SRC_DIR := $(embtk_toolsb)/mpfr-$(MPFR_HOST_VERSION)
+MPFR_HOST_BUILD_DIR := $(embtk_toolsb)/mpfr-build
+MPFR_HOST_DIR := $(embtk_htools)/usr/local/mpfr-host
+
+export MPFR_HOST_DIR
+
+MPFR_HOST_CONFIGURE_OPTS := --disable-shared --enable-static
+MPFR_HOST_CONFIGURE_OPTS += --with-gmp=$(GMP_HOST_DIR)
+MPFR_HOST_PREFIX := $(MPFR_HOST_DIR)
+
+define embtk_cleanup_mpfr_host
+ rm -rf $(MPFR_HOST_BUILD_DIR)
+endef
diff --git a/core/mk/musl.mk b/core/mk/musl.mk
new file mode 100644
index 0000000..e2f1377
--- /dev/null
+++ b/core/mk/musl.mk
@@ -0,0 +1,78 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2012-2014 Abdoulaye Walsimou GAYE.
+#
+# 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 musl.mk
+# \brief musl.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date October 2012
+################################################################################
+
+MUSL_NAME := musl
+MUSL_VERSION := $(call embtk_get_pkgversion,musl)
+MUSL_SITE := http://www.musl-libc.org/releases
+MUSL_GIT_SITE := git://git.musl-libc.org/musl
+MUSL_PACKAGE := musl-$(MUSL_VERSION).tar.gz
+MUSL_SRC_DIR := $(embtk_toolsb)/musl-$(MUSL_VERSION)
+MUSL_BUILD_DIR := $(call __embtk_pkg_srcdir,musl)
+
+__embtk_musl_v := "$(MUSL_VERSION) From EmbToolkit v$(EMBTK_VERSION) -"
+__embtk_musl_v += "Compiled on $(embtk_host_uname)"
+
+define embtk_beforeinstall_musl
+ cd $(MUSL_SRC_DIR); \
+ CC=$(TARGETCC_CACHED) \
+ CROSS_COMPILE="$(CROSS_COMPILE)" \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ $(CONFIG_SHELL) $(MUSL_SRC_DIR)/configure \
+ --target=$(LINUX_ARCH) --host=$(LINUX_ARCH) \
+ --disable-gcc-wrapper --prefix=/ \
+ --syslibdir=/$(LIBDIR) --libdir=/$(LIBDIR) \
+ --includedir=/usr/include
+ echo "$(__embtk_musl_v)" > $(MUSL_SRC_DIR)/VERSION
+ $(call __embtk_setconfigured_pkg,musl)
+endef
+
+define __embtk_install_musl
+ $(call embtk_pinfo,"Build and install musl-$(MUSL_VERSION) ...")
+ $(call embtk_download_pkg,musl)
+ $(call embtk_decompress_pkg,musl)
+ $(Q)$(MAKE) -C $(MUSL_BUILD_DIR) distclean
+ $(embtk_beforeinstall_musl)
+ $(Q)$(MAKE) -C $(MUSL_BUILD_DIR) \
+ DESTDIR=$(embtk_sysroot) install-libs install-headers
+ cd $(embtk_sysroot)/$(LIBDIR); \
+ ln -sf libc.so $(embtk_musl_dlinker).so.1; \
+ ln -sf $(embtk_musl_dlinker).so.1 ld-musl.so.1
+ $(call __embtk_setinstalled_pkg,musl)
+ $(call __embtk_pkg_gen_dotkconfig_f,musl)
+ $(eval __embtk_musl_installed := y)
+endef
+
+define embtk_install_musl
+ $(if $(call __embtk_pkg_runrecipe-y,musl),$(__embtk_install_musl))
+endef
+
+define embtk_cleanup_musl
+ if [ -d $(MUSL_BUILD_DIR) ]; then \
+ $(MAKE) -C $(MUSL_BUILD_DIR) distclean; \
+ $(call __embtk_unsetconfigured_pkg,musl); \
+ $(call __embtk_unsetinstalled_pkg,musl); \
+ $(call __embtk_unsetkconfigured_pkg,musl); \
+ fi
+endef
diff --git a/core/mk/packages.mk b/core/mk/packages.mk
new file mode 100644
index 0000000..9268d30
--- /dev/null
+++ b/core/mk/packages.mk
@@ -0,0 +1,123 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2014 Abdoulaye Walsimou GAYE.
+#
+# 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 packages.kconfig
+# \brief packages.kconfig of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date May 2009
+################################################################################
+
+ROOTFS_COMPONENTS-y :=
+HOSTTOOLS_COMPONENTS-y := mkimage_install
+#
+# Common include for target and host
+#
+
+# gperf
+include core/mk/gperf_host.mk
+HOSTTOOLS_COMPONENTS-$(CONFIG_EMBTK_HOST_HAVE_GPERF) += gperf_host_install
+
+# libelf
+include packages/misc/libelf/libelf.mk
+ROOTFS_COMPONENTS-$(CONFIG_EMBTK_HAVE_LIBELF) += libelf_install
+HOSTTOOLS_COMPONENTS-$(CONFIG_EMBTK_HOST_HAVE_LIBELF) += libelf_host_install
+
+include core/mk/makedevs.mk
+include core/mk/mkimage.mk
+include core/mk/squashfs.mk
+
+# Install various tools in case of FreeBSD host development machine
+ifeq ($(embtk_buildhost_os_type),bsd)
+HOSTTOOLS_COMPONENTS-y += gsed_install gmake_install
+endif
+
+
+#
+# Packages for TARGET and HOST
+#
+
+# Flash manipulation tools: mtd-utils
+ROOTFS_COMPONENTS-$(CONFIG_EMBTK_HAVE_MTDUTILS) += mtdutils_install
+
+# Compression packages
+include packages/compression/compression.mk
+
+# Database packages/libraries
+include packages/database/database.mk
+
+# Development libraries/packages
+include packages/development/development.mk
+
+# Graphics packages
+include packages/graphics/graphics.mk
+
+# Networking packages
+include packages/net/net.mk
+
+# Scripting languages
+include packages/scripting-languages/scripting-languages.mk
+
+# Security packages
+include packages/security/security.mk
+
+# System packages
+include packages/system/system.mk
+
+# X window system packages
+include packages/x11/x11.mk
+
+# Miscellaneous packages
+include packages/misc/misc.mk
+
+# Busybox
+ROOTFS_COMPONENTS-$(CONFIG_EMBTK_HAVE_BB) += bb_install
+include packages/busybox/busybox.mk
+
+#
+# Targets for host machine
+#
+define __embtk_hostpkgs_build
+ $(if $(HOSTTOOLS_COMPONENTS-y),$(MAKE) $(HOSTTOOLS_COMPONENTS-y),true)
+endef
+host_packages_build:
+ $(Q)$(__embtk_hostpkgs_build)
+
+#
+# Generic implicit rules
+#
+
+# This install implicit rule is intended for autotool'ed packages, or packages
+# defininng an embtk_install_{pkgname} macro.
+%_install:
+ $(call embtk_install_xpkg,$*)
+
+# Download generic implicit rule
+download_% %_download:
+ $(call embtk_download_pkg,$*)
+
+# Decompress generic implicit rule
+%_decompress:
+ $(call embtk_decompress_pkg,$*)
+
+# clean generic implicit rule
+%_clean:
+ $(call embtk_cleanup_pkg,$*)
+
+# Download target for offline build
+packages_fetch:: $(patsubst %_install,download_%,$(ROOTFS_COMPONENTS-y) $(HOSTTOOLS_COMPONENTS-y))
diff --git a/core/mk/pkg-macros/clean.mk b/core/mk/pkg-macros/clean.mk
new file mode 100644
index 0000000..b9b76a5
--- /dev/null
+++ b/core/mk/pkg-macros/clean.mk
@@ -0,0 +1,63 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2014 Abdoulaye Walsimou GAYE.
+#
+# 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 clean.mk
+# \brief clean.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date January 2014
+################################################################################
+
+
+#
+# A macro to clean installed packages from sysroot.
+# Usage:
+# $(call embtk_cleanup_pkg,pkgname)
+#
+define __embtk_cleanup_pkg
+ $(eval __embtk_$(pkgv)_installed =)
+ $(if $(embtk_cleanup_$(pkgv)),$(embtk_cleanup_$(pkgv)))
+ $(if $(__embtk_pkg_etc),
+ rm -rf $(addprefix $(embtk_sysroot)/etc/,$(__embtk_pkg_etc)))
+ $(if $(__embtk_pkg_bins),
+ rm -rf $(addprefix $(embtk_sysroot)/usr/bin/,$(__embtk_pkg_bins)))
+ $(if $(__embtk_pkg_sbins),
+ rm -rf $(addprefix $(embtk_sysroot)/usr/sbin/,$(__embtk_pkg_sbins)))
+ $(if $(__embtk_pkg_includes),
+ rm -rf $(addprefix $(embtk_sysroot)/usr/include/,$(__embtk_pkg_includes)))
+ $(if $(__embtk_pkg_libs),
+ rm -rf $(addprefix $(embtk_sysroot)/usr/$(LIBDIR)/,$(__embtk_pkg_libs)))
+ $(if $(__embtk_pkg_libexecs),
+ rm -rf $(addprefix $(embtk_sysroot)/usr/libexec/,$(__embtk_pkg_libexecs)))
+ $(if $(__embtk_pkg_pkgconfigs),
+ rm -rf $(addprefix $(embtk_sysroot)/usr/$(LIBDIR)/pkgconfig/,$(__embtk_pkg_pkgconfigs))
+ rm -rf $(addprefix $(embtk_sysroot)/usr/share/pkgconfig/,$(__embtk_pkg_pkgconfigs)))
+ $(if $(__embtk_pkg_shares),
+ rm -rf $(addprefix $(embtk_sysroot)/usr/share/,$(__embtk_pkg_shares)))
+ $(if $(__embtk_pkg_usegit)$(__embtk_pkg_usesvn),
+ $(call __embtk_unsetconfigured_pkg,$(1))
+ $(call __embtk_unsetinstalled_pkg,$(1)),
+ $(if $(__embtk_pkg_builddir),rm -rf $(__embtk_pkg_builddir)*))
+ $(if $(__embtk_pkg_statedir),rm -rf $(__embtk_pkg_statedir))
+endef
+
+define embtk_cleanup_pkg
+ $(if $(EMBTK_BUILDSYS_DEBUG),
+ $(call embtk_pinfo,"Cleanup $(__embtk_pkg_name)..."))
+ $(Q)$(call __embtk_cleanup_pkg,$(1))
+endef
diff --git a/core/mk/pkg-macros/configure.mk b/core/mk/pkg-macros/configure.mk
new file mode 100644
index 0000000..b6f095b
--- /dev/null
+++ b/core/mk/pkg-macros/configure.mk
@@ -0,0 +1,142 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2014 Abdoulaye Walsimou GAYE.
+#
+# 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 configure.mk
+# \brief configure.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date January 2014
+################################################################################
+
+#
+# embtk_fixgconfigsfor_pkg
+#
+__embtk_gconfigsub := $(EMBTK_ROOT)/scripts/config.sub
+__embtk_gconfiguess := $(EMBTK_ROOT)/scripts/config.guess
+define __embtk_fixgconfigsfor_pkg
+ subs="$$(find $(__embtk_pkg_srcdir)/ -type f -name config.sub)"; \
+ for sub in $$subs; do \
+ if [ -n $$sub -a -e $$sub ]; then \
+ ln -sf $(__embtk_gconfigsub) $$sub; \
+ fi; \
+ done; \
+ guesses="$$(find $(__embtk_pkg_srcdir)/ -type f -name config.guess)"; \
+ for guess in $$guesses; do \
+ if [ -n $$guess -a -e $$guess ]; then \
+ ln -sf $(__embtk_gconfiguess) $$guess; \
+ fi; \
+ done;
+endef
+
+#
+# A macro which runs configure script (conpatible with autotools configure)
+# for a package and sets environment variables correctly.
+# Usage:
+# $(call embtk_configure_pkg,PACKAGE)
+#
+define __embtk_configure_autoreconfpkg
+if [ "x$(CONFIG_EMBTK_$(PKGV)_NEED_AUTORECONF)" = "xy" ]; then \
+ test -e $(__embtk_pkg_srcdir)/configure.ac || \
+ test -e $(__embtk_pkg_srcdir)/configure.in || exit 1; \
+ cd $(__embtk_pkg_srcdir); \
+ $(AUTORECONF) --install -f; \
+fi
+endef
+
+__embtk_parse_configure_opts = $(subst $(embtk_space),"\\n\\t",$(strip $(1)))
+define __embtk_print_configure_opts
+ $(if $(strip $(1)),
+ $(call embtk_echo_blue,"Configure options:\\n\\t$(__embtk_parse_configure_opts)"))
+ echo
+endef
+
+__embtk_pkg_ildflags = -L$(embtk_sysroot)/$(LIBDIR)
+__embtk_pkg_ildflags += -L$(embtk_sysroot)/usr/$(LIBDIR)
+define embtk_configure_pkg
+ $(if $(EMBTK_BUILDSYS_DEBUG),
+ $(call embtk_pinfo,"Configure $(__embtk_pkg_package)..."))
+ $(call __embtk_configure_autoreconfpkg,$(1))
+ $(Q)test -e $(__embtk_pkg_srcdir)/configure || exit 1
+ $(call __embtk_print_configure_opts,$(__embtk_pkg_configureopts))
+ $(if $(CONFIG_EMBTK_CLIB_MUSL),$(call __embtk_fixgconfigsfor_pkg,$(1)))
+ $(Q)cd $(__embtk_pkg_builddir); \
+ CC=$(TARGETCC_CACHED) \
+ $(if $(CONFIG_EMBTK_GCC_LANGUAGE_CPP),CXX=$(TARGETCXX_CACHED)) \
+ AR=$(TARGETAR) \
+ RANLIB=$(TARGETRANLIB) \
+ AS=$(CROSS_COMPILE)as \
+ NM=$(TARGETNM) \
+ STRIP=$(TARGETSTRIP) \
+ OBJDUMP=$(TARGETOBJDUMP) \
+ OBJCOPY=$(TARGETOBJCOPY) \
+ CFLAGS="$(__embtk_pkg_cflags) $(TARGET_CFLAGS)" \
+ CXXFLAGS="$(__embtk_pkg_cxxflags) $(TARGET_CXXFLAGS)" \
+ LDFLAGS="$(__embtk_pkg_ildflags) $(__embtk_pkg_ldflags)" \
+ CPPFLAGS="-I$(embtk_sysroot)/usr/include $(__embtk_pkg_cppflags)" \
+ PKG_CONFIG="$(PKGCONFIG_BIN)" \
+ PKG_CONFIG_PATH="$(EMBTK_PKG_CONFIG_PATH)" \
+ PKG_CONFIG_LIBDIR="$(EMBTK_PKG_CONFIG_LIBDIR)" \
+ ac_cv_func_malloc_0_nonnull=yes \
+ ac_cv_func_realloc_0_nonnull=yes \
+ CONFIG_SHELL=$(CONFIG_EMBTK_SHELL) \
+ $(__embtk_pkg_configureenv) $(__embtk_pkg_scanbuild) \
+ $(CONFIG_EMBTK_SHELL) $(__embtk_pkg_srcdir)/configure \
+ --build=$(HOST_BUILD) --host=$(STRICT_GNU_TARGET) \
+ --target=$(STRICT_GNU_TARGET) --libdir=/usr/$(LIBDIR) \
+ --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-rpath \
+ $(__embtk_pkg_configureopts)
+ $(Q)$(call __embtk_setconfigured_pkg,$(1))
+ $(Q)$(call __embtk_kill_lt_rpath,$(__embtk_pkg_builddir))
+endef
+
+#
+# A macro which runs configure script (conpatible with autotools configure)
+# for a package for host development machine and sets environment variables
+# correctly.
+# Usage:
+# $(call embtk_configure_hostpkg,PACKAGE)
+#
+__embtk_hostpkg_rpathldflags = "-Wl,-rpath,$(embtk_htools)/usr/lib"
+__embtk_hostpkg_rpath = $(strip $(if $(__embtk_pkg_setrpath), \
+ $(__embtk_hostpkg_rpathldflags)))
+
+__embtk_hostpkg_ldflags = -L$(embtk_htools)/usr/lib $(__embtk_hostpkg_rpath)
+__embtk_hostpkg_cppflags = -I$(embtk_htools)/usr/include
+define embtk_configure_hostpkg
+ $(if $(EMBTK_BUILDSYS_DEBUG),
+ $(call embtk_pinfo,"Configure $(__embtk_pkg_package) for host..."))
+ $(call __embtk_configure_autoreconfpkg,$(1))
+ $(if $(CONFIG_EMBTK_CLIB_MUSL),$(call __embtk_fixgconfigsfor_pkg,$(1)))
+ $(Q)test -e $(__embtk_pkg_srcdir)/configure || exit 1
+ $(call __embtk_print_configure_opts,$(__embtk_pkg_configureopts))
+ $(Q)cd $(__embtk_pkg_builddir); \
+ CPPFLAGS="$(__embtk_hostpkg_cppflags)" \
+ LDFLAGS="$(__embtk_hostpkg_ldflags)" \
+ PKG_CONFIG="$(PKGCONFIG_BIN)" \
+ PKG_CONFIG_PATH="$(EMBTK_HOST_PKG_CONFIG_PATH)" \
+ $(if $(call __embtk_streq,$(PKGV),CCACHE_HOST),,CC=$(HOSTCC_CACHED)) \
+ $(if $(call __embtk_streq,$(PKGV),CCACHE_HOST),,CXX=$(HOSTCXX_CACHED)) \
+ CONFIG_SHELL=$(CONFIG_EMBTK_SHELL) \
+ $(__embtk_pkg_configureenv) \
+ $(CONFIG_EMBTK_SHELL) $(__embtk_pkg_srcdir)/configure \
+ --build=$(HOST_BUILD) --host=$(HOST_ARCH) \
+ --prefix=$(strip $(if $(__embtk_pkg_prefix), \
+ $(__embtk_pkg_prefix),$(embtk_htools)/usr)) \
+ $(__embtk_pkg_configureopts)
+ $(Q)$(call __embtk_setconfigured_pkg,$(1))
+endef
diff --git a/core/mk/pkg-macros/download.mk b/core/mk/pkg-macros/download.mk
new file mode 100644
index 0000000..6300f4f
--- /dev/null
+++ b/core/mk/pkg-macros/download.mk
@@ -0,0 +1,207 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2014 Abdoulaye Walsimou GAYE.
+#
+# 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 download.mk
+# \briefd download.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date January 2014
+################################################################################
+
+#
+# wget wrapper
+# usage: $(call embtk_wget,$(OUTPUT_FILE),$(SITE),$(FOREIGN_FILE))
+#
+__wget_outfile = $(patsubst %/,%,$(embtk_dldir))/$(strip $(1))
+__wget_remotesite = $(patsubst %/,%,$(strip $(2)))
+__wget_foreignfiles = $(strip $(3))
+__wget_opts := --tries=5 --timeout=10 --waitretry=5
+__wget_opts += --no-check-certificate
+
+define embtk_wget
+ wget $(__wget_opts) -O $(__wget_outfile) \
+ $(__wget_remotesite)/$(__wget_foreignfiles) || \
+ wget $(__wget_opts) --no-passive-ftp -O $(__wget_outfile) \
+ $(__wget_remotesite)/$(__wget_foreignfiles)
+endef
+
+#
+# A macro which downloads a package.
+# Usage:
+# $(call embtk_download_pkg,PACKAGE)
+#
+
+__embtk_pkg_depof = $(strip $(foreach p,$(__embtk_pkgs_all-y) toolchain toolchain_addons,\
+ $(if $(findstring $(pkgv),$($(call PKGV,$(p)_deps))),$(p))))
+
+__embtk_pkg_needpatch_yesno = $(if $(__embtk_pkg_needpatch),Yes,No)
+
+define __embtk_download_pkg_patches
+ $(if $(__embtk_pkg_needpatch), \
+ test -e $(__embtk_pkg_patch_f) || \
+ $(call embtk_wget, \
+ $(__embtk_pkg_name)-$(__embtk_pkg_version).patch, \
+ $(__embtk_pkg_patch_site), \
+ $(__embtk_pkg_name)-$(__embtk_pkg_version)-*.patch),true)
+endef
+
+define __embtk_download_pkg_exitfailure
+ ($(call embtk_perror,"On $(notdir $(1)) download!"); \
+ $(if $(notdir $(1)),rm -rf $(1);) \
+ exit 1)
+endef
+
+define __embtk_svncheckout_pkg
+ svn co $(__embtk_pkg_svnsite)/$(__embtk_pkg_svnbranch) \
+ -r$(__embtk_pkg_svnrev) $(__embtk_pkg_localsvn)
+endef
+define __embtk_download_pkg_from_svn
+ $(call embtk_echo_blue,"$(__embtk_pkg_name) using SVN")
+ $(call embtk_echo_blue,"\tBranch : $(notdir $(__embtk_pkg_svnbranch))")
+ $(call embtk_echo_blue,"\tRevision : $(__embtk_pkg_svnrev)")
+ $(call embtk_echo_blue,"\tIn : $(or $(__embtk_pkg_refspec),src)")
+ $(call embtk_echo_blue,"\tCheckout URL : $(__embtk_pkg_svnsite)")
+ $(call embtk_echo_blue,"\tPatched : $(__embtk_pkg_needpatch_yesno)")
+ $(call embtk_echo_blue,"\tDependency of : $(or $(__embtk_pkg_depof),N/A)")
+ test -e $(__embtk_pkg_localsvn) || \
+ $(call __embtk_svncheckout_pkg,$(1)) || \
+ $(call __embtk_download_pkg_exitfailure,$(__embtk_pkg_package_f))
+ $(call __embtk_download_pkg_patches,$(1)) || \
+ $(call __embtk_download_pkg_exitfailure,$(__embtk_pkg_patch_f))
+ $(call __embtk_applypatch_pkg,$(1))
+
+endef
+
+define __embtk_gitclone_pkg
+ (git clone $(__embtk_pkg_gitsite) $(__embtk_pkg_localgit) && \
+ $(if $(findstring master,$(__embtk_pkg_gitbranch)),, \
+ cd $(__embtk_pkg_localgit); \
+ git checkout -b $(__embtk_pkg_gitbranch) \
+ origin/$(__embtk_pkg_gitbranch) &&) \
+ $(if $(findstring HEAD,$(__embtk_pkg_gitrev)),, \
+ cd $(__embtk_pkg_localgit); \
+ git reset --hard $(__embtk_pkg_gitrev) &&) \
+ true)
+endef
+
+define __embtk_download_pkg_from_git
+ $(call embtk_echo_blue,"$(__embtk_pkg_name) using GIT")
+ $(call embtk_echo_blue,"\tBranch : $(__embtk_pkg_gitbranch)")
+ $(call embtk_echo_blue,"\tRevision : $(__embtk_pkg_gitrev)")
+ $(call embtk_echo_blue,"\tIn : $(or $(__embtk_pkg_refspec),src)")
+ $(call embtk_echo_blue,"\tClone URL : $(__embtk_pkg_gitsite)")
+ $(call embtk_echo_blue,"\tPatched : $(__embtk_pkg_needpatch_yesno)")
+ $(call embtk_echo_blue,"\tDependency of : $(or $(__embtk_pkg_depof),N/A)")
+ test -e $(__embtk_pkg_localgit) || $(call __embtk_gitclone_pkg,$(1))
+endef
+
+define __embtk_download_pkg_from_tarball
+ $(call embtk_echo_blue,"$(__embtk_pkg_name) using tarball")
+ $(call embtk_echo_blue,"\tVersion : $(__embtk_pkg_version)")
+ $(call embtk_echo_blue,"\tFrom : $(__embtk_pkg_site)")
+ $(call embtk_echo_blue,"\tIn : $(__embtk_pkg_package_f)")
+ $(call embtk_echo_blue,"\tPatched : $(__embtk_pkg_needpatch_yesno)")
+ $(call embtk_echo_blue,"\tDependency of : $(or $(__embtk_pkg_depof),N/A)")
+ test -e $(__embtk_pkg_package_f) || \
+ $(call embtk_wget, \
+ $(__embtk_pkg_package), \
+ $(__embtk_pkg_site), \
+ $(__embtk_pkg_package)) || \
+ $(if $(__embtk_pkg_mirror1), \
+ $(call embtk_wget, \
+ $(__embtk_pkg_package), \
+ $(__embtk_pkg_mirror1), \
+ $(__embtk_pkg_package)),false) || \
+ $(if $(__embtk_pkg_mirror2), \
+ $(call embtk_wget, \
+ $(__embtk_pkg_package), \
+ $(__embtk_pkg_mirror2), \
+ $(__embtk_pkg_package)),false) || \
+ $(if $(__embtk_pkg_mirror3), \
+ $(call embtk_wget, \
+ $(__embtk_pkg_package), \
+ $(__embtk_pkg_mirror3), \
+ $(__embtk_pkg_package)),false) || \
+ $(if $(__embtk_pkg_mirror), \
+ $(call embtk_wget, \
+ $(__embtk_pkg_package), \
+ $(__embtk_pkg_mirror), \
+ $(__embtk_pkg_package)),false) || \
+ $(call __embtk_download_pkg_exitfailure,$(__embtk_pkg_package_f))
+ $(call __embtk_download_pkg_patches,$(1)) || \
+ $(call __embtk_download_pkg_exitfailure,$(__embtk_pkg_patch_f))
+endef
+
+__embtk_pkgdl_src = $(or $(__embtk_pkg_usegit),$(__embtk_pkg_usesvn),tarball)
+define embtk_download_pkg
+ $(if $(EMBTK_BUILDSYS_DEBUG),
+ $(call embtk_pinfo,"Download $(__embtk_pkg_name) if needed..."))
+ $(call __embtk_download_pkg_from_$(call __embtk_pkgdl_src,$(1)),$(1))
+endef
+
+#
+# A macro to decompress packages tarball intended to run on target.
+# Usage:
+# $(call embtk_decompress_pkg,pkgname)
+#
+
+__embtk_applypatch_pkg = \
+ $(if $(__embtk_pkg_needpatch), \
+ if [ ! -e $(__embtk_pkg_dotpatched_f) ]; then \
+ cd $(__embtk_pkg_srcdir); \
+ patch -p1 --silent < $(__embtk_pkg_patch_f); \
+ $(call __embtk_setpatched_pkg,$(1)); \
+ fi,true;)
+
+__embtk_decompress_pkg_exitfailure = \
+ $(call embtk_perror,"!Compression unknown for $(__embtk_pkg_name)!"); \
+ exit 1
+
+__embtk_decompress_pkg = \
+ case $(__embtk_pkg_package_f) in \
+ *.tar.bz2 | *.tbz2) \
+ tar -C $(dir $(__embtk_pkg_srcdir)) -xjf \
+ $(__embtk_pkg_package_f) \
+ ;; \
+ *.tar.gz | *.tgz) \
+ tar -C $(dir $(__embtk_pkg_srcdir)) -xzf \
+ $(__embtk_pkg_package_f) \
+ ;; \
+ *.tar.xz) \
+ tar -C $(dir $(__embtk_pkg_srcdir)) -xJf \
+ $(__embtk_pkg_package_f) \
+ ;; \
+ *.tar) \
+ tar -C $(dir $(__embtk_pkg_srcdir)) -xf \
+ $(__embtk_pkg_package_f) \
+ ;; \
+ *) \
+ $(call __embtk_decompress_pkg_exitfailure,$(1)) \
+ ;; \
+ esac
+
+__embtk_decompress_pkg_msg = $(call embtk_pinfo,"Decrompressing $(__embtk_pkg_package) ...")
+define embtk_decompress_pkg
+ $(if $(__embtk_pkg_usegit)$(__embtk_pkg_usesvn),true,
+ $(if $(EMBTK_BUILDSYS_DEBUG),$(__embtk_decompress_pkg_msg))
+ if [ ! -e $(__embtk_pkg_dotdecompressed_f) ]; then \
+ $(call __embtk_decompress_pkg,$(1)) && \
+ $(call __embtk_setdecompressed_pkg,$(1)) && \
+ $(call __embtk_applypatch_pkg,$(1)) \
+ fi)
+endef
diff --git a/core/mk/pkg-macros/incl.mk b/core/mk/pkg-macros/incl.mk
new file mode 100644
index 0000000..3a8cc5a
--- /dev/null
+++ b/core/mk/pkg-macros/incl.mk
@@ -0,0 +1,90 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2014 Abdoulaye Walsimou GAYE.
+#
+# 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 include.mk
+# \brief include.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date January 2014
+################################################################################
+
+#
+# Macros to include a package in the build system
+# $(1): pkgname => pkgname/pkgname.mk should exist (required)
+# $(2): kconfig: package specific kconfig symbol name used in .kconfig
+# This parameter is optional.
+define embtk_include_pkg
+ $(eval $(call __embtk_include_pkg,$(1),$(2)))
+endef
+define __embtk_include_pkg
+ $(eval __embtk_inc_pkgname := $(or $(2),$(PKGV)))
+ $(eval __embtk_incmk := $(embtk_pkgincdir)/$(pkgv)/$(pkgv).mk)
+ $(eval __embtk_incinstalled-y := $(if $(wildcard $(__embtk_pkg_dotinstalled_f)),y))
+ $(eval __embtk_incenabled-y := $(CONFIG_EMBTK_HAVE_$(__embtk_inc_pkgname)))
+ $(eval __embtk_incmk-y := $(if $(__embtk_incenabled-y)$(__embtk_incinstalled-y),y))
+ # Is it necessary to include the .mk file?
+ $(eval __embtk_incmk-y := $(if $(findstring $(__embtk_incmk),$(MAKEFILE_LIST)),,$(__embtk_incmk-y)))
+ ifeq (x$(__embtk_incmk-y),xy)
+ include $(__embtk_incmk)
+ endif
+ ifeq (x$(__embtk_incenabled-y),xy)
+ ROOTFS_COMPONENTS-y += $(pkgv)_install
+ # also include old package kconfig entries if any
+ -include $(__embtk_pkg_dotkconfig_f)
+ else ifeq (x$(__embtk_incinstalled-y),xy)
+ ROOTFS_COMPONENTS- += $(pkgv)_install
+ endif
+ # Preset build system installed variable for this packages, if installed
+ ifeq (x$(__embtk_incinstalled-y),xy)
+ __embtk_$(pkgv)_installed = y
+ else
+ __embtk_$(pkgv)_installed =
+ endif
+endef
+
+define embtk_include_hostpkg
+ $(eval $(call __embtk_include_hostpkg,$(1),$(2)))
+endef
+define __embtk_include_hostpkg
+ $(eval __embtk_inc_pkgname := $(or $(2),$(PKGV)))
+ # Case where foo and foo_host are in the same .mk file
+ $(eval __embtk_incmk0 := $(embtk_pkgincdir)/$(pkgv)/$(pkgv).mk)
+ $(eval __embtk_incmk1 := $(embtk_pkgincdir)/$(patsubst %_host,%,$(pkgv))/$(patsubst %_host,%,$(pkgv)).mk)
+ $(eval __embtk_incmk := $(or $(wildcard $(__embtk_incmk0)),$(wildcard $(__embtk_incmk1)),$(wildcard $(__embtk_incmk0))))
+ $(eval __embtk_incinstalled-y := $(if $(wildcard $(__embtk_pkg_dotinstalled_f)),y))
+ $(eval __embtk_incenabled-y := $(CONFIG_EMBTK_HOST_HAVE_$(patsubst %_HOST,%,$(__embtk_inc_pkgname))))
+ $(eval __embtk_incmk-y := $(if $(__embtk_incenabled-y)$(__embtk_incinstalled-y),y))
+ # Is it necessary to include the .mk file?
+ $(eval __embtk_incmk-y := $(if $(findstring $(__embtk_incmk),$(MAKEFILE_LIST)),,$(__embtk_incmk-y)))
+ ifeq (x$(__embtk_incmk-y),xy)
+ include $(__embtk_incmk)
+ endif
+ ifeq (x$(__embtk_incenabled-y),xy)
+ HOSTTOOLS_COMPONENTS-y += $(pkgv)_install
+ # also include old package kconfig entries if any
+ -include $(__embtk_pkg_dotkconfig_f)
+ else ifeq (x$(__embtk_incinstalled-y),xy)
+ HOSTTOOLS_COMPONENTS- += $(pkgv)_install
+ endif
+ # Preset build system installed variable for this packages, if installed
+ ifeq (x$(__embtk_incinstalled-y),xy)
+ __embtk_$(pkgv)_installed = y
+ else
+ __embtk_$(pkgv)_installed =
+ endif
+endef
diff --git a/core/mk/pkg-macros/install.mk b/core/mk/pkg-macros/install.mk
new file mode 100644
index 0000000..b80caca
--- /dev/null
+++ b/core/mk/pkg-macros/install.mk
@@ -0,0 +1,327 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2014 Abdoulaye Walsimou GAYE.
+#
+# 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 install.mk
+# \brief install.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date January 2014
+################################################################################
+
+#
+# Define here which make program to use in MAKE.
+# FIXME: On some systems, gnu make is named gmake (ie FreeBSD)
+#
+__embtk_make_cmd := make
+ifeq ($(findstring bsd,$(HOST_ARCH)),bsd)
+__embtk_make_cmd := gmake
+endif
+
+__embtk_make_env := $(if $(V),MAKEFLAGS="",MAKEFLAGS="--no-print-directory --silent")
+MAKE = $(__embtk_make_env) $(__embtk_pkg_scanbuild) $(__embtk_make_cmd)
+
+
+# Some embtoolkit internal files for packages
+__embtk_pkg_dotdecompressed_f = $(__embtk_pkg_srcdir)/.embtk.decompressed
+__embtk_pkg_dotpatched_f = $(__embtk_pkg_srcdir)/.embtk.patched
+__embtk_pkg_dotconfigured_f = $(__embtk_pkg_statedir)/.embtk.configured
+__embtk_pkg_dotinstalled_f = $(__embtk_pkg_statedir)/.embtk.installed
+__embtk_pkg_dotkconfig_f = $(__embtk_pkg_statedir)/.embtk.kconfig
+
+__embtk_setdecompressed_pkg = touch $(__embtk_pkg_dotdecompressed_f)
+__embtk_unsetdecompressed_pkg = rm -rf $(__embtk_pkg_dotdecompressed_f)
+__embtk_setpatched_pkg = touch $(__embtk_pkg_dotpatched_f)
+__embtk_unsetpatched_pkg = rm -rf $(__embtk_pkg_dotpatched_f)
+__embtk_setconfigured_pkg = mkdir -p $(__embtk_pkg_statedir) && touch $(__embtk_pkg_dotconfigured_f)
+__embtk_unsetconfigured_pkg = rm -rf $(__embtk_pkg_dotconfigured_f)
+__embtk_setinstalled_pkg = mkdir -p $(__embtk_pkg_statedir) && touch $(__embtk_pkg_dotinstalled_f)
+__embtk_unsetinstalled_pkg = rm -rf $(__embtk_pkg_dotinstalled_f)
+__embtk_setkconfigured_pkg = mkdir -p $(__embtk_pkg_statedir) && touch $(__embtk_pkg_dotkconfig_f)
+__embtk_unsetkconfigured_pkg = rm -rf $(__embtk_pkg_dotkconfig_f)
+
+ifeq ($(CONFIG_EMBTK_WIPEOUTWORKSPACES),y)
+define __embtk_wipeoutworkspace_pkg
+ $(if $(__embtk_pkg_usegit)$(__embtk_pkg_usesvn)$(__embtk_pkg_nowipeworkspace),,
+ rm -rf $(__embtk_pkg_builddir)
+ rm -rf $(__embtk_pkg_srcdir))
+endef
+endif
+
+# Some useful macros about packages
+__embtk_rootfs_pkgs-y = $(patsubst %_install,%,$(ROOTFS_COMPONENTS-y))
+__embtk_rootfs_nrpkgs-y = $(words $(__embtk_rootfs_pkgs-y))
+
+__embtk_hosttools_pkgs-y = $(patsubst %_install,%,$(HOSTTOOLS_COMPONENTS-y))
+__embtk_hosttools_nrpkgs-y = $(words $(__embtk_hosttools_pkgs-y))
+
+__embtk_rootfs_pkgs-n = $(patsubst %_install,%,$(ROOTFS_COMPONENTS-))
+__embtk_rootfs_nrpkgs-n = $(words $(__embtk_rootfs_pkgs-n))
+
+__embtk_hosttools_pkgs-n = $(patsubst %_install,%,$(HOSTTOOLS_COMPONENTS-))
+__embtk_hosttools_nrpkgs-n = $(words $(__embtk_hosttools_pkgs-n))
+
+__embtk_pkgs_all-y = $(__embtk_rootfs_pkgs-y) $(__embtk_hosttools_pkgs-y)
+__embtk_pkgs_nrall-y = $(words $(__embtk_pkgs_all-y))
+
+#
+# A macro to get packages version from .config file.
+# usage: $(call embtk_get_pkgversion,PACKAGE)
+#
+embtk_get_pkgversion = $(call __embtk_mk_uquote,$(CONFIG_EMBTK_$(PKGV)_VERSION_STRING))
+
+
+#
+# A macro to test if a package is already decompressed.
+#
+__embtk_pkg_decompressed-y = $(call __embtk_mk_pathexist,$(__embtk_pkg_dotdecompressed_f))
+__embtk_pkg_notdecompressed-y = $(call __embtk_mk_pathnotexist,$(__embtk_pkg_dotdecompressed_f))
+
+#
+# A macro to test if a package is already patched.
+#
+__embtk_pkg_patched-y = $(call __embtk_mk_pathexist,$(__embtk_pkg_dotpatched_f))
+__embtk_pkg_notpatched-y = $(call __embtk_mk_pathnotexist,$(__embtk_pkg_dotpatched_f))
+
+#
+# A macro to test if a package is already configured using autotools configure
+# script.
+#
+__embtk_pkg_configured-y = $(call __embtk_mk_pathexist,$(__embtk_pkg_dotconfigured_f))
+__embtk_pkg_notconfigured-y = $(call __embtk_mk_pathnotexist,$(__embtk_pkg_dotconfigured_f))
+
+#
+# A macro to generate a package __embtk_pkg_dotkconfig_f file.
+#
+define __embtk_pkg_gen_dotkconfig_f
+ echo '__embtk_$(pkgv)_okconfigs := $(__embtk_pkg_kconfigs_all_v)' > $(__embtk_pkg_dotkconfig_f)
+endef
+
+#
+# A macro to test if a package build recipe needs to be run or not.
+#
+__embtk_pkg_runrecipe-y = $(or $(__embtk_pkg_ninstalled-y),$(__embtk_pkg_confchanged-y))
+__embtk_pkg_installed-y = $(or $(__embtk_$(pkgv)_installed),$(wildcard $(__embtk_pkg_dotinstalled_f)))
+__embtk_pkg_ninstalled-y = $(if $(__embtk_pkg_installed-y),,y)
+__embtk_pkg_confchanged-y = $(call __embtk_strneq,$(__embtk_pkg_kconfigs_all_v),$(__embtk_$(pkgv)_okconfigs))
+
+#
+# Various helpers macros for different steps while installing packages.
+#
+__embtk_multi_make = $(foreach builddir,$(__embtk_pkg_makedirs), \
+ $(__embtk_pkg_makeenv) \
+ $(MAKE) -C $(__embtk_pkg_builddir)/$(builddir) \
+ $(J) $(__embtk_pkg_makeopts);)
+
+__embtk_single_make = $(__embtk_pkg_makeenv) \
+ $(MAKE) -C $(__embtk_pkg_builddir) \
+ $(J) $(__embtk_pkg_makeopts)
+
+
+__embtk_multi_make_install = $(foreach builddir,$(__embtk_pkg_makedirs), \
+ $(__embtk_pkg_makeenv) $(filter-out $(__embtk_pkg_scanbuild),$(MAKE)) \
+ -C $(__embtk_pkg_builddir)/$(builddir) \
+ $(if $(__embtk_pkg_nodestdir),, \
+ DESTDIR=$(embtk_sysroot)$(if $(__embtk_pkg_sysrootsuffix),/$(__embtk_pkg_sysrootsuffix))) \
+ $(__embtk_pkg_makeopts) install;)
+
+__embtk_single_make_install = $(__embtk_pkg_makeenv) \
+ $(filter-out $(__embtk_pkg_scanbuild),$(MAKE)) \
+ -C $(__embtk_pkg_builddir) \
+ $(if $(__embtk_pkg_nodestdir),, \
+ DESTDIR=$(embtk_sysroot)$(if $(__embtk_pkg_sysrootsuffix),/$(__embtk_pkg_sysrootsuffix))) \
+ $(__embtk_pkg_makeopts) install
+
+__embtk_multi_make_hostinstall = $(foreach builddir,$(__embtk_pkg_makedirs), \
+ $(__embtk_pkg_makeenv) \
+ $(MAKE) -C $(__embtk_pkg_builddir)/$(builddir) \
+ $(if $(__embtk_pkg_destdir),DESTDIR=$(__embtk_pkg_destdir)) \
+ $(__embtk_pkg_makeopts) install;)
+
+__embtk_single_make_hostinstall = $(__embtk_pkg_makeenv) \
+ $(MAKE) -C $(__embtk_pkg_builddir) \
+ $(if $(__embtk_pkg_destdir),DESTDIR=$(__embtk_pkg_destdir)) \
+ $(__embtk_pkg_makeopts) install
+
+__embtk_autotoolspkg-y=$(2)
+define __embtk_install_pkg_make
+ $(foreach dep,$(__embtk_pkg_depspkgv),$(call embtk_install_xpkg,$(dep)))
+ $(call embtk_pinfo,"Compile/Install $(__embtk_pkg_name)-$(__embtk_pkg_version) in your root filesystem...")
+ $(call embtk_download_pkg,$(1))
+ $(call embtk_decompress_pkg,$(1))
+ $(if $(embtk_beforeinstall_$(pkgv)),$(embtk_beforeinstall_$(pkgv)))
+ $(if $(__embtk_autotoolspkg-y),$(call embtk_configure_pkg,$(1)))
+ $(if $(__embtk_pkg_makedirs), \
+ $(__embtk_multi_make), \
+ $(__embtk_single_make))
+ $(if $(__embtk_pkg_makedirs), \
+ $(__embtk_multi_make_install), \
+ $(__embtk_single_make_install))
+ $(if $(__embtk_autotoolspkg-y)$(__embtk_pkg_pkgconfigs),
+ $(call __embtk_fix_libtool_files)
+ $(call __embtk_fix_pkgconfig_files))
+ $(call __embtk_setinstalled_pkg,$(1))
+ $(call __embtk_pkg_gen_dotkconfig_f,$(1))
+ $(eval __embtk_$(pkgv)_installed = y)
+endef
+define __embtk_install_hostpkg_make
+ $(Q)$(if $(__embtk_pkg_deps),$(MAKE) $(__embtk_pkg_deps))
+ $(call embtk_pinfo,"Compile/Install $(__embtk_pkg_name)-$(__embtk_pkg_version) for host...")
+ $(call embtk_download_pkg,$(1))
+ $(call embtk_decompress_pkg,$(1))
+ $(if $(embtk_beforeinstall_$(pkgv)),$(embtk_beforeinstall_$(pkgv)))
+ $(if $(__embtk_autotoolspkg-y),$(call embtk_configure_hostpkg,$(1)))
+ $(if $(__embtk_pkg_makedirs), \
+ $(__embtk_multi_make), \
+ $(__embtk_single_make))
+ $(if $(__embtk_pkg_makedirs), \
+ $(__embtk_multi_make_hostinstall), \
+ $(__embtk_single_make_hostinstall))
+ $(call __embtk_setinstalled_pkg,$(1))
+ $(call __embtk_pkg_gen_dotkconfig_f,$(1))
+ $(eval __embtk_$(pkgv)_installed = y)
+endef
+
+#
+# A macro to exit with error when needed package variables not define.
+# Usage:
+# $(call __embtk_install_paramsfailure,pkgname)
+#
+define __embtk_install_paramsfailure
+ $(call embtk_perror,"!Not all needed variables defined for $(1)!")
+ $(call embtk_echo_red,"Summary of variables and their current values")
+ $(call embtk_echo_red,"$(PKGV)_NAME (needed) = $(or $(__embtk_pkg_name),not set)")
+ $(call embtk_echo_red,"$(PKGV)_SITE (needed if tarball) = $(or $(__embtk_pkg_site),not set)")
+ $(call embtk_echo_red,"$(PKGV)_VERSION (needed if tarball) = $(or $(__embtk_pkg_version),not set)")
+ $(call embtk_echo_red,"$(PKGV)_PACKAGE (needed if tarball) = $(or $(__embtk_pkg_package),not set)")
+ $(call embtk_echo_red,"$(PKGV)_GIT_SITE (needed if git) = $(or $(__embtk_pkg_gitsite),not set)")
+ $(call embtk_echo_red,"CONFIG_EMBTK_$(PKGV)_VERSION_GIT (needed if git) = $(or $(__embtk_pkg_usegit),not set)")
+ $(call embtk_echo_red,"CONFIG_EMBTK_$(PKGV)_GIT_REVISION (needed if git) = $(or $(__embtk_pkg_gitrev),not set)")
+ $(call embtk_echo_red,"CONFIG_EMBTK_$(PKGV)_GIT_BRANCH (needed if git) = $(or $(__embtk_pkg_gitbranch),not set)")
+ $(call embtk_echo_red,"$(PKGV)_SVN_SITE (needed if svn) = $(or $(__embtk_pkg_svnsite),not set)")
+ $(call embtk_echo_red,"CONFIG_EMBTK_$(PKGV)_VERSION_SVN (needed if svn) = $(or $(__embtk_pkg_usesvn),not set)")
+ $(call embtk_echo_red,"CONFIG_EMBTK_$(PKGV)_SVN_REVISION (needed if svn) = $(or $(__embtk_pkg_svnrev),not set)")
+ $(call embtk_echo_red,"CONFIG_EMBTK_$(PKGV)_SVN_BRANCH (needed if svn) = $(or $(__embtk_pkg_svnbranch),not set)")
+ $(call embtk_echo_red,"$(PKGV)_SRC_DIR (needed if tarball) = $(or $(__embtk_pkg_srcdir),not set)")
+ $(call embtk_echo_red,"$(PKGV)_BUILD_DIR (optional) = $(or $(__embtk_pkg_builddir),not set)")
+
+ exit 1
+endef
+
+__embtk_xinstall_xgitpkg_allvarset-y = \
+ $(strip $(if $(__embtk_pkg_usegit),$(__embtk_pkg_gitsite)))
+
+__embtk_xinstall_xsvnpkg_allvarset-y = $(strip \
+ $(if $(__embtk_pkg_usesvn), \
+ $(and $(__embtk_pkg_svnsite),$(__embtk_pkg_svnbranch), \
+ $(__embtk_pkg_svnrev))))
+
+__embtk_xinstall_xtarbpkg_allvarset-y = $(strip \
+ $(if $(__embtk_pkg_usegit)$(__embtk_pkg_usesvn),, \
+ $(and $(__embtk_pkg_site),$(__embtk_pkg_version), \
+ $(__embtk_pkg_package))))
+
+__embtk_xinstall_xpkg_allvarset-y = $(and $(__embtk_pkg_name), \
+ $(__embtk_pkg_srcdir),$(__embtk_pkg_builddir), \
+ $(or $(__embtk_xinstall_xgitpkg_allvarset-y), \
+ $(__embtk_xinstall_xtarbpkg_allvarset-y), \
+ $(__embtk_xinstall_xsvnpkg_allvarset-y)))
+
+#
+# A macro to install automatically a package, using autotools scripts, intended
+# to run on the target
+# Usage:
+# $(call embtk_install_pkg,package)
+#
+define __embtk_install_pkg
+ $(if $(__embtk_pkg_runrecipe-y),
+ $(Q)mkdir -p $(__embtk_pkg_builddir)
+ $(Q)$(call __embtk_install_pkg_make,$(1),autotools)
+ $(embtk_postinstallonce_$(pkgv))
+ $(call __embtk_wipeoutworkspace_pkg,$(1)))
+ $(call __embtk_wipeoutworkspace_pkg,$(1))
+ $(embtk_postinstall_$(pkgv))
+endef
+
+define embtk_install_pkg
+ $(if $(__embtk_xinstall_xpkg_allvarset-y),
+ $(or $(embtk_install_$(pkgv)),$(call __embtk_install_pkg,$(1))),
+ $(call __embtk_install_paramsfailure,$(1)))
+endef
+
+#
+# A macro to install automatically a package, using simple Makefile and an
+# install target, intented to run on the target.
+# Usage:
+# $(call embtk_makeinstall_pkg,package)
+#
+define embtk_makeinstall_pkg
+ $(if $(__embtk_xinstall_xpkg_allvarset-y),
+ $(if $(__embtk_pkg_runrecipe-y),
+ $(Q)mkdir -p $(__embtk_pkg_builddir)
+ $(Q)$(call __embtk_install_pkg_make,$(1))
+ $(embtk_postinstallonce_$(pkgv))
+ $(call __embtk_wipeoutworkspace_pkg,$(1)))
+ $(embtk_postinstall_$(pkgv)),
+ $(call __embtk_install_paramsfailure,$(1)))
+endef
+
+#
+# A macro to install automatically a package, using autotools scripts, intended
+# to run on the host development machine.
+# Usage:
+# $(call embtk_install_hostpkg,package)
+#
+
+define __embtk_install_hostpkg
+ $(if $(__embtk_pkg_runrecipe-y),
+ $(Q)mkdir -p $(__embtk_pkg_builddir)
+ $(Q)$(call __embtk_install_hostpkg_make,$(1),autotools)
+ $(embtk_postinstallonce_$(pkgv))
+ $(call __embtk_wipeoutworkspace_pkg,$(1)))
+ $(embtk_postinstall_$(pkgv))
+endef
+define embtk_install_hostpkg
+ $(if $(__embtk_xinstall_xpkg_allvarset-y),
+ $(or $(embtk_install_$(pkgv)),$(call __embtk_install_hostpkg,$(1))),
+ $(call __embtk_install_paramsfailure,$(1)))
+endef
+
+#
+# A macro to install automatically a package, using simple Makefile and an
+# install target, intended to run on the host development machine.
+# Usage:
+# $(call embtk_makeinstall_hostpkg,package)
+#
+define embtk_makeinstall_hostpkg
+ $(if $(__embtk_xinstall_xpkg_allvarset-y),
+ $(if $(__embtk_pkg_runrecipe-y),
+ $(Q)mkdir -p $(__embtk_pkg_builddir)
+ $(Q)$(call __embtk_install_hostpkg_make,$(1))
+ $(embtk_postinstallonce_$(pkgv))
+ $(call __embtk_wipeoutworkspace_pkg,$(1)))
+ $(embtk_postinstall_$(pkgv)),
+ $(call __embtk_install_paramsfailure,$(1)))
+endef
+
+#
+# A wrapper macro for embtk_install_hostpkg and embtk_install_pkg, based on
+# package name (xxxx or xxxx_host).
+#
+define embtk_install_xpkg
+ $(call embtk_install_$(findstring host,$(1))pkg,$(1))
+endef
diff --git a/core/mk/pkg-macros/libtool.mk b/core/mk/pkg-macros/libtool.mk
new file mode 100644
index 0000000..029d934
--- /dev/null
+++ b/core/mk/pkg-macros/libtool.mk
@@ -0,0 +1,54 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2014 Abdoulaye Walsimou GAYE.
+#
+# 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 libtool.mk
+# \brief libtool.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date January 2014
+################################################################################
+
+#Macro to adapt libtool files (*.la) for cross compiling
+__ltlibdirold = libdir='\/usr\/$(LIBDIR)\(.*\)'
+__ltlibdirnew = libdir='$(embtk_sysroot)\/usr\/$(LIBDIR)\1'
+__lt_usr/lib = $(embtk_space)\/usr\/$(LIBDIR)\/
+__lt_sysroot/usr/lib = $(embtk_space)$(embtk_sysroot)\/usr\/$(LIBDIR)\/
+__lt_path = $(addprefix $(embtk_sysroot)/usr/,$(or $(1),$(LIBDIR)))
+define __embtk_fix_libtool_files
+ __lt_las=$$(find $(__lt_path) -name '*.la'); \
+ for la in $$__lt_las; do \
+ sed -e "s;$(__ltlibdirold);$(__ltlibdirnew);" \
+ -e "s;$(__lt_usr/lib);$(__lt_sysroot/usr/lib);g" \
+ < $$la > $$la.new; \
+ mv $$la.new $$la; \
+ done
+endef
+libtool_files_adapt:
+ $(Q)$(call __embtk_fix_libtool_files)
+
+#A macro to remove rpath in packages that use libtool -rpath
+define __embtk_kill_lt_rpath
+ cd $(strip $(1)); \
+ LOCAL_LT_FILES=`find . -type f -name libtool`; \
+ for i in $$LOCAL_LT_FILES; do \
+ sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
+ -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
+ < $$i > $$i.new; \
+ mv $$i.new $$i; \
+ done
+endef
diff --git a/core/mk/pkg-macros/pkg-config.mk b/core/mk/pkg-macros/pkg-config.mk
new file mode 100644
index 0000000..8fe591d
--- /dev/null
+++ b/core/mk/pkg-macros/pkg-config.mk
@@ -0,0 +1,63 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2014 Abdoulaye Walsimou GAYE.
+#
+# 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 pkg-config.mk
+# \brief pkg-config.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date January 2014
+################################################################################
+
+#
+# embtk_pkgconfig-libs:
+# A macro to get pkg-config libs entry for a target package
+# Usage: $(call embtk_pkgconfig_getlibs,pkgname)
+#
+define embtk_pkgconfig-libs
+ $(shell \
+ PKG_CONFIG_PATH=$(EMBTK_PKG_CONFIG_PATH) \
+ PKG_CONFIG_LIBDIR="$(EMBTK_PKG_CONFIG_LIBDIR)" \
+ $(PKGCONFIG_BIN) $(strip $(1)) --libs)
+endef
+
+#
+# embtk_pkgconfig-cflags:
+# A macro to get pkg-config cflags entry for a target package
+# Usage: $(call embtk_pkgconfig_getcflags,pkgname)
+#
+define embtk_pkgconfig-cflags
+ $(shell \
+ PKG_CONFIG_PATH=$(EMBTK_PKG_CONFIG_PATH) \
+ PKG_CONFIG_LIBDIR="$(EMBTK_PKG_CONFIG_LIBDIR)" \
+ $(PKGCONFIG_BIN) $(strip $(1)) --cflags)
+endef
+
+# Macro to adapt pkg-config files for cross compiling
+__pkgconfig_includedir = includedir=$(embtk_sysroot)/usr/include
+__pkgconfig_prefix = prefix=$(embtk_sysroot)/usr
+__pkgconfig_libdir = libdir=$(embtk_sysroot)/usr/$(LIBDIR)
+define __embtk_fix_pkgconfig_files
+ __conf_files0=$$(find $(embtk_sysroot)/usr/$(LIBDIR)/pkgconfig -name *.pc); \
+ __conf_files1=$$(find $(embtk_sysroot)/usr/share/pkgconfig -name *.pc); \
+ for i in $$__conf_files0 $$__conf_files1; do \
+ sed -e 's;prefix=.*;$(__pkgconfig_prefix);' \
+ -e 's;includedir=$${prefix}/include;$(__pkgconfig_includedir);' \
+ -e 's;libdir=.*;$(__pkgconfig_libdir);' < $$i > $$i.new; \
+ mv $$i.new $$i; \
+ done
+endef
diff --git a/core/mk/pkg-macros/vars.mk b/core/mk/pkg-macros/vars.mk
new file mode 100644
index 0000000..e7e1a6e
--- /dev/null
+++ b/core/mk/pkg-macros/vars.mk
@@ -0,0 +1,124 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2014 Abdoulaye Walsimou GAYE.
+#
+# 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 vars.mk
+# \brief vars.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date January 2014
+################################################################################
+
+#
+# Some helper variables
+#
+embtk_ftp := ftp://ftp.embtoolkit.org/embtoolkit.org
+embtk_ftp/packages-mirror := $(embtk_ftp)/packages-mirror
+embtk_toolchain_use_llvm-y := $(or $(CONFIG_EMBTK_LLVM_ONLY_TOOLCHAIN),$(CONFIG_EMBTK_LLVM_DEFAULT_TOOLCHAIN))
+embtk_toolchain_has_llvm-y := $(or $(CONFIG_EMBTK_GCC_AND_LLVM_TOOLCHAIN),$(embtk_toolchain_use_llvm-y))
+
+__embtk_hostcc-v := $(shell outv=$$($(HOSTCC) -v 2>&1); echo $$outv)
+embtk_hostcc_clang-y := $(if $(findstring clang,$(__embtk_hostcc-v)),y)
+
+embtk_host_uname := $(shell uname -s -r -p)
+
+#
+# Get passed package variables prefix and set some helpers macros.
+#
+PKGV = $(call embtk_ucase,$(1))
+pkgv = $(call embtk_lcase,$(1))
+__embtk_pkg_name = $(or $(strip $($(PKGV)_NAME)),$(patsubst %_host,%,$(pkgv)))
+__embtk_pkg_needpatch = $(CONFIG_EMBTK_$(PKGV)_NEED_PATCH)
+__embtk_pkg_site = $(strip $($(PKGV)_SITE))
+__embtk_patch_site = $(embtk_ftp)
+__embtk_patch_url = $(__embtk_patch_site)/$(__embtk_pkg_name)/$(__embtk_pkg_version)
+__embtk_pkg_patch_site = $(strip $(or $($(PKGV)_PATCH_SITE),$(__embtk_patch_url)))
+__embtk_pkg_patch_f = $(strip $(embtk_dldir))/$(__embtk_pkg_name)-$(__embtk_pkg_version).patch
+__embtk_pkg_mirror = $(embtk_ftp/packages-mirror)
+__embtk_pkg_mirror1 = $(strip $($(PKGV)_MIRROR1))
+__embtk_pkg_mirror2 = $(strip $($(PKGV)_MIRROR2))
+__embtk_pkg_mirror3 = $(strip $($(PKGV)_MIRROR3))
+__embtk_pkg_package = $(strip $($(PKGV)_PACKAGE))
+
+__embtk_pkg_refspec = $(call __embtk_mk_uquote,$(CONFIG_EMBTK_$(PKGV)_REFSPEC))
+
+__embtk_pkg_usesvn = $(if $(CONFIG_EMBTK_$(PKGV)_VERSION_SVN),svn)
+__embtk_pkg_svnsite = $(or $(call __embtk_mk_uquote,$(CONFIG_EMBTK_$(PKGV)_SVN_SITE)),$(strip $($(PKGV)_SVN_SITE)))
+__embtk_pkg_svnbranch = $(call __embtk_mk_uquote,$(CONFIG_EMBTK_$(PKGV)_SVN_BRANCH))
+__embtk_pkg_svnrev = $(call __embtk_mk_uquote,$(CONFIG_EMBTK_$(PKGV)_SVN_REVISION))
+__embtk_pkg_localsvn = $(strip $(if $(__embtk_pkg_usesvn), \
+ $(EMBTK_ROOT)/src/$(__embtk_pkg_refspec)/$(__embtk_pkg_name)-$(notdir $(__embtk_pkg_svnbranch)).svn))
+
+__embtk_pkg_usegit = $(if $(CONFIG_EMBTK_$(PKGV)_VERSION_GIT),git)
+__embtk_pkg_gitsite = $(or $(call __embtk_mk_uquote,$(CONFIG_EMBTK_$(PKGV)_GIT_SITE)),$(strip $($(PKGV)_GIT_SITE)))
+__embtk_pkg_gitbranch = $(or $(call __embtk_mk_uquote,$(CONFIG_EMBTK_$(PKGV)_GIT_BRANCH)),master)
+__embtk_pkg_gitrev = $(or $(call __embtk_mk_uquote,$(CONFIG_EMBTK_$(PKGV)_GIT_REVISION)),HEAD)
+__embtk_pkg_localgit = $(strip $(if $(__embtk_pkg_usegit), \
+ $(EMBTK_ROOT)/src/$(__embtk_pkg_refspec)/$(__embtk_pkg_name).git))
+
+# FIXME: __embtk_pkg_versionsvn: hack for eglibc, should work just as git
+__embtk_pkg_versionsvn = $(if $(__embtk_pkg_usesvn),$(or $(CONFIG_EMBTK_$(PKGV)_VERSION_STRING),$(__embtk_pkg_usesvn)))
+__embtk_pkg_version = $(or $(__embtk_pkg_usegit),$(__embtk_pkg_versionsvn),$(strip $($(PKGV)_VERSION)))
+
+__embtk_pkg_package_f = $(strip $(embtk_dldir))/$(__embtk_pkg_package)
+__embtk_pkg_srcdir = $(or $(__embtk_pkg_localgit),$(__embtk_pkg_localsvn),$(patsubst %/,%,$(strip $($(PKGV)_SRC_DIR))))
+__embtk_pkg_builddir = $(patsubst %/,%,$(strip $($(PKGV)_BUILD_DIR)))
+__embtk_pkg_nowipeworkspace = $(strip $($(PKGV)_KEEP_SRC_DIR))
+# State dir: where build system stores package states: installed, patched, etc.
+__embtk_pkg_x0statedir = $(if $(__embtk_pkg_builddir),$(dir $(__embtk_pkg_builddir)))
+__embtk_pkg_hoststatedir = $(if $(strip $(wildcard $(embtk_toolsb)/.embtk-$(pkgv))),$(embtk_toolsb))
+__embtk_pkg_targetstatedir = $(if $(strip $(wildcard $(embtk_pkgb)/.embtk-$(pkgv))),$(embtk_pkgb))
+__embtk_pkg_gitstatedir = $(dir $(wildcard $(EMBTK_ROOT)/src/*/$(__embtk_pkg_name).git))
+__embtk_pkg_svnstatedir = $(dir $(wildcard $(EMBTK_ROOT)/src/*/$(__embtk_pkg_name)*.svn))
+__embtk_pkg_gitsvnstatedir = $(or $(__embtk_pkg_gitstatedir),$(__embtk_pkg_svnstatedir))
+___embtk_pkg_statedir = $(or $(__embtk_pkg_x0statedir),$(__embtk_pkg_targetstatedir),$(__embtk_pkg_hoststatedir),$(__embtk_pkg_gitsvnstatedir))
+__embtk_pkg_statedir = $(if $(___embtk_pkg_statedir),$(___embtk_pkg_statedir)/.embtk-$(pkgv))
+
+__embtk_pkg_etc = $(strip $($(PKGV)_ETC))
+__embtk_pkg_bins = $(strip $($(PKGV)_BINS))
+__embtk_pkg_sbins = $(strip $($(PKGV)_SBINS))
+__embtk_pkg_includes = $(strip $($(PKGV)_INCLUDES))
+__embtk_pkg_libs = $(strip $($(PKGV)_LIBS))
+__embtk_pkg_libexecs = $(strip $($(PKGV)_LIBEXECS))
+__embtk_pkg_pkgconfigs = $(strip $($(PKGV)_PKGCONFIGS))
+__embtk_pkg_shares = $(strip $($(PKGV)_SHARES))
+
+__embtk_pkg_configureenv = $(strip $($(PKGV)_CONFIGURE_ENV))
+__embtk_pkg_setrpath = $(strip $($(PKGV)_SET_RPATH))
+__embtk_pkg_configureopts = $(strip $($(PKGV)_CONFIGURE_OPTS))
+__embtk_pkg_sysrootsuffix = $(strip $($(PKGV)_SYSROOT_SUFFIX))
+__embtk_pkg_prefix = $(strip $($(PKGV)_PREFIX))
+__embtk_pkg_destdir = $(strip $($(PKGV)_DESTDIR))
+__embtk_pkg_nodestdir = $(strip $($(PKGV)_NODESTDIR))
+__embtk_pkg_deps = $(strip $($(PKGV)_DEPS))
+__embtk_pkg_depspkgv = $(sort $(patsubst %_install,%,$(__embtk_pkg_deps)))
+___embtk_pkg_kconfigsname = $(strip $(or $($(PKGV)_KCONFIGS_NAME),$(PKGV)))
+__embtk_pkg_kconfigsname = $(patsubst %_HOST,%,$(___embtk_pkg_kconfigsname))
+__embtk_pkg_kconfigs = $(sort $(filter CONFIG_EMBTK_$(__embtk_pkg_kconfigsname)_%,$(.VARIABLES)))
+__embtk_pkg_kconfigs_v = $(foreach k,$(__embtk_pkg_kconfigs),$(k)=$($(k)))
+__embtk_pkg_deps_kconfigs_v = $(foreach d,$(__embtk_pkg_depspkgv),$(call __embtk_pkg_kconfigs_v,$(d)))
+__embtk_pkg_kconfigs_all_v = $(strip $(__embtk_pkg_kconfigs_v) $(__embtk_pkg_deps_kconfigs_v))
+__embtk_pkg_cflags = $(strip $($(PKGV)_CFLAGS))
+__embtk_pkg_cppflags = $(strip $($(PKGV)_CPPFLAGS))
+__embtk_pkg_cxxflags = $(strip $($(PKGV)_CXXFLAGS))
+__embtk_pkg_ldflags = $(strip $($(PKGV)_LDFLAGS))
+
+__embtk_pkg_makedirs = $(strip $($(PKGV)_MAKE_DIRS))
+__embtk_pkg_makeenv = $(strip $($(PKGV)_MAKE_ENV))
+__embtk_pkg_makeopts = $(strip $($(PKGV)_MAKE_OPTS))
+__embtk_pkg_scanbuild-y = $(and $(CONFIG_EMBTK_$(PKGV)_USE_SCANBUILD),$(embtk_toolchain_has_llvm-y))
+__embtk_pkg_scanbuild = $(if $(__embtk_pkg_scanbuild-y),$(TARGETSCANBUILD) -o $(__embtk_pkg_srcdir)-scanbuild-results)
diff --git a/core/mk/rootfs/README.busybox.inittab b/core/mk/rootfs/README.busybox.inittab
new file mode 100644
index 0000000..b9eb1e9
--- /dev/null
+++ b/core/mk/rootfs/README.busybox.inittab
@@ -0,0 +1,6 @@
+# Format for each entry: <id>:<runlevels>:<action>:<process>
+#
+# id == tty to run on, or empty for /dev/console
+# runlevels == ignored
+# action == one of sysinit, respawn, askfirst, wait, and once
+# process == program to run
diff --git a/core/mk/rootfs/fs.mk b/core/mk/rootfs/fs.mk
new file mode 100644
index 0000000..e1500e3
--- /dev/null
+++ b/core/mk/rootfs/fs.mk
@@ -0,0 +1,100 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2012 Abdoulaye Walsimou GAYE.
+#
+# 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 fs.mk
+# \brief fs.mk of Embtoolkit, macros for sereval filesystems build.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date August 2009
+################################################################################
+
+#
+# TAR.BZ2 rootfs macro
+#
+__embtk_tarbz2_rootdir = $(strip $(1))
+__embtk_tarbz2_rootfs = $(strip $(2))
+define embtk_rootfs_mktarbz2
+ $(call embtk_pinfo,"Generating TAR.BZ2 file of the rootfs...")
+ cd $(__embtk_tarbz2_rootdir); \
+ $(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \
+ tar cjf $(__embtk_tarbz2_rootfs) *; \
+ mv $(__embtk_tarbz2_rootfs) $(embtk_generated)/
+endef
+
+#
+# JFFS2 rootfs macro
+#
+__embtk_mkjffs2 := $(embtk_htools)/usr/sbin/mkfs.jffs2
+__embtk_sumtool := $(embtk_htools)/usr/sbin/sumtool
+__embtk_jffs2_eraseblksz := $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2_ERASEBLOCKSIZE)
+__embtk_jffs2_pad := $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2_ERASEBLOCKSIZE)
+__embtk_jffs2_pagesz := $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2_PAGESIZE)
+__embtk_jffs2_cleanmarkersz := $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2_CLEANMARKERSIZE)
+__embtk_jffs2_rootdir = $(strip $(1))
+__embtk_jffs2_rootfs = $(strip $(2))
+define embtk_rootfs_mkjffs2
+ $(call embtk_pinfo,"Generating JFFS2 rootfs..")
+ $(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \
+ $(__embtk_mkjffs2) \
+ --eraseblock=$(__embtk_jffs2_eraseblksz) \
+ --pad=$(__embtk_jffs2_pad) \
+ --pagesize=$(__embtk_jffs2_pagesz) \
+ --cleanmarker=$(__embtk_jffs2_cleanmarkersz) \
+ $(if $(CONFIG_EMBTK_TARGET_ARCH_LITTLE_ENDIAN), \
+ --little-endian,--big-endian) \
+ -n --root=$(__embtk_jffs2_rootdir) \
+ -o $(__embtk_jffs2_rootfs).temp
+ $(__embtk_sumtool) \
+ --eraseblock=$(__embtk_jffs2_eraseblksz) \
+ --cleanmarker=$(__embtk_jffs2_cleanmarkersz) \
+ $(if $(CONFIG_EMBTK_TARGET_ARCH_LITTLE_ENDIAN), \
+ --littleendian,--bigendian) \
+ -n -p -i $(__embtk_jffs2_rootfs).temp -o $(__embtk_jffs2_rootfs)
+ rm -rf $(__embtk_jffs2_rootfs).temp
+endef
+
+#
+# SQUASHFS rootfs macro
+#
+__embtk_mksquashfs := $(MKSQUASHFS_BIN)
+__embtk_squashfs_rootdir = $(strip $(1))
+__embtk_squashfs_rootfs = $(strip $(2))
+define embtk_rootfs_mksquashfs
+ $(call embtk_pinfo,"Generating SQUASHFS rootfs...")
+ $(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \
+ $(__embtk_mksquashfs) \
+ $(__embtk_squashfs_rootdir) $(__embtk_squashfs_rootfs) \
+ $(if $(CONFIG_EMBTK_SQUASHFS_TOOLS_VERSION_3_4), \
+ $(if $(CONFIG_EMBTK_TARGET_ARCH_LITTLE_ENDIAN),-le,-be))\
+ -all-root
+endef
+
+#
+# CPIO (initramfs) rootfs macro
+#
+__embtk_mkinitramfs := $(EMBTK_ROOT)/scripts/mkinitramfs
+__embtk_initramfs_rootdir = $(strip $(1))
+__embtk_initramfs_rootfs = $(strip $(2))
+define embtk_rootfs_mkinitramfs
+ $(call embtk_pinfo,"Generating INITRAMFS rootfs...")
+ $(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \
+ $(__embtk_mkinitramfs) \
+ $(__embtk_initramfs_rootdir) \
+ $(if $(EMBTK_ROOTFS_HAVE_INITRAMFS_CPIO_GZIPED),gzip,bzip2) \
+ $(__embtk_initramfs_rootfs)
+endef
diff --git a/core/mk/rootfs/rootfs.mk b/core/mk/rootfs/rootfs.mk
new file mode 100644
index 0000000..255e0b3
--- /dev/null
+++ b/core/mk/rootfs/rootfs.mk
@@ -0,0 +1,194 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2012 Abdoulaye Walsimou GAYE.
+#
+# 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 rootfs.mk
+# \brief rootfs.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date June 2009
+################################################################################
+
+ifeq ($(CONFIG_EMBTK_HAVE_ROOTFS),y)
+
+# Include various filesystems macros
+include core/mk/rootfs/fs.mk
+
+ROOTFS_JFFS2 := $(embtk_generated)/rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)-$(embtk_clib).jffs2
+ROOTFS_TARBZ2 := rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)-$(embtk_clib).tar.bz2
+ROOTFS_SQUASHFS := $(embtk_generated)/rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)-$(embtk_clib).squashfs
+ROOTFS_INITRAMFS := $(embtk_generated)/rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)-$(embtk_clib).initramfs
+
+HOSTTOOLS_COMPONENTS-y += makedevs_install
+HOSTTOOLS_COMPONENTS-$(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2) += mtdutils_host_install
+HOSTTOOLS_COMPONENTS-$(CONFIG_EMBTK_ROOTFS_HAVE_SQUASHFS) += squashfs_tools_install
+
+# Files to strip if requested
+
+__embtk_rootfs/libso = $(shell [ -d $(embtk_rootfs)/lib ] && find $(embtk_rootfs)/lib -type f -name *.so*)
+__embtk_rootfs/lib32so = $(shell [ -d $(embtk_rootfs)/lib32 ] && find $(embtk_rootfs)/lib32 -type f -name *.so*)
+__embtk_rootfs/usr/libso = $(shell [ -d $(embtk_rootfs)/usr/lib ] && find $(embtk_rootfs)/usr/lib -type f -name *.so*)
+__embtk_rootfs/usr/lib32so = $(shell [ -d $(embtk_rootfs)/usr/lib32 ] && find $(embtk_rootfs)/usr/lib32 -type f -name *.so*)
+__embtk_rootfs/usr/libexec = $(shell [ -d $(embtk_rootfs)/usr/libexec ] && find $(embtk_rootfs)/usr/libexec -type f)
+__embtk_rootfs/bins = $(shell [ -d $(embtk_rootfs)/bin ] && find $(embtk_rootfs)/bin -type f)
+__embtk_rootfs/sbins = $(shell [ -d $(embtk_rootfs)/sbin ] && find $(embtk_rootfs)/sbin -type f)
+__embtk_rootfs/usr/bins = $(shell [ -d $(embtk_rootfs)/usr/bin ] && find $(embtk_rootfs)/usr/bin -type f)
+__embtk_rootfs/usr/sbins = $(shell [ -d $(embtk_rootfs)/usr/sbin ] && find $(embtk_rootfs)/usr/sbin -type f)
+
+define __embtk_rootfs_strip_f
+ -$(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \
+ $(TARGETSTRIP) $(1) >/dev/null 2>&1
+endef
+
+define __embtk_rootfs_components_strip
+ $(call embtk_pinfo,"Stripping binaries as specified...")
+ $(if $(__embtk_rootfs/libso),
+ $(foreach bin,$(__embtk_rootfs/libso),
+ $(call __embtk_rootfs_strip_f,$(bin)) &&:))
+ $(if $(__embtk_rootfs/lib32so),
+ $(foreach bin,$(__embtk_rootfs/lib32so),
+ $(call __embtk_rootfs_strip_f,$(bin)) &&:))
+ $(if $(__embtk_rootfs/usr/libso),
+ $(foreach bin,$(__embtk_rootfs/usr/libso),
+ $(call __embtk_rootfs_strip_f,$(bin)) &&:))
+ $(if $(__embtk_rootfs/usr/lib32so),
+ $(foreach bin,$(__embtk_rootfs/usr/lib32so),
+ $(call __embtk_rootfs_strip_f,$(bin)) &&:))
+ $(if $(__embtk_rootfs/usr/libexec),
+ $(foreach bin,$(__embtk_rootfs/usr/libexec),
+ $(call __embtk_rootfs_strip_f,$(bin)) &&:))
+ $(if $(__embtk_rootfs/bins),
+ $(foreach bin,$(__embtk_rootfs/bins),
+ $(call __embtk_rootfs_strip_f,$(bin)) &&:))
+ $(if $(__embtk_rootfs/sbins),
+ $(foreach bin,$(__embtk_rootfs/sbins),
+ $(call __embtk_rootfs_strip_f,$(bin)) &&:))
+ $(if $(__embtk_rootfs/usr/bins),
+ $(foreach bin,$(__embtk_rootfs/usr/bins),
+ $(call __embtk_rootfs_strip_f,$(bin)) &&:))
+ $(if $(__embtk_rootfs/usr/sbins),
+ $(foreach bin,$(__embtk_rootfs/usr/sbins),
+ $(call __embtk_rootfs_strip_f,$(bin)) &&:))
+endef
+
+define __embtk_rootfs_mkdevnodes
+ $(call embtk_pinfo,"Populating devices nodes of the rootfs...")
+ $(FAKEROOT_BIN) -s $(FAKEROOT_ENV_FILE) -- $(MAKEDEVS_BIN) \
+ -d $(EMBTK_ROOT)/src/devices_table.txt $(embtk_rootfs)
+endef
+
+define __embtk_rootfs_cleanup
+ $(foreach pkg-n,$(__embtk_rootfs_pkgs-n),
+ $(call __embtk_cleanup_pkg,$(pkg-n)) &&:)
+ rm -rf $(embtk_generated)/rootfs-$(GNU_TARGET)-$(EMBTK_MCU_FLAG)*
+endef
+
+define __embtk_rootfs_mkinitpath
+ mkdir -p $(embtk_rootfs)
+ cp -Rp $(EMBTK_ROOT)/src/rootfs_skel/* $(embtk_rootfs)
+ mkdir -p $(embtk_pkgb)
+ $(if $(CONFIG_EMBTK_64BITS_FS_COMPAT32),
+ mkdir -p $(embtk_rootfs)/lib32
+ mkdir -p $(embtk_rootfs)/usr/lib32)
+endef
+
+define __embtk_rootfs_components_install
+ mkdir -p $(embtk_rootfs)/$(LIBDIR)
+ mkdir -p $(embtk_rootfs)/lib
+ mkdir -p $(embtk_rootfs)/usr
+ mkdir -p $(embtk_rootfs)/usr/$(LIBDIR)
+ mkdir -p $(embtk_rootfs)/usr/lib
+ $(if $(CONFIG_EMBTK_64BITS_FS),
+ cd $(embtk_rootfs); ln -s lib lib64
+ cd $(embtk_rootfs)/usr; ln -s lib lib64)
+ $(if $(CONFIG_EMBTK_64BITS_FS_COMPAT32),
+ cd $(embtk_rootfs); ln -s lib lib64
+ cd $(embtk_rootfs)/usr; ln -s lib lib64)
+ -(cd $(embtk_sysroot)/lib/ && tar -cf - *.so*) \
+ | tar -xf - -C $(embtk_rootfs)/lib/
+ -(cd $(embtk_sysroot)/usr/lib/ && tar -cf - *.so*) \
+ | tar -xf - -C $(embtk_rootfs)/usr/lib/
+ -cp -R $(embtk_sysroot)/usr/libexec $(embtk_rootfs)/usr/
+ rm -rf $(embtk_rootfs)/lib/libgcc_s.so
+ rm -rf $(embtk_rootfs)/usr/lib/libc.so
+ $(if $(CONFIG_EMBTK_64BITS_FS_COMPAT32),
+ -(cd $(embtk_sysroot)/lib32/ && tar -cf - *.so*) \
+ | tar -xf - -C $(embtk_rootfs)/lib32/
+ -(cd $(embtk_sysroot)/usr/lib32/ && tar -cf - *.so*) \
+ | tar -xf - -C $(embtk_rootfs)/usr/lib32/
+ rm -rf $(embtk_rootfs)/lib32/libgcc_s.so
+ rm -rf $(embtk_rootfs)/usr/lib32/libc.so)
+ -cp -R $(embtk_sysroot)/bin/* $(embtk_rootfs)/bin/ >/dev/null 2>/dev/null
+ -cp -R $(embtk_sysroot)/usr/bin/* $(embtk_rootfs)/usr/bin/
+ -cp -R $(embtk_sysroot)/sbin/* $(embtk_rootfs)/sbin/ >/dev/null 2>/dev/null
+ -cp -R $(embtk_sysroot)/usr/sbin/* $(embtk_rootfs)/usr/sbin/
+ -cp -R $(embtk_sysroot)/etc/* $(embtk_rootfs)/etc/ >/dev/null 2>/dev/null
+ -rm -rf $$(find $(embtk_rootfs) -type f -name '.empty')
+ cp -R $(embtk_sysroot)/root $(embtk_rootfs)/
+ -$(FAKEROOT_BIN) -i $(FAKEROOT_ENV_FILE) -- \
+ rm -rf `find $(embtk_rootfs) -type f -name *.la`
+endef
+
+define __embtk_rootfs_fs_generate
+ $(call embtk_rootfs_mktarbz2,$(embtk_rootfs),$(ROOTFS_TARBZ2))
+ $(if $(CONFIG_EMBTK_ROOTFS_HAVE_INITRAMFS_CPIO),
+ $(call embtk_rootfs_mkinitramfs,$(embtk_rootfs),$(ROOTFS_INITRAMFS)))
+ $(if $(CONFIG_EMBTK_ROOTFS_HAVE_JFFS2),
+ $(call embtk_rootfs_mkjffs2,$(embtk_rootfs),$(ROOTFS_JFFS2)))
+ $(if $(CONFIG_EMBTK_ROOTFS_HAVE_SQUASHFS),
+ $(call embtk_rootfs_mksquashfs,$(embtk_rootfs),$(ROOTFS_SQUASHFS)))
+ rm -rf $(embtk_rootfs)
+endef
+
+__rootfs_build_msg:
+ $(call embtk_pinfo,"Building selected filesystems - please wait...")
+
+__rootfs_clean:
+ $(Q)$(__embtk_rootfs_cleanup)
+
+__rootfs_mkinitpath:
+ $(Q)$(__embtk_rootfs_mkinitpath)
+
+__rootfs_components_build: $(ROOTFS_COMPONENTS-y)
+ true
+
+__rootfs_mkdevnodes:
+ $(Q)$(__embtk_rootfs_mkdevnodes)
+
+__rootfs_components_install:
+ $(Q)$(__embtk_rootfs_components_install)
+
+__rootfs_components_strip:
+ $(__embtk_rootfs_components_strip)
+
+__rootfs_prebuild_targets := __rootfs_build_msg
+__rootfs_prebuild_targets += __rootfs_clean
+__rootfs_prebuild_targets += __rootfs_mkinitpath
+__rootfs_prebuild_targets += __rootfs_components_build
+__rootfs_prebuild_targets += __rootfs_mkdevnodes
+__rootfs_prebuild_targets += __rootfs_components_install
+__rootfs_prebuild_targets += $(strip $(if $(CONFIG_EMBTK_TARGET_STRIPPED), \
+ __rootfs_components_strip))
+
+rootfs_build: toolchain_install host_packages_build $(__rootfs_prebuild_targets)
+ $(Q)$(__embtk_rootfs_fs_generate)
+ $(call embtk_pinfo,"Selected root filesystems built successfully!")
+else
+# Build of root file system not selected
+rootfs_build:
+ $(call embtk_pinfo,"Build of root filesystem not selected")
+endif
diff --git a/core/mk/squashfs.mk b/core/mk/squashfs.mk
new file mode 100644
index 0000000..6b046bf
--- /dev/null
+++ b/core/mk/squashfs.mk
@@ -0,0 +1,59 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2012 Abdoulaye Walsimou GAYE.
+#
+# 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 squashfs.mk
+# \brief squashfs.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date August 2009
+################################################################################
+
+SQUASHFS_TOOLS_NAME := squashfs
+SQUASHFS_TOOLS_VERSION := $(call embtk_get_pkgversion,squashfs_tools)
+SQUASHFS_TOOLS_SITE := http://sourceforge.net/projects/squashfs/files/squashfs/squashfs$(SQUASHFS_TOOLS_VERSION)
+SQUASHFS_TOOLS_PACKAGE := squashfs$(SQUASHFS_TOOLS_VERSION).tar.gz
+SQUASHFS_TOOLS_SRC_DIR := $(embtk_toolsb)/squashfs$(SQUASHFS_TOOLS_VERSION)
+SQUASHFS_TOOLS_BUILD_DIR := $(SQUASHFS_TOOLS_SRC_DIR)/squashfs-tools
+
+MKSQUASHFS_BIN := $(embtk_htools)/usr/bin/mksquashfs
+UNSQUASHFS_BIN := $(embtk_htools)/usr/bin/unsquashfs
+
+SQUASHFS_TOOLS_DEPS := zlib_host_install
+
+# Build cppflags
+__embtk_squashfs_cppflags := -I$(embtk_htools)/usr/include
+ifneq ($(embtk_buildhost_os),linux)
+__embtk_squashfs_cppflags += -DFNM_EXTMATCH=0
+endif
+
+SQUASHFS_TOOLS_MAKE_ENV := CC=$(HOSTCC_CACHED)
+SQUASHFS_TOOLS_MAKE_ENV += CPPFLAGS="$(__embtk_squashfs_cppflags)"
+SQUASHFS_TOOLS_MAKE_ENV += LDFLAGS="-L$(embtk_htools)/usr/lib"
+SQUASHFS_TOOLS_MAKE_ENV += EXTRA_CFLAGS="-include sys/stat.h"
+
+SQUASHFS_TOOLS_MAKE_OPTS := XATTR_SUPPORT=0
+SQUASHFS_TOOLS_MAKE_OPTS += INSTALL_DIR="$(embtk_htools)/usr/bin"
+
+
+define embtk_install_squashfs_tools
+ $(call embtk_makeinstall_hostpkg,squashfs_tools)
+endef
+
+define embtk_cleanup_squashfs_tools
+ rm -rf $(SQUASHFS_TOOLS_SRC_DIR)
+endef
diff --git a/core/mk/strace.mk b/core/mk/strace.mk
new file mode 100644
index 0000000..b2d57cc
--- /dev/null
+++ b/core/mk/strace.mk
@@ -0,0 +1,33 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2013 Abdoulaye Walsimou GAYE.
+#
+# 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 strace.mk
+# \brief strace.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date August 2009
+################################################################################
+
+STRACE_NAME := strace
+STRACE_VERSION := $(call embtk_get_pkgversion,strace)
+STRACE_SITE := http://downloads.sourceforge.net/project/strace/strace/$(STRACE_VERSION)
+STRACE_PACKAGE := strace-$(STRACE_VERSION).tar.bz2
+STRACE_SRC_DIR := $(embtk_pkgb)/strace-$(STRACE_VERSION)
+STRACE_BUILD_DIR := $(embtk_pkgb)/strace-build
+
+STRACE_BINS := strace strace-graph
diff --git a/core/mk/target-mcu.mk b/core/mk/target-mcu.mk
new file mode 100644
index 0000000..7e7ace4
--- /dev/null
+++ b/core/mk/target-mcu.mk
@@ -0,0 +1,33 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2012 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 target-mcu.mk
+# \brief target-mcu.mk of Embtoolkit.
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date May 2009
+################################################################################
+
+# ARM
+ifeq ($(CONFIG_EMBTK_ARCH_ARM),y)
+include core/mk/arch/arm/arm.mk
+endif
+
+# MIPS
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS),y)
+include core/mk/arch/mips/mips.mk
+endif
diff --git a/core/mk/targetsys.mk b/core/mk/targetsys.mk
new file mode 100644
index 0000000..093fb7b
--- /dev/null
+++ b/core/mk/targetsys.mk
@@ -0,0 +1,56 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2012 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 targetsys.mk
+# \brief This file defines system environment of the target
+# \brief (os, clib, etc.).
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date October 2012
+################################################################################
+
+embtk_os-$(CONFIG_EMBTK_OS_LINUX) := linux
+embtk_os := $(or $(embtk_os-y),invalid-os)
+
+embtk_clib-$(CONFIG_EMBTK_CLIB_EGLIBC) := eglibc
+embtk_clib-$(CONFIG_EMBTK_CLIB_GLIBC) := glibc
+embtk_clib-$(CONFIG_EMBTK_CLIB_MUSL) := musl
+embtk_clib-$(CONFIG_EMBTK_CLIB_UCLIBC) := uclibc
+embtk_clib := $(or $(embtk_clib-y),invalid-clib)
+embtk_clib_version := $(call embtk_get_pkgversion,$(embtk_clib))
+
+#
+# Host development machine info
+#
+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
diff --git a/core/mk/uclibc.mk b/core/mk/uclibc.mk
new file mode 100755
index 0000000..2aa63ab
--- /dev/null
+++ b/core/mk/uclibc.mk
@@ -0,0 +1,145 @@
+################################################################################
+# Embtoolkit
+# Copyright(C) 2009-2014 Abdoulaye Walsimou GAYE.
+#
+# 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 uclibc.mk
+# \brief uclibc.mk of Embtoolkit
+# \author Abdoulaye Walsimou GAYE <awg@embtoolkit.org>
+# \date August 2009
+################################################################################
+
+UCLIBC_NAME := uClibc
+UCLIBC_VERSION := $(call embtk_get_pkgversion,uClibc)
+UCLIBC_SITE := http://www.uclibc.org/downloads
+UCLIBC_GIT_SITE := git://git.busybox.net/uClibc
+UCLIBC_PACKAGE := uClibc-$(UCLIBC_VERSION).tar.bz2
+UCLIBC_SRC_DIR := $(embtk_toolsb)/uClibc-$(UCLIBC_VERSION)
+UCLIBC_BUILD_DIR := $(call __embtk_pkg_srcdir,uClibc)
+
+UCLIBC_HEADERS_NAME := uClibc_headers
+UCLIBC_HEADERS_VERSION := $(UCLIBC_VERSION)
+UCLIBC_HEADERS_SITE := $(UCLIBC_SITE)
+UCLIBC_HEADERS_GIT_SITE := $(UCLIBC_GIT_SITE)
+UCLIBC_HEADERS_PACKAGE := $(UCLIBC_PACKAGE)
+UCLIBC_HEADERS_SRC_DIR := $(UCLIBC_SRC_DIR)
+UCLIBC_HEADERS_BUILD_DIR := $(UCLIBC_BUILD_DIR)
+UCLIBC_HEADERS_KCONFIGS_NAME := UCLIBC
+
+UCLIBC_DOTCONFIG := $(UCLIBC_BUILD_DIR)/.config
+EMBTK_UCLIBC_CFLAGS := $(filter-out $(__clang_cflags),$(TARGET_CFLAGS))
+EMBTK_UCLIBC_CFLAGS += $(EMBTK_TARGET_MCPU)
+EMBTK_UCLIBC_CFLAGS += $(EMBTK_TARGET_ABI) $(EMBTK_TARGET_FLOAT_CFLAGS)
+EMBTK_UCLIBC_CFLAGS += $(EMBTK_TARGET_MARCH) -pipe
+
+#
+# uClibc libraries make options.
+#
+
+UCLIBC_MAKE_OPTS := PREFIX="$(embtk_sysroot)/"
+UCLIBC_MAKE_OPTS += CROSS_COMPILER_PREFIX="$(CROSS_COMPILE)"
+UCLIBC_MAKE_OPTS += MULTILIB_DIR="/$(LIBDIR)/"
+UCLIBC_MAKE_OPTS += RUNTIME_PREFIX="/" DEVEL_PREFIX="/usr/"
+UCLIBC_MAKE_OPTS += KERNEL_HEADERS="$(embtk_sysroot)/usr/include/"
+UCLIBC_MAKE_OPTS += UCLIBC_EXTRA_CFLAGS="$(EMBTK_UCLIBC_CFLAGS)"
+
+# FIXME: unset incorrect variables in uClibc (mainline) Rules.mak for MIPS
+ifeq ($(CONFIG_EMBTK_ARCH_MIPS),y)
+UCLIBC_MAKE_OPTS += CONFIG_MIPS_ISA_1=""
+UCLIBC_MAKE_OPTS += CONFIG_MIPS_ISA_2=""
+UCLIBC_MAKE_OPTS += CONFIG_MIPS_ISA_3=""
+UCLIBC_MAKE_OPTS += CONFIG_MIPS_ISA_4=""
+UCLIBC_MAKE_OPTS += CONFIG_MIPS_ISA_MIPS32=""
+UCLIBC_MAKE_OPTS += CONFIG_MIPS_ISA_MIPS32R2=""
+UCLIBC_MAKE_OPTS += CONFIG_MIPS_ISA_MIPS64=""
+UCLIBC_MAKE_OPTS += CONFIG_MIPS_N64_ABI=""
+UCLIBC_MAKE_OPTS += CONFIG_MIPS_N32_ABI=""
+endif
+
+#
+# Install dummy uClibc needed to build gcc stage 2
+#
+define __embtk_install_uclibc_dummy
+ $(TARGETGCC) -nostdlib -nostartfiles -shared -x c /dev/null \
+ -o $(embtk_sysroot)/$(LIBDIR)/libc.so.0
+ echo '/* GNU ld script - Dummy uClibc linker script. */' \
+ > $(embtk_sysroot)/usr/$(LIBDIR)/libc.so
+ $(TARGETGCC) -Wl,--verbose 2>&1 | sed -n '/OUTPUT_FORMAT/,/)/p' \
+ >> $(embtk_sysroot)/usr/$(LIBDIR)/libc.so
+ echo 'GROUP(AS_NEEDED(libc.so.0))' \
+ >> $(embtk_sysroot)/usr/$(LIBDIR)/libc.so
+endef
+
+#
+# uClibc libraries install
+#
+define embtk_install_uclibc
+ $(call embtk_makeinstall_pkg,uclibc)
+endef
+
+#
+# Uclibc headers install
+#
+define __embtk_install_uclibc_headers
+ $(call embtk_pinfo,"Install uClibc-$(UCLIBC_VERSION) headers ...")
+ $(call embtk_download_pkg,uClibc)
+ $(call embtk_decompress_pkg,uClibc)
+ $(MAKE) -C $(UCLIBC_BUILD_DIR) distclean
+ $(embtk_configure_uclibc)
+ $(MAKE) -C $(UCLIBC_BUILD_DIR) silentoldconfig
+ $(MAKE) -C $(UCLIBC_BUILD_DIR) $(UCLIBC_MAKE_OPTS) install_headers
+ $(MAKE) -C $(UCLIBC_BUILD_DIR) $(UCLIBC_MAKE_OPTS) install_startfiles
+ $(__embtk_install_uclibc_dummy)
+ $(call __embtk_setinstalled_pkg,uclibc_headers)
+ $(eval __embtk_uclibc_headers_installed := y)
+endef
+
+define embtk_install_uclibc_headers
+ $(if $(call __embtk_pkg_runrecipe-y,uclubc_headers),$(__embtk_install_uclibc_headers))
+endef
+
+#
+# Clean up macros
+#
+define __embtk_cleanup_uclibc
+ $(MAKE) -C $(UCLIBC_BUILD_DIR) distclean && \
+ $(call __embtk_unsetinstalled_pkg,uclibc) && \
+ $(call __embtk_unsetinstalled_pkg,uclibc_headers)
+endef
+define embtk_cleanup_uclibc
+ [ -e $(UCLIBC_BUILD_DIR)/Makefile ] && $(__embtk_cleanup_uclibc) ||:
+endef
+
+define embtk_cleanup_uclibc_headers
+ $(embtk_cleanup_uclibc)
+endef
+
+#
+# uClibc configuration macros and target
+#
+__embtk_get_uclibc_config=grep "CONFIG_KEMBTK_UCLIBC_" $(EMBTK_DOTCONFIG)
+__embtk_set_uclibc_config=sed -e 's/CONFIG_KEMBTK_UCLIBC_*//g' > $(UCLIBC_DOTCONFIG)
+define embtk_configure_uclibc
+ $(call embtk_pinfo,"Configure uClibc")
+ $(__embtk_get_uclibc_config) | $(__embtk_set_uclibc_config)
+endef
+
+#
+# downloads
+#
+download_uclibc download_uclibc_headers:
+ $(call embtk_download_pkg,uclibc)