build: split legacy image building code out of image.mk
authorFelix Fietkau <nbd@nbd.name>
Tue, 19 Jul 2016 10:38:02 +0000 (12:38 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 20 Jul 2016 08:13:50 +0000 (10:13 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
include/image-legacy.mk [new file with mode: 0644]
include/image.mk

diff --git a/include/image-legacy.mk b/include/image-legacy.mk
new file mode 100644 (file)
index 0000000..3acf2b9
--- /dev/null
@@ -0,0 +1,39 @@
+LegacyDevice/Dump = $(Device/Dump)
+
+define LegacyDevice/Check
+  _PROFILE_SET = $$(strip $$(foreach profile,$$(PROFILES) DEVICE_$(1),$$(call DEVICE_CHECK_PROFILE,$$(profile))))
+  _TARGET_PREPARE := $$(if $$(_PROFILE_SET),legacy-images-prepare,prepare-disabled)
+  _TARGET := $$(if $$(_PROFILE_SET),legacy-images,install-disabled)
+  $$(if $$(_PROFILE_SET),install: legacy-images-make)
+  ifndef IB
+    $$(if $$(_PROFILE_SET),mkfs_prepare: legacy-images-prepare-make)
+  endif
+endef
+
+define LegacyDevice/Build
+  $$(_TARGET): legacy-image-$(1)
+  $$(_TARGET_PREPARE): legacy-image-prepare-$(1)
+  .PHONY: legacy-image-prepare-$(1) legacy-image-$(1)
+
+  legacy-image-prepare-$(1):
+       $$(call Image/Prepare/Profile,$(1))
+
+  legacy-image-$(1):
+       $$(call Image/BuildKernel/Profile,$(1))
+       $(foreach fs,$(TARGET_FILESYSTEMS),
+               $$(call Image/Build/Profile,$(1),$(fs))
+       )
+
+endef
+
+define LegacyDevice
+  $(call Device/InitProfile,$(1))
+  $(call Device/Default,$(1))
+  $(call LegacyDevice/Default,$(1))
+  $(call LegacyDevice/$(1),$(1))
+  $(call LegacyDevice/Check,$(1))
+  $(call LegacyDevice/$(if $(DUMP),Dump,Build),$(1))
+
+endef
+
+
index bca5d1a7c37f0fcf51c99b3174bf90b036e6b584..792960bf7989c781c2a9ec4d297af7bcae184562 100644 (file)
@@ -11,6 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 include $(INCLUDE_DIR)/host.mk
 include $(INCLUDE_DIR)/version.mk
 include $(INCLUDE_DIR)/image-commands.mk
+include $(INCLUDE_DIR)/image-legacy.mk
 
 override MAKE:=$(_SINGLE)$(SUBMAKE)
 override NO_TRACE_MAKE:=$(_SINGLE)$(NO_TRACE_MAKE)
@@ -444,7 +445,6 @@ endef
 define Device/Dump
 $$(eval $$(if $$(DEVICE_TITLE),$$(info $$(call Device/DumpInfo,$(1)))))
 endef
-LegacyDevice/Dump = $(Device/Dump)
 
 define Device
   $(call Device/InitProfile,$(1))
@@ -456,42 +456,6 @@ define Device
 
 endef
 
-define LegacyDevice/Check
-  _PROFILE_SET = $$(strip $$(foreach profile,$$(PROFILES) DEVICE_$(1),$$(call DEVICE_CHECK_PROFILE,$$(profile))))
-  _TARGET_PREPARE := $$(if $$(_PROFILE_SET),legacy-images-prepare,prepare-disabled)
-  _TARGET := $$(if $$(_PROFILE_SET),legacy-images,install-disabled)
-  $$(if $$(_PROFILE_SET),install: legacy-images-make)
-  ifndef IB
-    $$(if $$(_PROFILE_SET),mkfs_prepare: legacy-images-prepare-make)
-  endif
-endef
-
-define LegacyDevice/Build
-  $$(_TARGET): legacy-image-$(1)
-  $$(_TARGET_PREPARE): legacy-image-prepare-$(1)
-  .PHONY: legacy-image-prepare-$(1) legacy-image-$(1)
-
-  legacy-image-prepare-$(1):
-       $$(call Image/Prepare/Profile,$(1))
-
-  legacy-image-$(1):
-       $$(call Image/BuildKernel/Profile,$(1))
-       $(foreach fs,$(TARGET_FILESYSTEMS),
-               $$(call Image/Build/Profile,$(1),$(fs))
-       )
-
-endef
-
-define LegacyDevice
-  $(call Device/InitProfile,$(1))
-  $(call Device/Default,$(1))
-  $(call LegacyDevice/Default,$(1))
-  $(call LegacyDevice/$(1),$(1))
-  $(call LegacyDevice/Check,$(1))
-  $(call LegacyDevice/$(if $(DUMP),Dump,Build),$(1))
-
-endef
-
 define BuildImage
 
   ifneq ($(DUMP),)