-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (24 loc) · 710 Bytes
/
Copy pathMakefile
File metadata and controls
33 lines (24 loc) · 710 Bytes
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
TOOLPREFIX = i686-elf-
CC = $(TOOLPREFIX)gcc
AS = $(TOOLPREFIX)as
QEMU = qemu-system-i386
CFLAGS = -std=gnu99 -ffreestanding -I. -g
LDFLAGS = -Tlinker.ld -ffreestanding -nostdlib -nostdinc -g
SRCS := $(wildcard kernel/**/*.c)
ASMS := $(wildcard kernel/**/*.S)
OBJS := $(patsubst %.S,%.o,$(shell find kernel -name '*.S')) $(patsubst %.c,%.o,$(shell find kernel -name '*.c'))
all: kernel.bin
kernel.bin: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $^
%.o: %.S
$(AS) $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
run:
qemu-system-i386 -kernel kernel.bin -m 512M
debug:
qemu-system-i386 -s -S -kernel kernel.bin -m 512M
clean:
find kernel -name "*.o" -type f -delete
rm -f kernel.bin
.PHONY: run debug clean all