kernel/src/Makefile

64 lines
1.2 KiB
Makefile
Raw Normal View History

2022-06-07 04:34:58 +00:00
CCPREFIX = /home/kotovalexarian/repos/global/tailix/cross/root/bin/i386-elf-
2022-01-17 11:39:42 +00:00
LIBKERNAUX_PREFIX = /opt/libkernaux/i386
2020-11-25 09:32:16 +00:00
AS = $(CCPREFIX)as
CC = $(CCPREFIX)gcc
2020-11-25 18:10:00 +00:00
LD = $(CCPREFIX)ld
2020-11-25 09:32:16 +00:00
KERNEL = tailix.multiboot2
2020-11-25 09:32:16 +00:00
2021-12-12 14:37:08 +00:00
CFLAGS = \
-std=gnu99 \
2021-12-14 19:46:51 +00:00
-pedantic \
2021-12-12 14:37:08 +00:00
-Wall \
-Wextra \
-ffreestanding \
-fno-builtin \
-fno-stack-protector \
2022-01-17 11:39:42 +00:00
-I$(LIBKERNAUX_PREFIX)/include
2020-11-25 09:32:16 +00:00
2021-12-18 01:04:00 +00:00
CPPFLAGS = \
2021-12-20 02:27:19 +00:00
-DKERNAUX_ENABLE_ASSERT \
-DKERNAUX_ENABLE_GUARD
2021-12-18 01:04:00 +00:00
2020-11-25 09:32:16 +00:00
# Architecture-dependent
OBJS = start.s.o
OBJS += main.c.o
2020-11-27 14:15:02 +00:00
OBJS += panic.c.o
2020-11-27 14:05:20 +00:00
OBJS += paging.c.o
2020-11-25 09:32:16 +00:00
# Architecture-independent
OBJS += info.c.o
# Built-in drivers
OBJS += timer.c.o
2022-06-24 04:34:46 +00:00
OBJS += protected.c.o
2020-11-25 09:32:16 +00:00
OBJS += interrupts/main.asm.cpp.o
OBJS += interrupts/exception.c.o
OBJS += interrupts/hwint.c.o
OBJS += interrupts/syscall.c.o
2020-11-25 09:32:16 +00:00
all: $(KERNEL)
clean:
rm -f $(KERNEL) $(OBJS)
$(KERNEL): $(OBJS)
2022-06-23 10:41:28 +00:00
$(CC) -T linker.ld -o $@ $^ -ffreestanding -nostdlib -lkernaux -lgcc -Wl,-L$(LIBKERNAUX_PREFIX)/lib
2020-11-25 09:32:16 +00:00
grub-file --is-x86-multiboot2 $@
%.c.o: %.c
2021-12-18 01:04:00 +00:00
$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
2020-11-25 09:32:16 +00:00
%.s.o: %.s
$(AS) $< -o $@
%.asm.cpp.o: %.asm.cpp
2020-11-25 11:00:24 +00:00
nasm -f elf32 -o $@ $<
2020-11-25 09:32:16 +00:00
%.asm.cpp: %.asm
cpp -P $< $@