-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
57 lines (41 loc) · 924 Bytes
/
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
KERNEL_ADDR=0x01000000
PROG=minsmp
OBJ= boot.o main.o video.o mem.o acpi.o cpu.o mp.o lapic.o ioapic.o pit.o
S=.
INC=$(S)/include
CC=gcc
CFLAGS= -m32 -O2
CFLAGS+= -Wall -Wextra -Werror
CFLAGS+= -fno-stack-protector
CFLAGS+= -ffreestanding
CFLAGS+= -no-pie
CFLAGS+= -I$(INC)
ASFLAGS= -m32
LD=ld
LDFLAGS= --script link.ld
LDFLAGS+= -n
LDFLAGS+= --defsym=_KERNEL_ADDR=$(KERNEL_ADDR)
all : $(PROG)
$(PROG) : $(OBJ)
$(LD) $(LDFLAGS) -o $(PROG) $(OBJ)
%.o : %.c
$(CC) $(CFLAGS) -c -o $@ $^
%.o : %.S
$(CC) $(ASFLAGS) -c -o $@ $^
clean:
rm -rf $(PROG) $(OBJ)
@rm -rf *~ .*~
@cd include && rm -rf *~ .*~ && cd ..
qemu: $(PROG)
qemu-system-i386 -m 512 -enable-kvm \
-smp 6 \
-kernel $(PROG) \
-monitor telnet:127.0.0.1:5565,server,nowait \
-curses
debug: $(PROG)
qemu-system-i386 -m 512 -enable-kvm \
-smp 2 \
-kernel $(PROG) \
-monitor telnet:127.0.0.1:5565,server,nowait \
-curses \
-S -s