1
1
# 13519214 - Makefile
2
- all : diskimage bootloader kernel createfilesystem insertfilesystem
2
+ all : basekernel shellpackage extrapackage createrecursiontest logoinsert
3
+
4
+ basekernel : diskimage bootloader kernel createfilesystem insertfilesystem
3
5
4
6
clean :
5
7
# -- Cleaning output files --
6
- @rm out/fs/* ;
8
+ @rm out/fs/*
7
9
@rm out/*
10
+ @rm out/asm/*
11
+ @rm out/shell/*
8
12
9
13
test : kernelgcc
10
14
11
15
cleantest : cleangcc
12
16
17
+ shellpackage : basekernel fileloader mash insertls insertcd insertmkdir \
18
+ insertcat insertcp insertmv insertln insertrm
19
+
20
+
21
+ extrapackage : shellpackage insertfile insertwc insertstrings insertmim \
22
+ insertwhereis insertsnok insertprintf
23
+
24
+ mash :
25
+ if [ ! -d " out/shell" ]; then mkdir out/shell; fi
26
+ @bcc -ansi -c -o out/shell/mash.o src/mash.c
27
+ @bcc -ansi -c -o out/shell/std_stringio.o src/std_stringio.c
28
+ @bcc -ansi -c -o out/shell/std_fileio.o src/std_fileio.c
29
+ @bcc -ansi -c -o out/shell/shell_common.o src/shell_common.c
30
+ @bcc -ansi -c -o out/shell/std_opr.o src/std_opr.c
31
+ if [ ! -d " out/shell/asm" ]; then mkdir out/shell/asm; fi
32
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
33
+ @ld86 -o out/mash -d out/shell/* .o out/shell/asm/interrupt.o
34
+ @cd out; ./loadFile mangga.img mash 0
35
+
36
+ insertls :
37
+ if [ ! -d " out/shell/ls" ]; then mkdir out/shell/ls; fi
38
+ @bcc -ansi -c -o out/shell/ls/ls.o src/ls.c
39
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
40
+ @ld86 -o out/ls -d out/shell/ls/* .o out/shell/std_fileio.o \
41
+ out/shell/std_stringio.o out/shell/shell_common.o \
42
+ out/shell/std_opr.o out/shell/asm/interrupt.o
43
+ @cd out; ./loadFile mangga.img ls 0
44
+
45
+ insertcd :
46
+ if [ ! -d " out/shell/cd" ]; then mkdir out/shell/cd; fi
47
+ @bcc -ansi -c -o out/shell/cd/cd.o src/cd.c
48
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
49
+ @ld86 -o out/cd -d out/shell/cd/* .o out/shell/std_fileio.o \
50
+ out/shell/std_stringio.o out/shell/shell_common.o \
51
+ out/shell/std_opr.o out/shell/asm/interrupt.o
52
+ @cd out; ./loadFile mangga.img cd 0
53
+
54
+ insertmkdir :
55
+ if [ ! -d " out/shell/mkdir" ]; then mkdir out/shell/mkdir; fi
56
+ @bcc -ansi -c -o out/shell/mkdir/mkdir.o src/mkdir.c
57
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
58
+ @ld86 -o out/mkdir -d out/shell/mkdir/* .o out/shell/std_fileio.o \
59
+ out/shell/std_stringio.o out/shell/shell_common.o \
60
+ out/shell/std_opr.o out/shell/asm/interrupt.o
61
+ @cd out; ./loadFile mangga.img mkdir 0
62
+
63
+ insertcat :
64
+ if [ ! -d " out/shell/cat" ]; then mkdir out/shell/cat; fi
65
+ @bcc -ansi -c -o out/shell/cat/cat.o src/cat.c
66
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
67
+ @ld86 -o out/cat -d out/shell/cat/* .o out/shell/std_fileio.o \
68
+ out/shell/std_stringio.o out/shell/shell_common.o \
69
+ out/shell/std_opr.o out/shell/asm/interrupt.o
70
+ @cd out; ./loadFile mangga.img cat 0
71
+
72
+ insertcp :
73
+ if [ ! -d " out/shell/cp" ]; then mkdir out/shell/cp; fi
74
+ @bcc -ansi -c -o out/shell/cp/cp.o src/cp.c
75
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
76
+ @ld86 -o out/cp -d out/shell/cp/* .o out/shell/std_fileio.o \
77
+ out/shell/std_stringio.o out/shell/shell_common.o \
78
+ out/shell/std_opr.o out/shell/asm/interrupt.o
79
+ @cd out; ./loadFile mangga.img cp 0
80
+
81
+ insertmv :
82
+ if [ ! -d " out/shell/mv" ]; then mkdir out/shell/mv; fi
83
+ @bcc -ansi -c -o out/shell/mv/mv.o src/mv.c
84
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
85
+ @ld86 -o out/mv -d out/shell/mv/* .o out/shell/std_fileio.o \
86
+ out/shell/std_stringio.o out/shell/shell_common.o \
87
+ out/shell/std_opr.o out/shell/asm/interrupt.o
88
+ @cd out; ./loadFile mangga.img mv 0
89
+
90
+ insertln :
91
+ if [ ! -d " out/shell/ln" ]; then mkdir out/shell/ln; fi
92
+ @bcc -ansi -c -o out/shell/ln/ln.o src/ln.c
93
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
94
+ @ld86 -o out/ln -d out/shell/ln/* .o out/shell/std_fileio.o \
95
+ out/shell/std_stringio.o out/shell/shell_common.o \
96
+ out/shell/std_opr.o out/shell/asm/interrupt.o
97
+ @cd out; ./loadFile mangga.img ln 0
98
+
99
+ insertrm :
100
+ if [ ! -d " out/shell/rm" ]; then mkdir out/shell/rm; fi
101
+ @bcc -ansi -c -o out/shell/rm/rm.o src/rm.c
102
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
103
+ @ld86 -o out/rm -d out/shell/rm/* .o out/shell/std_fileio.o \
104
+ out/shell/std_stringio.o out/shell/shell_common.o \
105
+ out/shell/std_opr.o out/shell/asm/interrupt.o
106
+ @cd out; ./loadFile mangga.img rm 0
107
+
108
+ insertfile :
109
+ if [ ! -d " out/shell/file" ]; then mkdir out/shell/file; fi
110
+ @bcc -ansi -c -o out/shell/file/file.o src/file.c
111
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
112
+ @ld86 -o out/file -d out/shell/file/* .o out/shell/std_fileio.o \
113
+ out/shell/std_stringio.o out/shell/shell_common.o \
114
+ out/shell/std_opr.o out/shell/asm/interrupt.o
115
+ @cd out; ./loadFile mangga.img file 0
116
+
117
+ insertwc :
118
+ if [ ! -d " out/shell/wc" ]; then mkdir out/shell/wc; fi
119
+ @bcc -ansi -c -o out/shell/wc/wc.o src/wc.c
120
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
121
+ @ld86 -o out/wc -d out/shell/wc/* .o out/shell/std_fileio.o \
122
+ out/shell/std_stringio.o out/shell/shell_common.o \
123
+ out/shell/std_opr.o out/shell/asm/interrupt.o
124
+ @cd out; ./loadFile mangga.img wc 0
125
+
126
+ insertstrings :
127
+ if [ ! -d " out/shell/strings" ]; then mkdir out/shell/strings; fi
128
+ @bcc -ansi -c -o out/shell/strings/strings.o src/strings.c
129
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
130
+ @ld86 -o out/strings -d out/shell/strings/* .o out/shell/std_fileio.o \
131
+ out/shell/std_stringio.o out/shell/shell_common.o \
132
+ out/shell/std_opr.o out/shell/asm/interrupt.o
133
+ @cd out; ./loadFile mangga.img strings 0
134
+
135
+ insertmim :
136
+ if [ ! -d " out/shell/mim" ]; then mkdir out/shell/mim; fi
137
+ @bcc -ansi -c -o out/shell/mim/mim.o src/mim.c
138
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
139
+ @ld86 -o out/mim -d out/shell/mim/* .o out/shell/std_fileio.o \
140
+ out/shell/std_stringio.o out/shell/shell_common.o \
141
+ out/shell/std_opr.o out/shell/asm/interrupt.o
142
+ @cd out; ./loadFile mangga.img mim 0
143
+
144
+ insertsnok :
145
+ if [ ! -d " out/shell/snok" ]; then mkdir out/shell/snok; fi
146
+ @bcc -ansi -c -o out/shell/snok/snok.o src/snok.c
147
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
148
+ @ld86 -o out/snok -d out/shell/snok/* .o out/shell/std_fileio.o \
149
+ out/shell/std_stringio.o out/shell/shell_common.o \
150
+ out/shell/std_opr.o out/shell/asm/interrupt.o
151
+ @cd out; ./loadFile mangga.img snok 0
152
+
153
+ insertwhereis :
154
+ if [ ! -d " out/shell/whereis" ]; then mkdir out/shell/whereis; fi
155
+ @bcc -ansi -c -o out/shell/whereis/whereis.o src/whereis.c
156
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
157
+ @ld86 -o out/whereis -d out/shell/whereis/* .o out/shell/std_fileio.o \
158
+ out/shell/std_stringio.o out/shell/shell_common.o \
159
+ out/shell/std_opr.o out/shell/asm/interrupt.o
160
+ @cd out; ./loadFile mangga.img whereis 0
161
+
162
+ insertprintf :
163
+ if [ ! -d " out/shell/printf" ]; then mkdir out/shell/printf; fi
164
+ @bcc -ansi -c -o out/shell/printf/printf.o src/printf.c
165
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
166
+ @ld86 -o out/printf -d out/shell/printf/* .o out/shell/std_fileio.o \
167
+ out/shell/std_stringio.o out/shell/shell_common.o \
168
+ out/shell/std_opr.o out/shell/asm/interrupt.o
169
+ @cd out; ./loadFile mangga.img printf 0
170
+
171
+ createrecursiontest :
172
+ if [ ! -d " out/shell/recursion_test" ]; then mkdir out/shell/recursion_test; fi
173
+ @bcc -ansi -c -o out/shell/recursion_test/recursion_test.o src/recursion_test.c
174
+ @nasm -f as86 src/asm/interrupt.asm -o out/shell/asm/interrupt.o
175
+ @ld86 -o out/recursion_test -d out/shell/recursion_test/* .o out/shell/std_fileio.o \
176
+ out/shell/std_stringio.o out/shell/shell_common.o \
177
+ out/shell/std_opr.o out/shell/asm/interrupt.o
178
+ @cd out; ./loadFile mangga.img recursion_test 0
13
179
180
+ logoinsert :
181
+ @cp other/logo.hoho out/logo.hoho
182
+ @cd out; ./loadFile mangga.img logo.hoho 255
14
183
15
184
# Main recipes
16
185
diskimage :
17
186
# -- Initial mangga.img --
187
+ if [ ! -d " out" ]; then mkdir out; fi
18
188
@dd if=/dev/zero of=out/mangga.img bs=512 count=2880 status=noxfer
19
189
20
190
bootloader :
@@ -25,21 +195,23 @@ bootloader:
25
195
kernel :
26
196
# -- Source Compilation --
27
197
@bcc -ansi -c -o out/kernel.o src/kernel.c
28
- @bcc -ansi -c -o out/std.o src/std.c
198
+ @bcc -ansi -c -o out/std_stringio.o src/std_stringio.c
199
+ @bcc -ansi -c -o out/std_fileio.o src/std_fileio.c
29
200
@bcc -ansi -c -o out/screen.o src/screen.c
30
- @bcc -ansi -c -o out/shell.o src/shell.c
31
201
@bcc -ansi -c -o out/output.o src/output.c
32
- @bcc -ansi -c -o out/opr .o src/opr .c
202
+ @bcc -ansi -c -o out/std_opr .o src/std_opr .c
33
203
@nasm -f as86 src/asm/kernel.asm -o out/kernel_asm.o
34
- @ld86 -o out/kernel -d out/* .o
204
+ if [ ! -d " out/asm" ]; then mkdir out/asm; fi
205
+ @nasm -f as86 src/asm/interrupt.asm -o out/asm/interrupt.o
206
+ ld86 -o out/kernel -d out/* .o out/asm/interrupt.o
35
207
# ------------ Compiled kernel stat ------------
36
- # Max Kernel Size : 15872 bytes (31 sectors, 1 sector = 512 bytes)
208
+ # Max Kernel Size : 8192 bytes (16 sectors, 1 sector = 512 bytes)
37
209
@stat --printf=" Kernel Size : %s bytes\n" out/kernel
38
210
# ----------------------------------------------
39
211
@dd if=out/kernel of=out/mangga.img bs=512 conv=notrunc seek=1 status=noxfer
40
212
41
213
createfilesystem :
42
- [ -d out/fs ] || mkdir out/fs;
214
+ if [ ! -d " out/fs" ] ; then mkdir out/fs; fi
43
215
@./other/fscreate out/fs/map.img out/fs/files.img out/fs/sectors.img
44
216
45
217
insertfilesystem :
@@ -49,10 +221,12 @@ insertfilesystem:
49
221
@dd if=out/fs/sectors.img of=out/mangga.img bs=512 count=1 seek=259 conv=notrunc status=noxfer
50
222
51
223
filesystemcreator :
224
+ if [ ! -d " other" ]; then mkdir other; fi
52
225
@gcc -Wall -Wextra -O3 -o other/fscreate other/filesystem_create.c
226
+ chmod +x other/fscreate
53
227
54
228
fileloader :
55
- @gcc -Wall -Wextra -O3 -o other /loadFile other/fileloader.c
229
+ @gcc -Wall -Wextra -O3 -o out /loadFile other/fileloader.c
56
230
57
231
58
232
# Test recipes
0 commit comments