...
This commit is contained in:
17
makefile
17
makefile
@@ -1,8 +1,10 @@
|
||||
CC = i386-elf-gcc
|
||||
LD = i386-elf-ld
|
||||
CC = x86_64-elf-gcc
|
||||
LD = x86_64-elf-ld
|
||||
AS = nasm
|
||||
|
||||
CFLAGS = -m32 -ffreestanding -fno-builtin -Wall -Wextra -Wshadow -std=c23
|
||||
LDFLAGS =
|
||||
CFLAGS = -m64 -ffreestanding -fno-builtin -Wall -Wextra -Wshadow -std=c23 -g
|
||||
LDFLAGS = -g
|
||||
ASFLAGS = -f elf64 -g -F dwarf
|
||||
|
||||
SRC_C := src/kernel.c src/string.c src/vga.c
|
||||
SRC_ASM := src/boot.asm
|
||||
@@ -11,9 +13,6 @@ OBJ_C := $(SRC_C:src/%.c=.build/%.o)
|
||||
OBJ_ASM := $(SRC_ASM:src/%.asm=.build/%.o)
|
||||
OBJS := $(OBJ_C) $(OBJ_ASM)
|
||||
|
||||
kernel: .build/kernel
|
||||
@echo "Kernel created at '.build/kernel'"
|
||||
|
||||
iso: .build/nub-os.iso
|
||||
@echo "ISO created at '.build/nub-os.iso'"
|
||||
|
||||
@@ -30,10 +29,10 @@ build-dir:
|
||||
grub-mkrescue -o .build/nub-os.iso .build/nub-os/
|
||||
|
||||
.build/kernel: $(OBJS) | linker.ld
|
||||
$(LD) $(LDFLAGS) -m elf_i386 -T linker.ld -o $@ $^
|
||||
$(LD) $(LDFLAGS) -T linker.ld -o $@ $^
|
||||
|
||||
.build/%.o: src/%.c | build-dir
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
.build/%.o: src/%.asm | build-dir
|
||||
nasm -f elf32 -o $@ $<
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
Reference in New Issue
Block a user