-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
155 lines (129 loc) · 3.92 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Copyright (C) 2019-2022 Philippe Aubertin.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author nor the names of other contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
include header.mk
subdirs = \
doc \
kernel \
$(userspace)/loader \
$(userspace)/testapp \
$(libc) \
$(libjinue) \
$(zlib) \
$(bzip2) \
$(qemu) \
$(virtualbox) \
tests
# make all (default target) will build the kernel image
targets.phony = kernel
# main targets
include $(common)
# Run functional tests
.PHONY: check
check:
make -C tests check
# install kernel image in /boot
.PHONY: install
install: $(kernel_img)
install -m644 $< /boot
# install testapp ramdisk in /boot
.PHONY: install-testapp
install-testapp: $(testapp_initrd)
install -m644 $< /boot
# build the ISO file (CDROM image) needed by the VirtualBox VM
.PHONY: vbox
vbox:
make -C $(virtualbox)
# build the ISO file for VirtualBox and run the VM with the debugger
.PHONY: vbox-debug
vbox-debug:
make -C $(virtualbox) debug
# build the ISO file for VirtualBox and run the VM (without the debugger)
.PHONY: vbox-run
vbox-run:
make -C $(virtualbox) run
# build the dependencies for running the test application in QEMU
.PHONY: qemu
qemu:
make -C $(qemu)
# Run test application in QEMU
.PHONY: qemu-run
qemu-run:
make -C $(qemu) run
# Run test application in QEMU without VGA display
.PHONY: qemu-run-no-display
qemu-run-no-display:
make -C $(qemu) run-no-display
# Run test application in QEMU and debug in gdb
.PHONY: qemu-debug
qemu-debug:
make -C $(qemu) debug
# Run test application in QEMU without VGA display and debug in gdb
.PHONY: qemu-debug-no-display
qemu-debug-no-display:
make -C $(qemu) debug-no-display
# Connect to the running gdb debugging session
.PHONY: gdb
gdb:
gdb -x $(gdb)/gdbinit
# Run cppcheck on the kernel sources
# Note: there are known failures
.PHONY: cppcheck-kernel
cppcheck-kernel:
cppcheck --enable=all --std=c99 --platform=unix32 $(CPPFLAGS.includes) $(kernel)
# build the Doxygen documentation
# (not really maintained)
.PHONY: doc
doc:
$(MAKE) -C doc
# clean the Doxygen docuumentation
.PHONY: clean-doc
clean-doc:
$(MAKE) -C doc clean
# build the kernel image (set up code + kernel ELF + user space loader ELF)
$(kernel_img): kernel
.PHONY: kernel
kernel:
$(MAKE) -C kernel
# build the user space API library
.PHONY: libjinue
libjinue:
$(MAKE) -C $(libjinue)
# build the standard C library
.PHONY: libc
libc:
$(MAKE) -C $(libc)
# build the user space loader
.PHONY: loader
loader:
$(MAKE) -C $(userspace)/loader
# build the test application
$(testapp_initrd): testapp
.PHONY: testapp
testapp:
$(MAKE) -C $(userspace)/testapp