diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-03-28 09:10:23 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-03-28 09:10:23 +0100 |
commit | bb55beef914e7488350ad1d0419d4bc60ad63c99 (patch) | |
tree | b1cfe0e5c76cbca16e7e3c16e108c23e366a2902 /sos-code-article2/Makefile | |
download | SOS-bb55beef914e7488350ad1d0419d4bc60ad63c99.tar.gz SOS-bb55beef914e7488350ad1d0419d4bc60ad63c99.zip |
Import code for article1, 2, 3, 4
Diffstat (limited to 'sos-code-article2/Makefile')
-rw-r--r-- | sos-code-article2/Makefile | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/sos-code-article2/Makefile b/sos-code-article2/Makefile new file mode 100644 index 0000000..fd1fa89 --- /dev/null +++ b/sos-code-article2/Makefile @@ -0,0 +1,56 @@ +CC=i586-elf-gcc +LD=i586-elf-ld +CFLAGS = -Wall -nostdlib -nostdinc -ffreestanding -DKERNEL_SOS +LDFLAGS = --warn-common +OBJECTS = bootstrap/multiboot.o \ + hwcore/idt.o hwcore/gdt.o \ + hwcore/exception.o hwcore/exception_wrappers.o \ + hwcore/irq.o hwcore/irq_wrappers.o hwcore/i8259.o \ + hwcore/i8254.o drivers/x86_videomem.o drivers/bochs.o \ + sos/klibc.o sos/main.o + +KERNEL_OBJ = sos.elf +MULTIBOOT_IMAGE = cdrom.iso +PWD := $(shell pwd) + +# Main target +all: $(MULTIBOOT_IMAGE) + +$(MULTIBOOT_IMAGE): $(KERNEL_OBJ) + # ./support/build_image.sh $@ $< + if [ ! -e cdrom/boot/grub/stage2_eltorito ]; then \ + mkdir -p cdrom/boot/grub; \ + echo "Please copy grub's stage2_eltorito to cdrom/boot/grub."; \ + exit -1; \ + fi + cp $(KERNEL_OBJ) cdrom + echo timeout 0 > cdrom/boot/grub/menu.lst + echo title Simple OS >> cdrom/boot/grub/menu.lst + echo kernel /$(KERNEL_OBJ) >> cdrom/boot/grub/menu.lst + genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 \ + -boot-info-table -input-charset ascii -A SOS -o $(MULTIBOOT_IMAGE) cdrom + +$(KERNEL_OBJ): $(OBJECTS) ./support/sos.lds + $(LD) $(LDFLAGS) -T ./support/sos.lds -o $@ $(OBJECTS) + -nm -C $@ | cut -d ' ' -f 1,3 > sos.map + +-include .mkvars + +# Create objects from C source code +%.o: %.c + $(CC) -I$(PWD) -c $< $(CFLAGS) -o $@ + +# Create objects from assembler (.S) source code +%.o: %.S + $(CC) -I$(PWD) -c $< $(CFLAGS) -DASM_SOURCE=1 -o $@ + +# Clean directory +clean: + $(RM) *.img *.iso *.o mtoolsrc *~ menu.txt *.img *.elf *.bin *.map + $(RM) *.log *.out bochs* + $(RM) bootstrap/*.o bootstrap/*~ + $(RM) drivers/*.o drivers/*~ + $(RM) hwcore/*.o hwcore/*~ + $(RM) sos/*.o sos/*~ + $(RM) support/*~ + $(RM) extra/*~ |