-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (24 loc) · 679 Bytes
/
Makefile
File metadata and controls
35 lines (24 loc) · 679 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
34
35
ASSEMBLER=nasm
CC=gcc
LD=ld -m elf_i386
include src.mk
OBJECTS := $(ASM_SOURCES:.s=.o)
OBJECTS += $(C_SOURCES:.c=.o)
INCLUDES := -I./inc
CFLAGS := -m32 -Wall -Wextra -Werror -nostdlib #-DDEBUG
CFLAGS += -fno-builtin -nostartfiles -nodefaultlibs
KERNEL := output/kernel.bin
all: $(KERNEL)
$(KERNEL):$(OBJECTS) asm/linker.ld
$(info building $(KERNEL))
@$(LD) -T asm/linker.ld -o $(KERNEL) $(OBJECTS)
%.o:%.s
$(info building $@)
@$(ASSEMBLER) -f elf -o $@ $^
%.o:%.c
$(info building $@)
@$(CC) $(INCLUDES) -o $@ -c $^ $(CFLAGS)
clean:
rm -f $(OBJECTS) $(KERNEL)
run: $(KERNEL)
cd output && ./update_image.sh && qemu-system-i386 -no-kvm -m 64 -fda floppy.img