#
# Makefile for Linux arch/ppc/force source directory
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...


include $(TOPDIR)/Rules.make 

OBJCOPY = $(CROSS_COMPILE)objcopy

LIBS = $(TOPDIR)/lib/lib.a 
BOOTOBJS = console.o start.o string.o inflate.o zlib.o

all:	zImage


zImage:	$(LIBS) $(BOOTOBJS) head.S vmlinux.gz
	$(CC) -D__ASSEMBLY__ -DBOOTBASE=0x80000000 -DBOOTDATA=0x81000000 -c -o head.o head.S
	$(OBJCOPY) -O elf32-powerpc --add-section=image=vmlinux.gz \
	--set-section-flags image=contents,alloc,load,load,data head.o boot_tmp.o
	$(LD) -Tboot.lds -o boot.elf boot_tmp.o $(BOOTOBJS) $(LIBS)
	$(OBJCOPY) -O binary boot.elf zImage
#	$(RM) boot.elf boot_tmp.o

vmlinux.gz: $(TOPDIR)/vmlinux
	$(OBJCOPY) -S -O binary $(TOPDIR)/vmlinux vmlinux
	gzip -vf9 vmlinux
 
clean:
	rm -f *.o vmlinux* zvmlinux* zImage* boot.elf

fastdep:
	$(TOPDIR)/scripts/mkdep *.[Sch] > .depend

dep:
	$(CPP) -M *.S *.c > .depend
