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