changeset 3:74b19f0bedc5

update
author mir3636
date Tue, 16 Oct 2018 22:53:36 +0900
parents 70754edc1f50
children 8bfcd14edc47
files Makefile
diffstat 1 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Oct 10 18:50:50 2018 +0900
+++ b/Makefile	Tue Oct 16 22:53:36 2018 +0900
@@ -1,17 +1,22 @@
-# target name
-TARGET=ipl
+CLANG=/Users/mitsuki/workspace/llvm/CbC_build/bin/clang -target i386-pc-linux
+CSO=bootpack.c
+OBJ=bootpack.o nasmfunc.o c/haribote-context.o
 
 # 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
+%.c : %.cbc
+	perl generate_stub_haribote.pl -o $*.c $*.cbc
+haribote-context.c : $(CSO)
+	perl generate_context_harib.pl -o haribote $(CSO)
+haribote-context.o : haribote-context.c
+	$(CLANG) -g -c -Wall c/haribote-context.c -o c/haribote-context.o
+%.o : %.c
+	$(CLANG) -c $*.c -o $*.o
+bootpack.bin : $(OBJ)
+	i386-elf-ld -m elf_i386 -e HariMain -o bootpack.bin -T os.ls $(OBJ)
 haribote.sys : asmhead.bin bootpack.bin
 	cat asmhead.bin bootpack.bin > haribote.sys
 iplelf.bin : iplelf.asm
@@ -25,7 +30,7 @@
 	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 -Map kernel.map
+	i386-elf-ld -m elf_i386 -e asmhead -o kernel.elf -T os.ls asmhead.bin $(OBJ) -Map kernel.map
 
 elf.img : iplelf.bin kernel.elf
 	mformat -f 1440 -C -B iplelf.bin -i elf.img ::