#
# (c) Carsten Grohmann 2004
#
# $Id: Makefile,v 1.2 2004/11/25 19:50:51 carsten Exp $
# $Source: /home/cvs/project_carsten/repository/multiboot/Makefile,v $
#
# Stand:  21. September 2004
#
# Lizenz: GPL
#
# Änderungen:
#  $Log: Makefile,v $
#  Revision 1.2  2004/11/25 19:50:51  carsten
#  - nutze writeCD um CDs zu brennen, anstelle eines direkten Aufrufs von cdrecord
#  - kleine Änderungen bei Variablennamen
#
#  Revision 1.1  2004/11/23 20:46:42  carsten
#  - Import ins CVS
#  - Makefile um die Schritte zum Erzeugen eines MultiBoot-Abbildes zu vereinfachen
#


BASE_DIR        = ./data

# name of the ISO image
ISO_IMAGE       = ./images/bootcd.iso

# name of the floppy image
FLOPPY_IMAGE    = ./images/bootfloppy.img

# device of the burner
CD_DEVICE       = AUTO

# script to handle the cd
WRITECD_BIN     = ./bin/writeCD

MKMULTIBOOTISO  = ./bin/mkMultiBootISO

# VM (virtual maschine) binary
VM_BIN          = qemu

# general options for the VM
VM_OPTS         = -S -dummy-net

# additional options to boot a floppy image
VM_FLOPPYOPTS   = -fda $(FLOPPY_IMAGE)

# additional options to boot a ISO image
VM_ISOOPTS      = -cdrom $(ISO_IMAGE)

HELP= @grep -B1 '^[a-zA-Z]*:' Makefile |\
      awk 'function p(h,t){printf"%-12s=%s\n",h,t;};\
      /\#+/{t=$$0;};\
      /:/{gsub(":.*","");h=$$0};\
      /^--/{p(h,t);t=h="";};\
      END{p(h,t)}' |\
      sed -n 's/=.*\#+/:/gp'

#+ show this text
help:
	$(HELP)

#+ do all
all: clean image

#+ burn ISO-Image
burn:
	$(WRITECD_BIN) --device $(CD_DEVICE) --image $(ISO_IMAGE)

#+ fast CDRW clean
blank:
	$(WRITECD_BIN) --device $(CD_DEVICE) --cleancdrw --blanktype fast

#+ clean complete CDRW (slow)
blankall:
	$(WRITECD_BIN) --device $(CD_DEVICE) --cleancdrw

#+ remove backup files and iso image
clean:
	find $(BASE) -name "*~" -exec rm {} \;
	rm -f $(ISO_IMAGE)

#+ create iso image
image:
	$(MKMULTIBOOTISO)

#+ simulate booting the iso image with virtual maschine like qemu
bootcd:
	$(VM_BIN) $(VM_OPTS) $(VM_ISOOPTS)

#+ simulate booting the floppy image with virtual maschine like qemu 
bootdisk:
	$(VM_BIN) $(VM_OPTS) $(VM_FLOPPYOPTS)
