dda5fa4e9ce4a1e082d46e7abd56b73f40bbef49
[openwrt/openwrt.git] / package / boot / at91bootstrap / at91bootstrap.mk
1
2 PKG_TARGETS := bin
3 PKG_FLAGS:=nonshared
4
5 export GCC_HONOUR_COPTS=s
6
7 define Package/at91bootstrap/install/default
8 $(CP) $(PKG_BUILD_DIR)/binaries/*uboot* $(1)/
9 endef
10
11 Package/at91bootstrap/install = $(Package/at91bootstrap/install/default)
12
13 define AT91Bootstrap/Init
14 BUILD_TARGET:=
15 BUILD_SUBTARGET:=
16 BUILD_DEVICES:=
17 NAME:=
18 DEPENDS:=
19 HIDDEN:=
20 DEFAULT:=
21 VARIANT:=$(1)
22 AT91BOOTSTRAP_CONFIG:=$(1)
23 endef
24
25 TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET))
26
27 AT91BOOTSTRAP_MAKE_FLAGS = \
28 HOSTCC="$(HOSTCC)" \
29 HOSTCFLAGS='$(HOST_CFLAGS) $$$$(HOSTCPPFLAGS)' \
30 HOSTLDFLAGS=""
31
32 define Build/AT91Bootstrap/Target
33 $(eval $(call AT91Bootstrap/Init,$(1)))
34 $(eval $(call AT91Bootstrap/Default,$(1)))
35 $(eval $(call AT91Bootstrap/$(1),$(1)))
36
37 define Package/at91bootstrap-$(1)
38 SECTION:=boot
39 CATEGORY:=Boot Loaders
40 TITLE:= .$(NAME)
41 VARIANT:=$(VARIANT)
42 DEPENDS:=@!IN_SDK $(DEPENDS)
43 HIDDEN:=$(HIDDEN)
44 ifneq ($(BUILD_TARGET),)
45 DEPENDS += @$(TARGET_DEP)
46 ifneq ($(BUILD_DEVICES),)
47 DEFAULT := y if ($(TARGET_DEP)_Default \
48 $(patsubst %,|| $(TARGET_DEP)_DEVICE_%,$(BUILD_DEVICES)) \
49 $(patsubst %,|| $(patsubst TARGET_%,TARGET_DEVICE_%, \
50 $(TARGET_DEP))_DEVICE_%,$(BUILD_DEVICES)))
51 endif
52 endif
53 $(if $(DEFAULT),DEFAULT:=$(DEFAULT))
54 URL:=https://www.at91.com/linux4sam/bin/view/Linux4SAM/AT91Bootstrap
55 endef
56
57 define Package/at91bootstrap-$(1)/install
58 $$(Package/at91bootstrap/install)
59 endef
60 endef
61
62 define Build/Configure/AT91Bootstrap
63 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
64 $(AT91BOOTSTRAP_CONFIG)_defconfig
65 endef
66
67
68 define Build/Compile/AT91Bootstrap
69 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
70 CROSS_COMPILE=$(TARGET_CROSS) \
71 $(AT91BOOTSTRAP_MAKE_FLAGS)
72 endef
73
74 define BuildPackage/AT91Bootstrap/Defaults
75 Build/Configure/Default = $$$$(Build/Configure/AT91Bootstrap)
76 Build/Compile/Default = $$$$(Build/Compile/AT91Bootstrap)
77 endef
78
79 define BuildPackage/AT91Bootstrap
80 $(eval $(call BuildPackage/AT91Bootstrap/Defaults))
81 $(foreach type,$(if $(DUMP),$(AT91BOOTSTRAP_TARGETS),$(BUILD_VARIANT)), \
82 $(eval $(call Build/AT91Bootstrap/Target,$(type)))
83 )
84 $(eval $(call Build/DefaultTargets))
85 $(foreach type,$(if $(DUMP),$(AT91BOOTSTRAP_TARGETS),$(BUILD_VARIANT)), \
86 $(call BuildPackage,at91bootstrap-$(type))
87 )
88 endef