Merge commit 'upstream/master'
[pandora-kernel.git] / arch / cris / arch-v10 / boot / rescue / Makefile
index e9f2ba2..07688da 100644 (file)
@@ -1,55 +1,35 @@
 #
-# Makefile for rescue code
+# Makefile for rescue (bootstrap) code
 #
-ifndef TOPDIR
-TOPDIR = ../../../..
-endif
-CC = gcc-cris -mlinux -I $(TOPDIR)/include
-CFLAGS = -O2
-LD = gcc-cris -mlinux -nostdlib
-OBJCOPY = objcopy-cris
+
+ccflags-y += -O2 $(LINUXINCLUDE)
+asflags-y += $(LINUXINCLUDE)
+ldflags-y += -T $(srctree)/$(obj)/rescue.ld
 OBJCOPYFLAGS = -O binary --remove-section=.bss
+obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
+OBJECT := $(obj)/head.o
 
-all: rescue.bin testrescue.bin kimagerescue.bin
+targets := rescue.o rescue.bin
 
-rescue: rescue.bin
-       # do nothing
+$(obj)/rescue.o: $(OBJECT) FORCE
+       $(call if_changed,ld)
 
-rescue.bin: head.o
-       $(LD) -T rescue.ld -o rescue.o head.o
-       $(OBJCOPY) $(OBJCOPYFLAGS) rescue.o rescue.bin
-       cp rescue.bin $(TOPDIR)
+$(obj)/rescue.bin: $(obj)/rescue.o FORCE
+       $(call if_changed,objcopy)
+       cp -p $(obj)/rescue.bin $(objtree)
 
-testrescue.bin: testrescue.o
-       $(OBJCOPY) $(OBJCOPYFLAGS) testrescue.o tr.bin
+$(obj)/testrescue.bin: $(obj)/testrescue.o
+       $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
 # Pad it to 784 bytes
        dd if=/dev/zero of=tmp2423 bs=1 count=784
        cat tr.bin tmp2423 >testrescue_tmp.bin
-       dd if=testrescue_tmp.bin of=testrescue.bin bs=1 count=784
+       dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
        rm tr.bin tmp2423 testrescue_tmp.bin
 
-kimagerescue.bin: kimagerescue.o
-       $(OBJCOPY) $(OBJCOPYFLAGS) kimagerescue.o ktr.bin
+$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
+       $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
 # Pad it to 784 bytes, that's what the rescue loader expects
        dd if=/dev/zero of=tmp2423 bs=1 count=784
        cat ktr.bin tmp2423 >kimagerescue_tmp.bin
-       dd if=kimagerescue_tmp.bin of=kimagerescue.bin bs=1 count=784
+       dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
        rm ktr.bin tmp2423 kimagerescue_tmp.bin
-
-head.o: head.S
-       $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
-
-testrescue.o: testrescue.S
-       $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
-
-kimagerescue.o: kimagerescue.S
-       $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
-
-clean:
-       rm -f *.o *.bin
-
-fastdep:
-
-modules:
-
-modules-install: