m501sk: Fix out of tree building
Signed-off-by: Wolfgang Denk <wd@denx.de>
diff --git a/board/m501sk/Makefile b/board/m501sk/Makefile
index da7987b..b403095 100644
--- a/board/m501sk/Makefile
+++ b/board/m501sk/Makefile
@@ -23,12 +23,16 @@
include $(TOPDIR)/config.mk
-LIB = lib$(BOARD).a
+LIB = $(obj)lib$(BOARD).a
-OBJS := m501sk.o eeprom.o
+COBJS := m501sk.o eeprom.o
SOBJS := memsetup.o
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+SOBJS := $(addprefix $(obj),$(SOBJS))
+
$(LIB): $(OBJS) $(SOBJS)
$(AR) crv $@ $(OBJS) $(SOBJS)
@@ -40,9 +44,9 @@
#########################################################################
-.depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
- $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
--include .depend
+sinclude $(obj).depend
#########################################################################