-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
82 lines (68 loc) · 2.19 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# The makefile of haribote OS
DEL = rm -f
GCC = gcc -c -m32 -fno-pic -nostdlib
LD = ld --gc-sections -m elf_i386 -T os.ls
LD_API = ld --gc-sections -m elf_i386 -T api.ls
# nasm:
# -f: Select an output format.
# ELF32 (i386) object files (e.g. Linux)
NASM_ELF32 = nasm -f elf32
NASM = nasm
QEMU = qemu-system-i386 -monitor stdio -m 32 -rtc base=localtime -vga std -fda
OBJS = $(patsubst %.c,%.o,$(wildcard *.c))
APILIBPATH = ./apilib/
APPPATH = ./app/
FONTPATH = ./fonts/
LIBPATH = ./lib/
# Commands
default:
make run
%.o: %.c
$(GCC) -o $*.o $*.c
map:
$(LD) -Map=bootpack.map -e hari_main -o bootpack.bin $(FILES)
ipl.bin: ipl10.asm
$(NASM) -o ipl10.bin ipl10.asm
nasmhead.bin: nasmhead.asm
$(NASM) -o nasmhead.bin nasmhead.asm
nasmfunc.o: nasmfunc.asm
$(NASM_ELF32) -o nasmfunc.o nasmfunc.asm
bootpack.bin: $(OBJS) nasmfunc.o
$(LD) -e hari_main -o bootpack.bin nasmfunc.o $(OBJS) $(FONTPATH)hankaku.o $(LIBPATH)libc.a
os.sys: nasmhead.bin bootpack.bin
cat nasmhead.bin bootpack.bin > os.sys
# mformat: Add an MSDOS file sys
# -f: Specifies the size of the DOS filesystem to format.
# 1440K, double-sided, 18 sectors per track, 80 cylinders (for 3 1/2 HD)
# -C: Creates the disk image file to install the MS-DOS filesystem on it.
# -B: Use the bootsector stored in the given file or device, instead of using its own.
# mcopy: Copy MSDOS files to/from Unix.
# :: To overwrite if a os.sys file exists already
os.img: ipl.bin os.sys
mformat -f 1440 -C -B ipl10.bin -i os.img ::
mcopy -i os.img os.sys ::
mcopy -i os.img hoge.txt ::
mcopy -i os.img $(APPPATH)winhel.bin ::
mcopy -i os.img $(APPPATH)winhel2.bin ::
mcopy -i os.img $(APPPATH)star1.bin ::
mcopy -i os.img $(APPPATH)lines.bin ::
mcopy -i os.img $(APPPATH)walk.bin ::
mcopy -i os.img $(APPPATH)color.bin ::
mcopy -i os.img $(APPPATH)color2.bin ::
mcopy -i os.img $(APPPATH)noodle.bin ::
mcopy -i os.img $(APPPATH)sosu.bin ::
mcopy -i os.img $(APPPATH)sosu2.bin ::
mcopy -i os.img $(APPPATH)typefile.bin ::
mcopy -i os.img $(APPPATH)notrec.bin ::
mcopy -i os.img $(APPPATH)bball.bin ::
run: os.img
$(QEMU) os.img
clean:
$(DEL) *.bin
$(DEL) *.lst
$(DEL) *.img
$(DEL) *.o
$(DEL) *.sys
$(DEL) *.map
debug:
$(QEMU) os.img -gdb tcp::10000 -S