build system works using i586-elf cross-compiler in cygwin
git-svn-id: svn://anubis/hos/trunk@13 5b3e749e-e535-0410-8002-a9bb6afbdfca
This commit is contained in:
parent
788597b6f4
commit
81a56c9fcf
29
Makefile
29
Makefile
@ -1,8 +1,23 @@
|
||||
|
||||
HOS = hos
|
||||
MKISOFS = genisoimage
|
||||
ISO = $(HOS).iso
|
||||
QEMU = qemu-system-x86_64
|
||||
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
|
||||
@ -10,14 +25,14 @@ all: kernel iso
|
||||
# build the kernel
|
||||
.PHONY: kernel
|
||||
kernel:
|
||||
make -C kernel
|
||||
make -C $@
|
||||
|
||||
# build the ISO image
|
||||
.PHONY: iso
|
||||
iso: $(ISO) kernel
|
||||
|
||||
$(ISO): kernel
|
||||
cp kernel/$(HOS) iso/boot
|
||||
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
|
||||
|
||||
@ -28,4 +43,4 @@ qemu: iso
|
||||
.PHONY: clean
|
||||
clean:
|
||||
make -C kernel clean
|
||||
-rm -f $(ISO) iso/boot/$(HOS)
|
||||
-rm -f $(ISO) iso/boot/$(KERNEL_FILE)
|
||||
|
@ -3,4 +3,4 @@ timeout 10
|
||||
default 0
|
||||
|
||||
title HOS
|
||||
kernel /boot/hos
|
||||
kernel /boot/hos.gz
|
||||
|
@ -1,16 +1,19 @@
|
||||
|
||||
KERNEL = hos
|
||||
LDFLAGS = -T link.ld
|
||||
KERNEL := hos
|
||||
LDFLAGS := -T link.ld
|
||||
|
||||
.PHONY: clean
|
||||
.PHONY: all
|
||||
all: $(KERNEL).gz
|
||||
|
||||
all: $(KERNEL)
|
||||
$(KERNEL).gz: $(KERNEL)
|
||||
gzip -c $< > $@
|
||||
|
||||
$(KERNEL): boot.o
|
||||
ld $(LDFLAGS) -o $@ $<
|
||||
$(LD) $(LDFLAGS) -o $@ $<
|
||||
|
||||
boot.o: boot.asm
|
||||
nasm -f elf -o boot.o boot.asm
|
||||
$(NASM) -f elf -o $@ $<
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-rm -f *~ $(KERNEL) *.o
|
||||
-rm -f *~ $(KERNEL) $(KERNEL).gz *.o
|
||||
|
Loading…
x
Reference in New Issue
Block a user