2018-10-16 15:17:43 +03:00
|
|
|
KERNEL_OBJS = \
|
2018-10-16 12:01:38 +03:00
|
|
|
_start.o \
|
|
|
|
init.o \
|
|
|
|
kmalloc.o \
|
|
|
|
StdLib.o \
|
|
|
|
i386.o \
|
2018-11-01 15:15:46 +03:00
|
|
|
Process.o \
|
2018-10-16 12:01:38 +03:00
|
|
|
i8253.o \
|
|
|
|
Keyboard.o \
|
|
|
|
CMOS.o \
|
|
|
|
PIC.o \
|
|
|
|
Syscall.o \
|
2018-10-18 00:13:55 +03:00
|
|
|
IDEDiskDevice.o \
|
2018-10-21 22:59:43 +03:00
|
|
|
MemoryManager.o \
|
2018-10-22 13:58:29 +03:00
|
|
|
Console.o \
|
2018-10-22 14:20:35 +03:00
|
|
|
IRQHandler.o \
|
2018-10-23 12:57:38 +03:00
|
|
|
kprintf.o \
|
2018-10-25 18:29:49 +03:00
|
|
|
ProcFileSystem.o \
|
2018-10-30 15:59:29 +03:00
|
|
|
RTC.o \
|
|
|
|
TTY.o \
|
2018-11-08 00:15:02 +03:00
|
|
|
VirtualConsole.o \
|
|
|
|
Scheduler.o
|
2018-10-16 15:17:43 +03:00
|
|
|
|
|
|
|
VFS_OBJS = \
|
2018-10-16 15:33:16 +03:00
|
|
|
../VirtualFileSystem/DiskDevice.o \
|
|
|
|
../VirtualFileSystem/CharacterDevice.o \
|
|
|
|
../VirtualFileSystem/NullDevice.o \
|
|
|
|
../VirtualFileSystem/FullDevice.o \
|
|
|
|
../VirtualFileSystem/ZeroDevice.o \
|
2018-10-17 11:55:43 +03:00
|
|
|
../VirtualFileSystem/RandomDevice.o \
|
|
|
|
../VirtualFileSystem/FileSystem.o \
|
|
|
|
../VirtualFileSystem/DiskBackedFileSystem.o \
|
2018-10-17 12:40:58 +03:00
|
|
|
../VirtualFileSystem/Ext2FileSystem.o \
|
2018-10-17 12:47:14 +03:00
|
|
|
../VirtualFileSystem/InodeIdentifier.o \
|
2018-10-17 13:07:39 +03:00
|
|
|
../VirtualFileSystem/VirtualFileSystem.o \
|
2018-11-07 13:37:54 +03:00
|
|
|
../VirtualFileSystem/FileDescriptor.o \
|
2018-10-23 12:57:38 +03:00
|
|
|
../VirtualFileSystem/SyntheticFileSystem.o
|
2018-10-16 15:17:43 +03:00
|
|
|
|
2018-10-18 16:03:10 +03:00
|
|
|
ELFLOADER_OBJS = \
|
|
|
|
../ELFLoader/ELFImage.o \
|
2018-11-04 15:52:53 +03:00
|
|
|
../ELFLoader/ELFLoader.o
|
2018-10-18 16:03:10 +03:00
|
|
|
|
2018-10-17 11:55:43 +03:00
|
|
|
AK_OBJS = \
|
|
|
|
../AK/String.o \
|
2018-10-28 14:20:25 +03:00
|
|
|
../AK/StringImpl.o \
|
|
|
|
../AK/StringBuilder.o
|
2018-10-17 11:55:43 +03:00
|
|
|
|
2018-10-18 16:03:10 +03:00
|
|
|
OBJS = $(KERNEL_OBJS) $(VFS_OBJS) $(AK_OBJS) $(ELFLOADER_OBJS)
|
2018-10-16 15:17:43 +03:00
|
|
|
|
2018-10-16 12:01:38 +03:00
|
|
|
NASM = nasm
|
|
|
|
KERNEL = kernel
|
|
|
|
BOOTLOADER = Boot/boot.bin
|
|
|
|
IMAGE = .floppy-image
|
|
|
|
ARCH_FLAGS =
|
2018-10-30 15:59:29 +03:00
|
|
|
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib #-nostdinc
|
2018-11-09 14:20:44 +03:00
|
|
|
KERNEL_FLAGS = -ffreestanding -fno-stack-protector -fno-ident -fno-builtin
|
2018-10-16 12:01:38 +03:00
|
|
|
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings
|
2018-10-27 15:56:52 +03:00
|
|
|
FLAVOR_FLAGS = -mregparm=3 -march=i386 -m32 -fno-exceptions -fno-rtti -fmerge-all-constants -fno-unroll-loops -fno-pie -fno-pic
|
2018-11-09 14:20:44 +03:00
|
|
|
OPTIMIZATION_FLAGS = -Oz -fno-asynchronous-unwind-tables
|
2018-10-16 15:17:43 +03:00
|
|
|
INCLUDE_FLAGS = -I.. -I.
|
2018-11-09 14:20:44 +03:00
|
|
|
#SUGGEST_FLAGS = -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override #-Wsuggest-attribute=noreturn
|
2018-10-16 15:17:43 +03:00
|
|
|
|
2018-10-28 11:36:21 +03:00
|
|
|
DEFINES = -DSERENITY -DKERNEL -DSANITIZE_PTRS
|
2018-10-16 15:17:43 +03:00
|
|
|
|
2018-11-07 12:23:16 +03:00
|
|
|
CXXFLAGS = $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(KERNEL_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(SUGGEST_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
|
2018-10-16 12:01:38 +03:00
|
|
|
#CXX = /usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-g++
|
|
|
|
#LD = /usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-ld
|
2018-11-09 14:20:44 +03:00
|
|
|
CXX = clang
|
2018-10-16 12:01:38 +03:00
|
|
|
LD = ld
|
|
|
|
LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections --build-id=none -z norelro -z now
|
|
|
|
|
2018-10-26 23:32:35 +03:00
|
|
|
all: $(KERNEL) $(IMAGE) kernel.map
|
|
|
|
|
|
|
|
kernel.map: kernel
|
|
|
|
@echo "MKMAP $@"; sh mkmap.sh
|
2018-10-16 12:01:38 +03:00
|
|
|
|
|
|
|
$(KERNEL): $(OBJS)
|
|
|
|
@echo "LD $@"; $(LD) $(LDFLAGS) -o $@ -Ttext 0x10000 $(OBJS)
|
|
|
|
|
|
|
|
$(IMAGE): $(KERNEL) $(BOOTLOADER)
|
2018-11-08 04:03:19 +03:00
|
|
|
@echo "CREATE $@"; cat $(BOOTLOADER) $(KERNEL) > .tmp-floppy-image
|
|
|
|
@dd if=/dev/zero bs=2M count=1 >> .tmp-floppy-image 2> /dev/null
|
|
|
|
@dd if=.tmp-floppy-image of=.floppy-image bs=1440k count=1 2>/dev/null
|
|
|
|
@rm -f .tmp-floppy-image
|
2018-10-16 12:01:38 +03:00
|
|
|
|
|
|
|
$(BOOTLOADER): Boot/boot.asm
|
|
|
|
@echo "NASM $<"; $(NASM) -f bin -o $@ $<
|
|
|
|
|
|
|
|
.cpp.o:
|
|
|
|
@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo "CLEAN"; rm -f $(KERNEL) $(OBJS) $(BOOTLOADER) $(IMAGE)
|
|
|
|
|