mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
26cd12e7c6
Adds missing symbol table generation steps that were not commited alongside previous work. Also bumps astral.
61 lines
2.2 KiB
Makefile
61 lines
2.2 KiB
Makefile
CSOURCES= $(shell find -name "*.c" -not -path "*/uacpi/tests/*")
|
|
ASMSOURCES= $(shell find -name "*.asm")
|
|
OBJS=$(CSOURCES:.c=.o) $(ASMSOURCES:.asm=.asmo)
|
|
INCDIR=$(shell pwd)/include
|
|
ARCHINCDIR=$(shell pwd)/include/$(TARGET)/
|
|
ARCHDIR=$(shell pwd)/arch/$(TARGET)/
|
|
LDFLAGS=-ffreestanding -nostdlib -lgcc -Wl,-T,"$(ARCHDIR)/kernel.ld" -g
|
|
FLANTERMOPTS=-DFLANTERM_FB_DISABLE_BUMP_ALLOC
|
|
# required for mpaland printf so it doesn't compile with floating point support, which results in build failures
|
|
PRINTFOPTS=-DPRINTF_DISABLE_SUPPORT_FLOAT
|
|
# flanterm includes break if the headers are moved into the include dir in the tree
|
|
FLANTERMINCDIR=$(shell pwd)/flanterm/src
|
|
UACPIINCDIR=$(shell pwd)/io/acpi/uacpi/include
|
|
U80211INCDIR=$(shell pwd)/io/net/u80211/include
|
|
U80211DRVINCDIR=$(shell pwd)/io/net/u80211_drv/include
|
|
UACPIOPTS=-DUACPI_OVERRIDE_LIBC -DUACPI_KERNEL_INITIALIZATION -DUACPI_NATIVE_ALLOC_ZEROED
|
|
KCOV_ENABLED=n
|
|
KERNELCONFIG=-DX86_64_ENABLE_E9 #-DSYSCALL_LOGGING #-DENABLE_PROFILING
|
|
CFLAGS=-g -ffreestanding -mcmodel=kernel -O2 -mno-red-zone -mgeneral-regs-only -mno-mmx -mno-sse -mno-sse2 -nostdlib -Wall -MMD -I "$(INCDIR)" -I "$(ARCHINCDIR)" -I "$(FLANTERMINCDIR)" -I "$(UACPIINCDIR)" -I "$(U80211INCDIR)" -I"$(U80211DRVINCDIR)" $(UACPIOPTS) $(PRINTFOPTS) $(KERNELCONFIG) $(FLANTERMOPTS) -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -std=gnu17 -Wno-error=implicit-function-declaration
|
|
ifeq ($(KCOV_ENABLED),y)
|
|
CFLAGS += -DKCOV_ENABLED -fsanitize-coverage=trace-pc,trace-cmp
|
|
endif
|
|
ASFLAGS=-felf64
|
|
DEPS=$(CSOURCES:.c=.d)
|
|
|
|
ifeq ($(TARGET),x86-64)
|
|
KERNEL_BASE=0xffffffff80000000
|
|
endif
|
|
|
|
.PHONY: all
|
|
all:
|
|
# build build.h file
|
|
echo "#ifndef _BUILD_H" > include/build.h
|
|
echo "#define _BUILD_H" >> include/build.h
|
|
echo " #define BUILD_DATE \"$(shell date -u)\"" >> include/build.h
|
|
echo " #define BUILD_TARGET \"$(JINX_ARCH)\"" >> include/build.h
|
|
echo "#endif" >> include/build.h
|
|
make astral
|
|
|
|
astral.tmp: $(OBJS)
|
|
@echo [LD] $@
|
|
@$(LD) $(LDFLAGS) -o $@ $^
|
|
|
|
astral.sym.o: astral.tmp
|
|
@echo [GEN] $@
|
|
@python3 gen_fn_sym.py $< $(KERNEL_BASE) $(shell pwd)/ $@
|
|
|
|
astral: $(OBJS) astral.sym.o
|
|
@echo [LD] $@
|
|
@$(LD) $(LDFLAGS) -o $@ $^
|
|
|
|
%.o: %.c Makefile
|
|
@echo [CC] $@
|
|
@$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
%.asmo: %.asm Makefile
|
|
@echo [AS] $@
|
|
@nasm $(ASFLAGS) -o $@ $<
|
|
|
|
-include $(DEPS)
|