λ

furix

cute os

settings

Makefile

1033 bytes raw

ARCH ?= x86_64

CC := clang

KERNEL_SRC := \
	kernel/acpi.c \
	kernel/kernel.c

BUILD      := build/obj
BUILD_BOOT := build/boot/$(ARCH)
EFI        := $(BUILD_BOOT)/furix.efi

CFLAGS := \
	-std=c11 -Wall -Wextra -pedantic-errors -Werror -MMD -MP -g \
	-Wconversion -Wsign-conversion -Wshadow -Wcast-qual -Wformat=2 \
	-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes \
	-Wredundant-decls -Wundef -Wdouble-promotion -Wfloat-equal \
	-Winit-self -Wnull-dereference -Wswitch-enum -Wbad-function-cast \
	-ffreestanding -fno-builtin -nostdinc -fshort-wchar -fno-stack-protector \
	-Iinclude

.PHONY: all
all: $(EFI)

.PHONY: clean
clean:
	rm -rf build/

.PHONY: compile_flags.txt
compile_flags.txt:
	@echo $(CFLAGS) | tr ' ' '\n' | tee $@

include arch/$(ARCH)/Makefile
include boot/uefi/Makefile

$(BUILD)/%.o: %
	@mkdir -p $(dir $@)
	$(CC) $(CFLAGS) -o $@ -c $<

# asm isn't C, no language/standard/warning flags, just the target
$(BUILD)/%.S.o: %.S
	@mkdir -p $(dir $@)
	$(CC) -target x86_64-unknown-windows -c -o $@ $<