-LOADER_BIN := $(KDIR)/$(LOADER_NAME).bin
-LOADER_GZ := $(KDIR)/$(LOADER_NAME).gz
-LOADER_ELF := $(KDIR)/$(LOADER_NAME).elf
+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