-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.DEBUG
267 lines (239 loc) · 6.99 KB
/
Makefile.DEBUG
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#
# Copyright (C) Roger George Doss. All Rights Reserved.
#
#
#
# top-level makefile for OX
#
#
AS = /usr/bin/nasm
CC = /usr/bin/cc
LD = /usr/bin/ld
LDFLAGS = -s -x -M
IFLAGS = -I. -I.. -I../include -I../include/ox -I../include/sys -I../include/platform
#CFLAGS = $(IFLAGS) -Wall -nostdinc -O -fstrength-reduce -fomit-frame-pointer -fpic
CFLAGS = $(IFLAGS) -Wall -nostdinc -m32 -fpic
.s.o:
$(AS) -f elf -o $*.o $<
LOBJS = \
./kernel/kernel.o \
./drivers/drivers.o \
./fs/fs.o \
./mm/mm.o \
./libk/libk.o
OBJS = \
./libk/util.o \
./libk/strtoul.o \
./libk/vsprintk.o \
./libk/string.o \
./libk/bit.o \
./libk/errno.o \
./libk/printk.o \
./libk/ultostr.o \
./mm/page.o \
./mm/page_enable.o \
./mm/malloc.o \
./mm/dma.o \
./mm/kmalloc.o \
./fs/file.o \
./fs/link.o \
./fs/krealpath.o \
./fs/bitmap.o \
./fs/inode.o \
./fs/dev.o \
./fs/paths.o \
./fs/block.o \
./fs/dir.o \
./fs/init.o \
./platform/i386/drivers/src/chara/rs_io.o \
./platform/i386/drivers/src/chara/keyboard.o \
./platform/i386/drivers/src/chara/tty_io.o \
./platform/i386/drivers/src/chara/serial.o \
./platform/i386/drivers/src/chara/console.o \
./platform/i386/drivers/src/chara/pit.o \
./platform/i386/drivers/src/chara/delay.o \
./platform/i386/drivers/src/block/pio/pioread.o \
./platform/i386/drivers/src/block/pio/piowrite.o \
./platform/i386/drivers/src/block/pio/pioutil.o \
./platform/i386/arch/interrupt.o \
./platform/i386/arch/exception.o \
./platform/i386/arch/segment.o \
./platform/i386/arch/protected_mode.o \
./platform/i386/arch/main.o \
./platform/i386/arch/asm_core/interrupt.o \
./platform/i386/arch/asm_core/syscall.o \
./platform/i386/arch/asm_core/exception.o \
./platform/i386/arch/asm_core/util.o \
./platform/i386/arch/asm_core/scheduler.o \
./platform/i386/arch/asm_core/io.o \
./platform/i386/arch/asm_core/atom.o \
./platform/i386/arch/asm_core/start.o \
./platform/i386/arch/io_req.o \
./kernel/signal.o \
./kernel/ox_main.o \
./kernel/exit.o \
./kernel/fork.o \
./kernel/exec.o \
./kernel/syscall_tab.o \
./kernel/scheduler.o \
./kernel/def_int.o \
./kernel/mktime.o \
./kernel/ptrace.o \
./kernel/misc.o \
./kernel/panic.o \
./kernel/process_queue.o \
./kernel/syscall/syscall_0.o \
./kernel/syscall/syscall_1.o \
./kernel/syscall/syscall_2.o \
./kernel/syscall/syscall_3.o \
./kernel/syscall/syscall_4.o \
./kernel/syscall/syscall_5.o
TOBJS = \
./libk/util.o \
./libk/strtoul.o \
./libk/vsprintk.o \
./libk/string.o \
./libk/bit.o \
./libk/errno.o \
./libk/printk.o \
./libk/ultostr.o \
./platform/i386/drivers/src/chara/rs_io.o \
./platform/i386/drivers/src/chara/keyboard.o \
./platform/i386/drivers/src/chara/tty_io.o \
./platform/i386/drivers/src/chara/serial.o \
./platform/i386/drivers/src/chara/console.o \
./platform/i386/drivers/src/chara/pit.o \
./platform/i386/drivers/src/chara/delay.o \
./platform/i386/drivers/src/block/pio/pioread.o \
./platform/i386/drivers/src/block/pio/piowrite.o \
./platform/i386/drivers/src/block/pio/pioutil.o \
./platform/i386/arch/interrupt.o \
./platform/i386/arch/exception.o \
./platform/i386/arch/segment.o \
./platform/i386/arch/protected_mode.o \
./platform/i386/arch/main.o \
./platform/i386/arch/asm_core/interrupt.o \
./platform/i386/arch/asm_core/syscall.o \
./platform/i386/arch/asm_core/exception.o \
./platform/i386/arch/asm_core/util.o \
./platform/i386/arch/asm_core/scheduler.o \
./platform/i386/arch/asm_core/io.o \
./platform/i386/arch/asm_core/atom.o \
./platform/i386/arch/asm_core/start.o \
./platform/i386/arch/io_req.o \
./kernel/fork.o \
./kernel/exec.o \
./kernel/syscall_tab.o \
./kernel/scheduler.o \
./kernel/def_int.o \
./kernel/mktime.o \
./kernel/ptrace.o \
./kernel/misc.o \
./kernel/panic.o \
./kernel/process_queue.o
#./kernel/syscall/syscall_0.o \
./kernel/syscall/syscall_1.o \
./kernel/syscall/syscall_2.o \
./kernel/syscall/syscall_3.o \
./kernel/syscall/syscall_4.o \
./kernel/syscall/syscall_5.o
ARCHIVES= \
./kernel/kernel.a \
./drivers/drivers.a \
./fs/fs.a \
./mm/mm.a \
./libk/libk.a
all: $(LOBJS)
#$(CC) -m32 -nostdinc -nostdlib -nostartfiles -nodefaultlibs -static $(TOBJS) -o vmox -Ttext 0x100000 --unresolved-symbols=ignore-all
#$(LD) -melf_i386 -Ttext 0x100000 -Tdata 0x200000 $(OBJS) -o vmox
#$(LD) -melf_i386 -Ttext 0x14000 $(OBJS) -o vmox --unresolved-symbols=ignore-all
#$(LD) -melf_i386 -T ./ld/linker.ld $(TOBJS) -o vmox --unresolved-symbols=ignore-all
$(CC) -m32 -nostdinc -nostdlib -nostartfiles -nodefaultlibs -static $(OBJS) -o vmox -Ttext 0x100000 # --unresolved-symbols=ignore-all
#strip vmox
#$(LD) -melf_i386 -T nlinker.ld $(TOBJS) -o vmox --unresolved-symbols=ignore-all
#strip vmox
#$(LD) -melf_i386 -T linker.ld $(OBJS) -o vmox
#$(CC) -m32 -nostdinc -nostdlib -nostartfiles -nodefaultlibs -static ./kernel/platform/main.o $(ARCHIVES) ./kernel/lowcore.a ./kernel/platform/asm.a ./drivers/chara/console.o ./kernel/platform/asm_core/io.o -o vmox -Ttext 0x100000
#$(CC) -m32 -nostdinc -nostdlib -nostartfiles -nodefaultlibs -static $(OBJS) -o vmox -Ttext 0x100000
#$(CC) -m32 -fPIE -pie -nostdinc -nostdlib -nostartfiles -nodefaultlibs -static vmox.o -o vmox -Ttext 0x100000
#$(LD) -melf_i386 $(OBJS) -o vmox -Ttext 0x100000 # 0xe9300
#$(CC) -m32 -nostdinc -nostdlib vmox.o -o vmox -Ttext 0x100000
cd libc; make
cd boot; make
cd init; make
./boot/mkboot vmox.boot vmox.img
bin_kernel: $(LOBJS)
$(LD) -melf_i386 -T ./ld/flat_linker.ld $(OBJS) -o vmox # --unresolved-symbols=ignore-all
objcopy ./vmox ./vmox.bin --target=binary --input-target=elf32-i386
cp ./vmox ./vmox.exe
cp ./vmox.bin ./vmox
cd libc; make
cd boot; make
cd init; make
./boot/mkboot vmox.boot vmox.img
kernel: $(OBJS)
$(LD) -o vmox $(OBJS) -Ttext 0x100000
install_old: all
@if [ -e "./vmox.boot" ]; then \
dd if=./vmox.boot of=/dev/fd0 bs=512; \
exit; \
fi; \
echo "error during installation"
install: all
@if [ -e "./vmox.boot" ]; then \
dd if=./vmox.boot of=/dev/sdb bs=512; \
exit; \
fi; \
echo "error during installation"
libc:
cd libc; make
boot:
cd boot; make
init:
cd init; make
# build for kernel objects
./kernel/kernel.o:
cd kernel; make
./drivers/drivers.o:
cd drivers; make
./fs/fs.o:
cd fs; make
./mm/mm.o:
cd mm; make
./libk/libk.o:
cd libk; make
# clean all
clean_all:
cd kernel; make clean
cd drivers; make clean
cd fs; make clean
cd mm; make clean
cd libk; make clean
cd libc; make clean
cd boot; make clean
cd init; make clean
rm -f vmox
rm -f vmox.boot
kernel_clean:
cd kernel; make clean
cd drivers; make clean
cd fs; make clean
cd mm; make clean
cd libk; make clean
rm -f vmox
rm -f vmox.boot
libc_clean:
cd libc; make clean
boot_clean:
cd boot; make clean
init_clean:
cd init; make clean
clean:
@echo "targets are: clean_all kernel_clean libc_clean boot_clean init_clean"
bin:
objcopy ./vmox ./vmox.bin --target=binary \
--input-target=elf32-i386
mv ./vmox.bin ./vmox
#
# EOF
#