furix
cute os
Makefile
1033 bytes raw
1ARCH ?= x86_64
2
3CC := clang
4
5KERNEL_SRC := \
6 kernel/acpi.c \
7 kernel/kernel.c
8
9BUILD := build/obj
10BUILD_BOOT := build/boot/$(ARCH)
11EFI := $(BUILD_BOOT)/furix.efi
12
13CFLAGS := \
14 -std=c11 -Wall -Wextra -pedantic-errors -Werror -MMD -MP -g \
15 -Wconversion -Wsign-conversion -Wshadow -Wcast-qual -Wformat=2 \
16 -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes \
17 -Wredundant-decls -Wundef -Wdouble-promotion -Wfloat-equal \
18 -Winit-self -Wnull-dereference -Wswitch-enum -Wbad-function-cast \
19 -ffreestanding -fno-builtin -nostdinc -fshort-wchar -fno-stack-protector \
20 -Iinclude
21
22.PHONY: all
23all: $(EFI)
24
25.PHONY: clean
26clean:
27 rm -rf build/
28
29.PHONY: compile_flags.txt
30compile_flags.txt:
31 @echo $(CFLAGS) | tr ' ' '\n' | tee $@
32
33include arch/$(ARCH)/Makefile
34include boot/uefi/Makefile
35
36$(BUILD)/%.o: %
37 @mkdir -p $(dir $@)
38 $(CC) $(CFLAGS) -o $@ -c $<
39
40# asm isn't C, no language/standard/warning flags, just the target
41$(BUILD)/%.S.o: %.S
42 @mkdir -p $(dir $@)
43 $(CC) -target x86_64-unknown-windows -c -o $@ $<