-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
63 lines (42 loc) · 1.45 KB
/
Makefile
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
elf = elf64
K_PAGE_OFFSET = 0xffff800000000000
DEBUG = -DDEBUG
SOURCES = \
boot/boot32.o kernel/main.o \
drivers/block.o drivers/char.o drivers/disk.o drivers/keyboard.o drivers/lapictim.o \
drivers/pit.o drivers/rtc.o drivers/vga.o \
fs/fs.o fs/buffer.o fs/inode.o fs/namei.o fs/file.o fs/filedesc.o \
fs/ext2/dentry.o fs/ext2/file.o fs/ext2/inode.o fs/ext2/super.o \
kernel/acpi.o kernel/timers.o kernel/traps.o kernel/intr.o kernel/task.o \
kernel/elf.o kernel/exec.o \
mm/mm.o mm/kcache.o mm/kma.o mm/kmalloc.o mm/phys.o \
include/stdio.o include/stdlib.o include/string.o include/time.o \
lib/kernel.o lib/tree.o lib/mem.o \
vm/cpu.o vm/mmap.o vm/pg.o vm/syscall.o vm/vma.o \
$()
CFLAGS = \
-ffreestanding -nostdlib -nostdinc -nostartfiles -nodefaultlibs \
-fno-pie -fno-stack-protector -mno-red-zone -mno-abm -msoft-float \
-Wall -std=gnu99 -I include -I . -iquote . -pipe -m64 -mcmodel=large \
-ggdb -O2 $(DEBUG) \
-DK_PAGE_OFFSET=$(K_PAGE_OFFSET)
LDFLAGS = -N -dT linker.ld --defsym page_offset=$(K_PAGE_OFFSET) # -M
ASFLAGS = $(CFLAGS)
ifeq ($(elf),elf32)
LDFLAGS += --oformat=elf32-i386
else ifeq ($(elf),elf64)
LDFLAGS += --oformat=elf64-x86-64
endif
all: $(SOURCES)
ld $(LDFLAGS) -o jOS $(SOURCES)
scripts/run.sh
qemu: all
bochs: $(SOURCES)
ld $(LDFLAGS) -o jOS $(SOURCES)
scripts/run.sh bochs
clean:
rm -f *.o jOS */*.o */*/*.o
cd ./scripts && make clean
cd ./test && make clean
tags:
ctags -R --fields=+iaS --extra=+q