forked from xamidev/pepperOS
Extract CC and LD to variables.
This allows to change the name of the compiler or linker when calling make.
This commit is contained in:
9
Makefile
9
Makefile
@@ -1,21 +1,24 @@
|
||||
SOURCES = src/sched/spinlock.c src/debug/misc.c src/io/term/flanterm_backends/fb.c src/io/term/flanterm.c src/debug/panic.c src/debug/stacktrace.c src/boot/boot.c src/sched/scheduler.c src/sched/process.c src/mem/heap/kheap.c src/mem/paging/vmm.c src/mem/paging/paging.c src/mem/paging/pmm.c src/string/string.c src/io/kbd/ps2.c src/io/serial/serial.c src/io/term/term.c src/idt/idt.c src/mem/gdt/gdt.c src/mem/misc/utils.c src/time/timer.c src/kmain.c
|
||||
|
||||
CC := x86_64-elf-gcc
|
||||
CC_FLAGS=-Wall -Wextra -std=gnu99 -nostdlib -ffreestanding -fno-stack-protector -fno-omit-frame-pointer -fno-stack-check -fno-PIC -ffunction-sections -fdata-sections -mcmodel=kernel
|
||||
CC_PROBLEMATIC_FLAGS=-Wno-unused-parameter -Wno-unused-variable
|
||||
|
||||
LD := x86_64-elf-ld
|
||||
|
||||
.PHONY: build build-iso debug debug2 run clean
|
||||
|
||||
build:
|
||||
mkdir -p build
|
||||
rm -f *.o build/*.o
|
||||
x86_64-elf-gcc -g -c -Isrc $(SOURCES) $(CC_PROBLEMATIC_FLAGS) $(CC_FLAGS)
|
||||
$(CC) -g -c -Isrc $(SOURCES) $(CC_PROBLEMATIC_FLAGS) $(CC_FLAGS)
|
||||
mv *.o build/
|
||||
nasm -f elf64 src/idt/idt.S -o build/idt_stub.o
|
||||
x86_64-elf-ld -o pepperk -T linker.ld build/*.o
|
||||
$(LD) -o pepperk -T linker.ld build/*.o
|
||||
nm -n pepperk | awk '$$2 ~ /[TtDdBbRr]/ {print $$1, $$3}' > symbols.map
|
||||
python3 symbols.py
|
||||
nasm -f elf64 symbols.S -o build/symbols.o
|
||||
x86_64-elf-ld -o pepperk -T linker.ld build/*.o
|
||||
$(LD) -o pepperk -T linker.ld build/*.o
|
||||
|
||||
limine/limine:
|
||||
rm -rf limine
|
||||
|
||||
Reference in New Issue
Block a user