kumquat-buildroot/package/dtc/dtc.mk
Peter Seiderer 5774f07d43 dtc: add host build
Having a host variant of dtc is needed for example for U-Boot, which
uses the Device Tree for a number of platforms.

In addition, now that we have a proper host-dtc package, it is no
longer needed for the linux package to install the host dtc compiler:
users interested in having the host dtc compiler can simply enable
this package.

A Config.in.host option is added to build host-dtc, because the
initial reason why the host DTC built by the kernel was installed in
$(HOST_DIR)/usr/bin (commit 707d44d0a2
from Thomas DS) was:

    Having dtc as a host tool can be useful for users that have a
    custom boot scenario where the device tree is not embedded in the
    kernel.

[Thomas:
  - rework the commit log.]
[Peter: keep the (renamed) linux version]
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2015-10-04 20:17:35 +02:00

58 lines
1.4 KiB
Makefile

################################################################################
#
# dtc
#
################################################################################
DTC_VERSION = 1.4.1
DTC_SOURCE = dtc-$(DTC_VERSION).tar.xz
DTC_SITE = https://www.kernel.org/pub/software/utils/dtc
DTC_LICENSE = GPLv2+/BSD-2c
DTC_LICENSE_FILES = README.license GPL
DTC_INSTALL_STAGING = YES
DTC_DEPENDENCIES = host-bison host-flex
define DTC_POST_INSTALL_TARGET_RM_DTDIFF
rm -f $(TARGET_DIR)/usr/bin/dtdiff
endef
ifeq ($(BR2_PACKAGE_DTC_PROGRAMS),y)
DTC_LICENSE += (for the library), GPLv2+ (for the executables)
DTC_INSTALL_GOAL = install
ifeq ($(BR2_PACKAGE_BASH),)
DTC_POST_INSTALL_TARGET_HOOKS += DTC_POST_INSTALL_TARGET_RM_DTDIFF
endif
else # $(BR2_PACKAGE_DTC_PROGRAMS) != y
DTC_INSTALL_GOAL = install-lib
endif # $(BR2_PACKAGE_DTC_PROGRAMS) != y
define DTC_BUILD_CMDS
$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) PREFIX=/usr
endef
# For staging, only the library is needed
define DTC_INSTALL_STAGING_CMDS
$(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX=/usr install-lib \
install-includes
endef
define DTC_INSTALL_TARGET_CMDS
$(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) PREFIX=/usr $(DTC_INSTALL_GOAL)
endef
# host build
define HOST_DTC_BUILD_CMDS
$(HOST_CONFIGURE_OPTS) $(MAKE) -C $(@D) PREFIX=$(HOST_DIR)/usr
endef
define HOST_DTC_INSTALL_CMDS
$(MAKE) -C $(@D) PREFIX=$(HOST_DIR)/usr install-bin
endef
$(eval $(generic-package))
$(eval $(host-generic-package))