hos/Makefile
josh 81a56c9fcf build system works using i586-elf cross-compiler in cygwin
git-svn-id: svn://anubis/hos/trunk@13 5b3e749e-e535-0410-8002-a9bb6afbdfca
2009-06-25 13:16:22 +00:00

47 lines
1022 B
Makefile

KERNEL_FILE := hos.gz
MKISOFS := genisoimage
ISO := hos.iso
QEMU := qemu-system-x86_64
export PLATFORM := $(shell if [[ `uname` =~ "CYGWIN" ]]; then \
echo cygwin; \
else \
echo unix; \
fi)
ifeq ($(PLATFORM), cygwin)
export LD := i586-elf-ld
export CC := i586-elf-gcc
export CXX := i586-elf-g++
else
export LD := ld
export CC := gcc
export CXX := g++
endif
export NASM := nasm
# default target: build the kernel and ISO image
all: kernel iso
# build the kernel
.PHONY: kernel
kernel:
make -C $@
# build the ISO image
.PHONY: iso
iso: $(ISO) kernel
$(ISO): kernel
cp kernel/$(KERNEL_FILE) iso/boot
$(MKISOFS) -R -b boot/grub/stage2_eltorito -no-emul-boot \
-boot-load-size 4 -boot-info-table -o $(ISO) iso
.PHONY: qemu
qemu: iso
$(QEMU) -cdrom $(ISO) -boot d -m 384 -localtime
.PHONY: clean
clean:
make -C kernel clean
-rm -f $(ISO) iso/boot/$(KERNEL_FILE)