Newer
Older
os / makefile
@Kanan Homma Kanan Homma on 13 Dec 2017 836 bytes Create makefile
OBJ=./obj
SYS=$(OBJ)/haribote.sys

IMG=os.img
IPL=$(OBJ)/ipl.bin

BINOPT=-nostdlib -Wl,--oformat=binary
#makefile

defult:
	make img

$(IMG): $(SYS) $(IPL)
	mformat -f 1440 -C -B $(IPL) -i $(IMG) ::
	mcopy $(SYS) -i $(IMG) ::

$(SYS): kanos.s func.s boot.c
	gcc kanos.s -nostdlib -Tasmhead.ls -o $(OBJ)/kanhead.bin
	gcc *.c $(BINOPT) -c -o $(OBJ)/boot.o
	as func.s -o $(OBJ)/func.o
	ld -o $(OBJ)/boot.bin -e Main --oformat=binary $(OBJ)/boot.o $(OBJ)/func.o
	cat $(OBJ)/kanhead.bin $(OBJ)/boot.bin > $(SYS)

$(IPL): ipl.s
	gcc ipl.s -nostdlib -Tipl.ls -o $(IPL)
#	as ipl.s -o ipl.bin



# haribote.bin: haribote.s makefile
# 	as haribote.s -o haribote.bin

img:
	make $(IMG)

run:	$(IMG)
	qemu-system-i386 -fda $(IMG)

clean:
# rm *.bin
# rm *.lst
# rm *.obj
# rm .map
# rm bootpack.bim
# rm bootpack.hrb
# rm haribote.sy

	rm $(OBJ)/*