ramips: lzma-loader: Refactor loader
[openwrt/openwrt.git] / target / linux / ramips / image / lzma-loader / src / Makefile
index 97fd6dad47b27180499a71ea3a84a5037c84a729..478cf17f29cb9c52b9d3255d33d85bf1fba1d01d 100644 (file)
@@ -23,6 +23,7 @@ FLASH_START   :=
 FLASH_OFFS     :=
 FLASH_MAX      :=
 PLATFORM       :=
+SUBTARGET      :=
 CACHE_FLAGS    :=
 
 CC             := $(CROSS_COMPILE)gcc
@@ -31,8 +32,6 @@ OBJCOPY               := $(CROSS_COMPILE)objcopy
 OBJDUMP                := $(CROSS_COMPILE)objdump
 
 
-include $(PLATFORM).mk
-
 BIN_FLAGS      := -O binary -R .reginfo -R .note -R .comment -R .mdebug \
                   -R .MIPS.abiflags -S
 
@@ -54,7 +53,27 @@ LDFLAGS              += -flto -fwhole-program -Wl,-z,max-page-size=4096
 
 O_FORMAT       = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
 
-OBJECTS                := head.o loader.o cache.o board-$(PLATFORM).o printf.o LzmaDecode.o
+OBJECTS                := head.o loader.o cache.o board.o printf.o LzmaDecode.o
+
+ifeq ($(strip $(SUBTARGET)),)
+$(error "Please specify a SUBTARGET!")
+endif
+
+ifeq ($(strip $(SUBTARGET)),mt7620)
+CFLAGS += -DSOC_MT7620
+endif
+
+ifeq ($(strip $(SUBTARGET)),mt7621)
+CFLAGS += -DSOC_MT7621
+endif
+
+ifeq ($(strip $(SUBTARGET)),rt305x)
+CFLAGS += -DSOC_RT305X
+endif
+
+ifeq ($(strip $(SUBTARGET)),rt3883)
+CFLAGS += -DSOC_RT3883
+endif
 
 ifneq ($(strip $(LOADER_DATA)),)
 OBJECTS                += data.o