uboot-envtools: remove makefile duplication for supported targets
[openwrt/staging/mkresin.git] / package / boot / uboot-envtools / Makefile
1 #
2 # Copyright (C) 2006-2014 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=uboot-envtools
11 PKG_DISTNAME:=u-boot
12 PKG_VERSION:=2018.03
13 PKG_RELEASE:=1
14
15 PKG_BUILD_DIR:=$(BUILD_DIR)/u-boot-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
17 PKG_SOURCE_URL:=\
18 http://mirror2.openwrt.org/sources \
19 ftp://ftp.denx.de/pub/u-boot
20 PKG_HASH:=7e7477534409d5368eb1371ffde6820f0f79780a1a1f676161c48442cb303dfd
21
22 PKG_BUILD_DEPENDS:=fstools
23
24 PKG_LICENSE:=GPL-2.0 GPL-2.0+
25 PKG_LICENSE_FILES:=Licenses/README
26
27 PKG_FLAGS:=nonshared
28
29 PKG_BUILD_PARALLEL:=1
30
31 include $(INCLUDE_DIR)/package.mk
32
33 define Package/uboot-envtools
34 SECTION:=utils
35 CATEGORY:=Utilities
36 SUBMENU:=Boot Loaders
37 TITLE:=read/modify U-Boot bootloader environment
38 URL:=http://www.denx.de/wiki/U-Boot
39 endef
40
41 define Package/uboot-envtools/description
42 This package includes tools to read and modify U-Boot bootloader environment.
43 endef
44
45 define Build/Configure
46 touch $(PKG_BUILD_DIR)/include/config.h
47 mkdir -p $(PKG_BUILD_DIR)/include/config
48 touch $(PKG_BUILD_DIR)/include/config/auto.conf
49 mkdir -p $(PKG_BUILD_DIR)/include/generated
50 touch $(PKG_BUILD_DIR)/include/generated/autoconf.h
51 endef
52
53 TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
54
55 define Build/Compile
56 $(MAKE) -C $(PKG_BUILD_DIR) \
57 CROSS_COMPILE="$(TARGET_CROSS)" \
58 TARGET_CFLAGS="$(TARGET_CFLAGS)" \
59 HOSTLDFLAGS= \
60 no-dot-config-targets=envtools \
61 envtools
62 endef
63
64 define Package/uboot-envtools/conffiles
65 /etc/config/ubootenv
66 /etc/fw_env.config
67 endef
68
69 define Package/uboot-envtools/install
70 $(INSTALL_DIR) $(1)/usr/sbin
71 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/env/fw_printenv $(1)/usr/sbin
72 $(LN) fw_printenv $(1)/usr/sbin/fw_setenv
73 $(INSTALL_DIR) $(1)/lib
74 $(INSTALL_DATA) ./files/uboot-envtools.sh $(1)/lib
75 $(INSTALL_DIR) $(1)/etc/uci-defaults
76 $(if $(wildcard ./files/$(BOARD)), \
77 $(INSTALL_DATA) ./files/$(BOARD) \
78 $(1)/etc/uci-defaults/30_uboot-envtools \
79 )
80 endef
81
82 $(eval $(call BuildPackage,uboot-envtools))