#
# arch/i386/boot/Makefile
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 1994 by Linus Torvalds
#

include Makefile.inc

BOOT_INCL = boot.h


zImage: bootsect setup compressed/rtems tools/build
	$(OBJCOPY) compressed/rtems compressed/rtems.out
	tools/build bootsect setup compressed/rtems.out $(ROOT_DEV) > zImage

bzImage: bbootsect bsetup compressed/brtems tools/build
	$(OBJCOPY) compressed/brtems compressed/brtems.out
	tools/build -b bbootsect bsetup compressed/brtems.out $(ROOT_DEV) > bzImage

compressed/rtems: $(RTEMS_IMAGE)
	@$(MAKE) -C compressed rtems

compressed/brtems: $(RTEMS_IMAGE)
	@$(MAKE) -C compressed brtems

zdisk: $(BOOTIMAGE)
	dd bs=8192 if=$(BOOTIMAGE) of=/dev/fd0

tools/build: tools/build.c
	$(HOSTCC) $(HOSTCFLAGS) -o $@ $< 

bootsect: bootsect.o
	$(LD) -Ttext 0x0 -s -oformat binary -o $@ $<

bootsect.o: bootsect.s
	$(AS) -o $@ $<

bootsect.s: bootsect.S Makefile $(BOOT_INCL)
	$(CPP) $(CPPFLAGS) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@

bbootsect: bbootsect.o
	$(LD) -Ttext 0x0 -s -oformat binary $< -o $@

bbootsect.o: bbootsect.s
	$(AS) -o $@ $<

bbootsect.s: bootsect.S Makefile $(BOOT_INCL)
	$(CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@

setup: setup.o
	$(LD) -Ttext 0x0 -s -oformat binary -e begtext -o $@ $<

setup.o: setup.s
	$(AS) -o $@ $<

setup.s: setup.S video.S Makefile $(BOOT_INCL) 
	$(CPP) $(CPPFLAGS) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@

bsetup: bsetup.o
	$(LD) -Ttext 0x0 -s -oformat binary -e begtext -o $@ $<

bsetup.o: bsetup.s
	$(AS) -o $@ $<

bsetup.s: setup.S video.S Makefile $(BOOT_INCL)
	$(CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@

dep:

clean:
	rm -f *.o *.s
	rm -f tools/build
	rm -f setup bootsect zImage compressed/rtems.out
	rm -f bsetup bbootsect bzImage compressed/brtems.out
	@$(MAKE) -C compressed clean
