forked from Spiderine/hohlabs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
113 lines (80 loc) · 2.87 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
M=./make
include $M/header.mk
I =.#
O =$I/_tmp#
TYPE =exe#
NAME =hoh#
ARCH =linux#
B =release#
SOURCES = \
$I/x86/boot.S \
$I/x86/main.cc \
$I/x86/except.cc \
$I/util/debug.cc \
$I/util/lib.cc \
$I/apps/labs.cc \
$I/labs/shell.cc \
$I/labs/coroutine.cc \
$I/labs/fiber.cc \
$I/labs/fiber_scheduler.cc \
ISO_SOURCES = \
$O/iso/boot/$(NAME).exe \
$O/iso/boot/grub/grub.cfg \
CPPFLAGS = -I$I -I$I/apps
TARGET_MACH = -m32
TARGET_ARCH = -m32
#options for B=debug
CXXFLAGS.debug=-g
ASFLAGS.debug=-g
#options for B=release
CXXFLAGS.release=-O3
WARNINGS = -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align \
-Wwrite-strings -Wmissing-declarations \
-Wredundant-decls -Winline -Wno-long-long \
-Wuninitialized -Wconversion
WARNINGS=
#-Wmissing-prototypes -Wnested-externs -Wstrict-prototypes
NO_SIMD=-mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-sse4 -mno-avx -mno-3dnow
CXXFLAGS = -std=c++0x \
$(WARNINGS) \
-ffreestanding -fno-rtti -fno-exceptions \
-fstrength-reduce -fomit-frame-pointer -finline-functions \
-mno-red-zone \
-z max-page-size=0x1000 \
#options specific for except.cc
CXXFLAGS.x86/except.cc = $(NO_SIMD)
CXXFLAGS.util/lib.cc = $(NO_SIMD) -fno-tree-loop-distribute-patterns
# simd
CXXFLAGS.x86/main.cc = -msse -msse2 -mfpmath=sse
CXXFLAGS.apps/labs.cc = -msse -msse2 -mfpmath=sse
CXXFLAGS.labs/shell.cc = -msse -msse2 -mfpmath=sse
CXXFLAGS.labs/coroutine.cc = -msse -msse2 -mfpmath=sse
CXXFLAGS.labs/fiber.cc = -msse -msse2 -mfpmath=sse
CXXFLAGS.labs/fiber_scheduler.cc = -msse -msse2 -mfpmath=sse
LINK.script = $I/make/util/linker.t
LDFLAGS = -static -T $(LINK.script) \
-nostdlib -nodefaultlibs -nostartfiles \
-z max-page-size=0x1000 \
QEMU=qemu-system-i386
#QEMU = ~/X/qemu.git/i386-softmmu/qemu-system-i386
QEMUFLAGS = -cpu Haswell -smp 2 -m 1024
QEMULOG= -D qemu.log -d in_asm,int
all:: exe
qemu:: iso
$(QEMU) $(QEMUFLAGS) $(QEMULOG) -serial stdio -serial null -cdrom $O/$(NAME).iso
qemu-gdb:: iso
$(QEMU) $(QEMUFLAGS) -S -s -serial stdio -serial null -cdrom $O/$(NAME).iso
qemu-direct:: exe
$(QEMU) $(QEMUFLAGS) $(QEMULOG) -serial stdio -serial null -kernel $O/$(NAME).exe -append "/help"
qemu-gdb-direct:: exe
$(QEMU) $(QEMUFLAGS) -S -s -serial stdio -serial null -kernel $O/$(NAME).exe -append "/help"
iso:: $O/$(NAME).iso
$O/$(NAME).iso: $(ISO_SOURCES)
grub-mkrescue -o $@ $O/iso
$O/iso/boot/$(NAME).exe: exe
mkdir -p $O/iso/boot
cp $O/$(NAME).exe $@
$O/iso/boot/grub/grub.cfg: $I/make/util/grub.cfg
mkdir -p $O/iso/boot/grub
cp $< $@
include $M/footer.mk