diff Makefile @ 0:1a23828953f2

haribote day 4
author mir3636
date Wed, 03 Oct 2018 21:06:50 +0900
parents
children 70754edc1f50
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Wed Oct 03 21:06:50 2018 +0900
@@ -0,0 +1,51 @@
+# target name
+TARGET=ipl
+
+# dependencies
+asmhead.bin : asmhead.asm
+	nasm -f elf32 -g -o asmhead.bin asmhead.asm
+nasmfunc.o : nasmfunc.asm
+	nasm -f elf32 -g -o nasmfunc.o nasmfunc.asm
+#bootpack.bin : bootpack.c nasmfunc.o
+#	gcc -m32 -nostdlib -Wl,--oformat,binary bootpack.c nasmfunc.o -T os.ls -o bootpack.bin
+bootpack.o : bootpack.c
+	clang -target i386-pc-linux -c bootpack.c -o bootpack.o
+bootpack.bin : bootpack.o nasmfunc.o
+	i386-elf-ld -m elf_i386 -e HariMain -o bootpack.bin -T os.ls bootpack.o nasmfunc.o
+haribote.sys : asmhead.bin bootpack.bin
+	cat asmhead.bin bootpack.bin > haribote.sys
+iplelf.bin : iplelf.asm
+	nasm -o iplelf.bin iplelf.asm
+ipl10.bin : ipl10.asm
+	nasm -o ipl10.bin ipl10.asm
+haribote.img : ipl10.bin haribote.sys
+	mformat -f 1440 -C -B ipl10.bin -i haribote.img ::
+	mcopy -i haribote.img haribote.sys ::
+img :
+	make -r haribote.img
+
+kernel.elf: asmhead.bin bootpack.o nasmfunc.o
+	i386-elf-ld -m elf_i386 -e asmhead -o kernel.elf -T os.ls asmhead.bin bootpack.o nasmfunc.o
+
+elf.img : iplelf.bin kernel.elf
+	mformat -f 1440 -C -B iplelf.bin -i elf.img ::
+	mcopy -i elf.img kernel.elf ::
+
+clean:
+	-rm *.bin
+	-rm *.o
+	-rm *.sys
+	-rm *.img
+
+src_only :
+	make clean
+	rm haribote.img
+
+elf: elf.img kernel.elf
+	qemu-system-i386 -fda elf.img -m 512M  
+
+elfd: elf.img kernel.elf
+	qemu-system-i386 -fda elf.img -m 512M -gdb tcp::1234 -S 
+
+do: haribote.img
+	qemu-system-i386 -fda haribote.img -m 512M