-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
142 lines (118 loc) · 5.01 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
.PHONY: all main libc boot
CC = ~/opt/cross/bin/i686-elf-gcc
CFLAGSREL = -std=gnu99 -ffreestanding -O2 -Wall -Wextra -I libc/include -I lib/include -I drivers/include -I kernel/include
CFLAGSDEB = -std=gnu99 -ffreestanding -g -Wall -Wextra -I ./libc/include -I ./lib/include -I ./drivers/include -I ./kernel/include
ASMB = ~/opt/nasm/bin/nasm
LFREL = -ffreestanding -O2 -nostdlib build/*.o -lgcc -I libc/include -I lib/include -I drivers/include -I kernel/include
LFDEB = -ffreestanding -g -nostdlib build/*.o -lgcc -I ./libc/include -I ./lib/include -I ./drivers/include -I ./kernel/include
CFLAGSINTREL = -std=gnu99 -mgeneral-regs-only -ffreestanding -O2 -Wall -Wextra -I libc/include -I lib/include -I drivers/include -I kernel/include
CFLAGSINTDEB = -std=gnu99 -mgeneral-regs-only -ffreestanding -g -Wall -Wextra -I libc/include -I lib/include -I drivers/include -I kernel/include
all:
make clean
make boot
make kernel-rel
make libc-rel
make libhelp
make coresys
make driver-rel
$(CC) -T boot/linker.ld -o build/RFOS.bin $(LFREL)
cp build/RFOS.bin isodir/boot/RFOS.bin
cp build/RFOS.bin isodir/boot/RFOS.bin
cp boot/grub.cfg isodir/boot/grub/grub.cfg
~/opt/grub/bin/grub-mkrescue -o RFOS.iso isodir
#run 'make run' to run qemu
allrun:
make all
make run
debug:
make clean
make boot
make kernel-deb
make libc-debug
make libhelp-debug
make coresys-debug
make driver-deb
$(CC) -T boot/linker.ld -o build/RFOS-debug.bin $(LFDEB)
#run 'make debugrun....' to run qemu
boot:
~/opt/cross/bin/i686-elf-as boot/boot.s -o build/boot.o
libc-rel:
$(CC) -c libc/stdio/printf.c -o build/printf.o $(CFLAGSREL)
$(CC) -c libc/stdio/puts.c -o build/stdio.o $(CFLAGSREL)
$(CC) -c libc/stdlib/abort.c -o build/abort.o $(CFLAGSREL)
$(CC) -c libc/stdlib/atoi.c -o build/atoi.o $(CFLAGSREL)
$(CC) -c libc/string/memcmp.c -o build/memcmp.o $(CFLAGSREL)
$(CC) -c libc/string/memcpy.c -o build/memcpy.o $(CFLAGSREL)
$(CC) -c libc/string/memmove.c -o build/memmove.o $(CFLAGSREL)
$(CC) -c libc/string/memset.c -o build/memset.o $(CFLAGSREL)
$(CC) -c libc/string/strlen.c -o build/strlen.o $(CFLAGSREL)
$(CC) -c libc/string/strcpy.c -o build/strcpy.o $(CFLAGSREL)
$(CC) -c libc/string/strcmp.c -o build/strcmp.o $(CFLAGSREL)
libc-debug:
$(CC) -c libc/stdio/printf.c -o build/printf.o $(CFLAGSDEB)
$(CC) -c libc/stdio/puts.c -o build/stdio.o $(CFLAGSDEB)
$(CC) -c libc/stdlib/abort.c -o build/abort.o $(CFLAGSDEB)
$(CC) -c libc/stdlib/atoi.c -o build/atoi.o $(CFLAGSDEB)
$(CC) -c libc/string/memcmp.c -o build/memcmp.o $(CFLAGSDEB)
$(CC) -c libc/string/memcpy.c -o build/memcpy.o $(CFLAGSDEB)
$(CC) -c libc/string/memmove.c -o build/memmove.o $(CFLAGSDEB)
$(CC) -c libc/string/memset.c -o build/memset.o $(CFLAGSDEB)
$(CC) -c libc/string/strlen.c -o build/strlen.o $(CFLAGSDEB)
$(CC) -c libc/string/strcpy.c -o build/strcpy.o $(CFLAGSDEB)
$(CC) -c libc/string/strcmp.c -o build/strcmp.o $(CFLAGSDEB)
libhelp:
$(CC) -c lib/termfunc.c -o build/termfunc.o $(CFLAGSREL)
$(CC) -c lib/helper.c -o build/helper.o $(CFLAGSREL)
libhelp-debug:
$(CC) -c lib/termfunc.c -o build/termfunc.o $(CFLAGSDEB)
$(CC) -c lib/helper.c -o build/helper.o $(CFLAGSDEB)
coresys:
$(ASMB) -felf32 lib/isr.s -o build/isrs.o
$(ASMB) -felf32 lib/switch.s -o build/switch.o
$(ASMB) -felf32 lib/paging.s -o build/pagings.o
$(CC) -c lib/isr.c -o build/isr.o $(CFLAGSINTREL)
$(CC) -c lib/idt.c -o build/idt.o $(CFLAGSREL)
$(CC) -c lib/gdt.c -o build/gdt.o $(CFLAGSREL)
$(CC) -c lib/irq.c -o build/irq.o $(CFLAGSREL)
$(CC) -c lib/pic.c -o build/pic.o $(CFLAGSREL)
$(CC) -c lib/liballoc.c -o build/liballoc.o $(CFLAGSREL)
$(CC) -c lib/paging.c -o build/paging.o $(CFLAGSREL)
$(CC) -c lib/tasks.c -o build/tasks.o $(CFLAGSREL)
coresys-debug:
$(ASMB) -felf32 lib/isr.s -o build/isrs.o
$(ASMB) -felf32 lib/switch.s -o build/switch.o
$(ASMB) -felf32 lib/paging.s -o build/pagings.o
$(CC) -c lib/isr.c -o build/isr.o $(CFLAGSINTDEB)
$(CC) -c lib/idt.c -o build/idt.o $(CFLAGSDEB)
$(CC) -c lib/gdt.c -o build/gdt.o $(CFLAGSDEB)
$(CC) -c lib/irq.c -o build/irq.o $(CFLAGSDEB)
$(CC) -c lib/pic.c -o build/pic.o $(CFLAGSDEB)
$(CC) -c lib/liballoc.c -o build/liballoc.o $(CFLAGSDEB)
$(CC) -c lib/paging.c -o build/paging.o $(CFLAGSDEB)
$(CC) -c lib/tasks.c -o build/tasks.o $(CFLAGSDEB)
driver-rel:
$(CC) -c drivers/keyboard.c -o build/keyboard.o $(CFLAGSINTREL)
$(CC) -c drivers/cursor.c -o build/cursor.o $(CFLAGSINTREL)
driver-deb:
$(CC) -c drivers/keyboard.c -o build/keyboard.o $(CFLAGSINTDEB)
$(CC) -c drivers/cursor.c -o build/cursor.o $(CFLAGSINTDEB)
kernel-rel:
$(CC) -c kernel/kernel.c -o build/kernel.o $(CFLAGSREL)
$(CC) -c kernel/shell.c -o build/shell.o $(CFLAGSREL)
kernel-deb:
$(CC) -c kernel/kernel.c -o build/kernel.o $(CFLAGSDEB)
$(CC) -c kernel/shell.c -o build/shell.o $(CFLAGSDEB)
clean:
rm -rf build/*.o
rm -rf build/*.bin
rm -rf *.sym
cleaniso:
rm -rf *.iso
run:
qemu-system-i386 -cdrom RFOS.iso
debugrun:
make debug
qemu-system-i386 -s -S -kernel build/RFOS-debug.bin -monitor stdio
debugrunnogdb:
make debug
qemu-system-i386 -kernel build/RFOS-debug.bin -monitor stdio