-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (36 loc) · 855 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
TARGET = kfs
NASM = nasm
NFLAGS = -f elf32
CFLAGS += -nostdinc -fno-builtin -m32
CFLAGS += -fno-stack-protector -Iinc
LDFLAGS += -T kfs.ld -nostdlib -m32 -Wl,--build-id=none
SRCDIR = src
SRC = $(SRCDIR)/main.c \
$(SRCDIR)/memset.c \
$(SRCDIR)/vga.c \
$(SRCDIR)/serial.c \
$(SRCDIR)/printk.c \
$(SRCDIR)/segmentation.c \
$(SRCDIR)/interrupts.c
ASM = $(SRCDIR)/crt0.S \
$(SRCDIR)/isr.S
OBJS = $(SRC:.c=.o) $(ASM:.S=.o)
QEMU = qemu-system-x86_64
GDB = gdb
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $^ -o $@ $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.S
$(NASM) $(NFLAGS) $< -o $@
clean:
$(RM) $(OBJS)
fclean: clean
$(RM) $(TARGET)
re: fclean all
boot: $(TARGET)
$(QEMU) -kernel $(TARGET)
debug: $(TARGET)
$(QEMU) -s -S -daemonize -kernel $(TARGET)
$(GDB) $(TARGET) -ex "target remote localhost:1234"