enable start-stop-daemon by default, i want to use this to clean up a few init script...
[openwrt/staging/dedeckeh.git] / target / linux / adm5120-2.6 / image / lzma-loader / Makefile
index 175a1845ce0bc53dcbcaa46797050355a18afc5c..74866e765e66370d2b7199d0870d4827a7637f57 100644 (file)
@@ -4,35 +4,60 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-# $Id: Makefile 4439 2006-08-04 17:14:36Z nbd $
+# $Id$
 
 include $(TOPDIR)/rules.mk
 
-LOADER := loader
-BZ_STARTUP_ORG := 0
+LOADER         := loader.bin
+LOADER_NAME    := $(basename $(notdir $(LOADER)))
+LOADER_DATA    :=
+TARGET_DIR     :=
+
+ifeq ($(TARGET_DIR),)
+TARGET_DIR     := $(KDIR)
+endif
+
+LOADER_BIN     := $(TARGET_DIR)/$(LOADER_NAME).bin
+LOADER_GZ      := $(TARGET_DIR)/$(LOADER_NAME).gz
+LOADER_ELF     := $(TARGET_DIR)/$(LOADER_NAME).elf
+
+LZMA_STARTUP_ORG:= 0
+LZMA_TEXT_START        := 0x80300000
 
 PKG_NAME := lzma-loader
-PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)
+
+.PHONY : loader-compile loader.bin loader.elf loader.gz
 
 $(PKG_BUILD_DIR)/.prepared:
        mkdir $(PKG_BUILD_DIR)
        $(CP) ./src/* $(PKG_BUILD_DIR)/
        touch $@
 
-$(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) \
+               CONFIG_BOARD=$(CONFIG_BOARD) \
+               CONFIG_PASS_KARGS=$(CONFIG_PASS_KARGS) \
+               clean all
+
+loader.gz: $(PKG_BUILD_DIR)/loader.bin
+       gzip -nc9 $< > $(LOADER_GZ)
+
+loader.elf: $(PKG_BUILD_DIR)/loader.elf
+       $(CP) $< $(LOADER_ELF)
+
+loader.bin: $(PKG_BUILD_DIR)/loader.bin
+       $(CP) $< $(LOADER_BIN)
 
 download:
 prepare: $(PKG_BUILD_DIR)/.prepared
-compile: $(PKG_BUILD_DIR)/$(LOADER).gz
-install:
+compile: loader-compile
 
-ifneq ($(TARGET),)
-install: compile
-       $(CP) $(PKG_BUILD_DIR)/$(LOADER).gz $(PKG_BUILD_DIR)/$(LOADER).elf $(PKG_BUILD_DIR)/$(LOADER).bin $(TARGET)/
-endif
+install:
 
 clean:
        rm -rf $(PKG_BUILD_DIR)
+