aboutsummaryrefslogtreecommitdiffstats
path: root/package/dtc/dtc.mk
blob: 5e8965466f00daec25253e555efed72d127ba6b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
################################################################################
#
# dtc
#
################################################################################

DTC_VERSION         = e4b497f367a3b2ae99cc52089a14a221b13a76ef
DTC_SITE            = git://git.jdl.com/software/dtc.git
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)
# Use default goal to build everything
DTC_BUILD_GOAL      =
DTC_INSTALL_GOAL    = install
DTC_CLEAN_GOAL      = clean
ifeq ($(BR2_PACKAGE_BASH),)
DTC_POST_INSTALL_TARGET_HOOKS += DTC_POST_INSTALL_TARGET_RM_DTDIFF
endif

else # $(BR2_PACKAGE_DTC_PROGRAMS) != y

DTC_BUILD_GOAL      = libfdt
# libfdt_install is our own install rule added by our patch
DTC_INSTALL_GOAL    = libfdt_install
DTC_CLEAN_GOAL      = libfdt_clean

endif # $(BR2_PACKAGE_DTC_PROGRAMS) != y

define DTC_BUILD_CMDS
	$(TARGET_CONFIGURE_OPTS)    \
	CFLAGS="$(TARGET_CFLAGS)"   \
	$(MAKE) -C $(@D) PREFIX=/usr $(DTC_BUILD_GOAL)
endef

# For staging, only the library is needed
define DTC_INSTALL_STAGING_CMDS
	$(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX=/usr libfdt_install
endef

define DTC_INSTALL_TARGET_CMDS
	$(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) PREFIX=/usr $(DTC_INSTALL_GOAL)
endef

define DTC_CLEAN_CMDS
	$(MAKE) -C $(@D) $(DTC_CLEAN_GOAL)
endef

$(eval $(generic-package))