summaryrefslogtreecommitdiff
path: root/Source/Kernel/Makefile
blob: 79dfbb32219a8cc3851adca078d6ff00f738a497 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
.PHONY: clean, mrproper

CC = gcc
CXX = g++
LD = ld
LDFLAGS = -T Link.ld -Map Map.txt --oformat=elf32-i386
CFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra -Werror -I .
CXXFLAGS = -nostartfiles -nostdlib -fno-exceptions -fno-rtti -I . -Wall -Werror -Wno-write-strings -funsigned-char
ASM = nasm
ASMFLAGS = -f elf

OutFile = Melon.ke
Objects = Core/loader.wtf.o \
		  Core/kmain.wtf.o \
		  Core/cppsupport.wtf.o \
		  Core/Sys.ns.o \
		  Core/CMem.ns.o \
		  MemoryManager/Mem.ns.o \
		  MemoryManager/PhysMem.ns.o \
		  MemoryManager/GDT.wtf.o \
		  MemoryManager/GDT.ns.o \
		  MemoryManager/PageDirectory.class.o \
		  MemoryManager/PageAlloc.ns.o \
		  DeviceManager/Disp.ns.o \
		  DeviceManager/Dev.ns.o \
		  DeviceManager/Time.ns.o \
		  DeviceManager/Kbd.ns.o \
		  TaskManager/Process.class.o \
		  TaskManager/Thread.class.o \
		  TaskManager/Task.ns.o \
		  TaskManager/Task.wtf.o \
		  TaskManager/Mutex.class.o \
		  VTManager/VirtualTerminal.class.o \
		  VTManager/VirtualTerminal-kbd.class.o \
		  VTManager/VT.ns.o \
		  Library/Bitset.class.o \
		  Library/String.class.o \
		  Library/WChar.class.o \
		  VFS/Partition.class.o \
		  VFS/Part.ns.o \
		  VFS/VFS.ns.o \
		  VFS/DirectoryNode.class.o \
		  FileSystems/RamFS/RamFS.class.o \
		  SyscallManager/IDT.ns.o \
		  SyscallManager/IDT.wtf.o \
		  Devices/Display/VGATextOutput.class.o \
		  Devices/Keyboard/PS2Keyboard.class.o \
		  Devices/Floppy/FloppyController.class.o \
		  Devices/Floppy/FloppyDrive.class.o \
		  Devices/Timer.class.o

all: $(OutFile)
	echo "* Done with $(OutFile)."

rebuild: mrproper all

$(OutFile): $(Objects)
	echo "* Linking executable : $(OutFile)..."
	$(LD) $(LDFLAGS) -o $(OutFile) $^

%.o: %.c
	echo "* Compiling $<..."
	$(CC) -c $< -o $@ $(CFLAGS)

%.o: %.cpp
	echo "* Compiling $<..."
	$(CXX) -c $< -o $@ $(CXXFLAGS)

%.o: %.asm
	echo "* Compiling $<..."
	$(ASM) $(ASMFLAGS) -o $@ $<

clean:
	echo "* Removing object files..."
	rm -rf *.o
	rm -rf */*.o
	rm -rf */*/*.o

mrproper: clean
	echo "* Removing executable : $(OutFile)"
	rm -rf $(OutFile)