-$(PKG_BUILD_DIR)/$(LOADER).gz: $(PKG_BUILD_DIR)/.prepared
- $(MAKE) -C $(PKG_BUILD_DIR) CC="$(TARGET_CC)" \
- LD="$(TARGET_CROSS)ld" CROSS_COMPILE="$(TARGET_CROSS)" \
- LOADER=$(LOADER) BZ_STARTUP_ORG=$(BZ_STARTUP_ORG)
+loader-compile: $(PKG_BUILD_DIR)/.prepared
+ $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \
+ LZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG) \
+ LZMA_TEXT_START=$(LZMA_TEXT_START) \
+ LOADER_DATA=$(LOADER_DATA) \
+ clean all
+
+$(LOADER_GZ): $(PKG_BUILD_DIR)/loader.bin
+ gzip -nc9 $< > $@
+
+$(LOADER_ELF) : $(PKG_BUILD_DIR)/loader.elf
+ $(CP) $< $@
+
+$(LOADER_BIN) : $(PKG_BUILD_DIR)/loader.bin
+ $(CP) $< $@