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
..
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
...
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
dos.*) bin_fmt=dosexe;;
none.*) bin_fmt=bin;;
*.32) bin_fmt=elf32;;
*.64) bin_fmt=elf64;;
*) say "cannot determine correct binary format to use for target $target"; exit 1;;
esac
# first, we establish the
# parameters of the build
has cc && _cc=cc
has clang && _cc=clang
has gcc && _cc=gcc # prefer gcc
cc=${cc:-$_cc}
has m4 && _m4=m4
m4=${m4:-$_m4}
has nasm && asm=nasm
has yasm && asm=yasm # prefer yasm
export cc
export m4
export gen=${gen:-gen}
library=${library:-static} # {static|shared|both}
export verbose=${verbose:-quiet} # {no|quiet|loud}
doc=${doc:-yes}
export doc_html=${doc_html:-yes}
export doc_pdf=${doc_pdf:-yes}
................................................................................
build_shared_library=yes;;
both) build_static_library=yes
build_shared_library=yes;;
esac
check cc "your C compiler of choice"
check asm "an assembler that takes Intel syntax and nasm-style-macros"
check m4 "the path to your m4 installation"
export build=$(global/build-id.sh)
if test "$p_headers_errno" = ""; then
case $os in
lin) p_headers_errno="${p_headers_errno:-/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h}";;
................................................................................
for obj in ${fn_objects[@]} ${rt_objects[@]} ${data_objects[@]}; do
report ar rc $to/libk.a $obj
done
report ranlib $to/libk.a
fi
if test $build_shared_library == yes; then
report ld -r ${rt_objects[@]} -o $to/boot.o
report ld -shared ${fn_objects[@]} ${data_objects[@]} -o $to/libk.so
fi
# fifth pass: compile the executable tools
# against the libraries created in pass 5
for mod in ${modules[@]}; do
for exe in $(scan mod/$mod '*.exe.c'); do
base="$(basename $exe)"
dest="$to/$mod.${base%%.exe.c}"
if test $build_shared_library == yes; then
comp_c "$to/boot.o $exe" "$dest" -lk
else
comp_c "$exe" "$dest" -lk
fi
done
done
set +x
say "all passes finished; build $build complete at $(timestamp)"
|
|
<
>
>
|
|
|
|
>
>
>
>
|
|
>
>
>
>
|
|
<
<
>
|
|
|
|
|
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
..
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
...
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
dos.*) bin_fmt=dosexe;;
none.*) bin_fmt=bin;;
*.32) bin_fmt=elf32;;
*.64) bin_fmt=elf64;;
*) say "cannot determine correct binary format to use for target $target"; exit 1;;
esac
# first, we establish the parameters of the build
# detect C compiler to use
has cc && _cc=cc
has clang && _cc=clang
has gcc && _cc=gcc # prefer gcc
export cc=${cc:-$_cc}
# detect m4 implementation to use. TODO: determine if BSD m4
# is compatible with our macro sources, otherwise we'll need
# to fix that or make gm4 a dep if we can't
has m4 && _m4=m4
export m4=${m4:-$_m4}
# pick the assembler to use. long-term, we need to rewrite
# the x86* sources to just use gas, since gas is the only
# OSS assembler that seems to exist for other arches
has nasm && asm=nasm
has yasm && asm=yasm # prefer yasm
export gen=${gen:-gen}
library=${library:-static} # {static|shared|both}
export verbose=${verbose:-quiet} # {no|quiet|loud}
doc=${doc:-yes}
export doc_html=${doc_html:-yes}
export doc_pdf=${doc_pdf:-yes}
................................................................................
build_shared_library=yes;;
both) build_static_library=yes
build_shared_library=yes;;
esac
check cc "your C compiler of choice"
check asm "an assembler that takes Intel syntax and nasm-style macros"
check m4 "the path to your m4 binary"
export build=$(global/build-id.sh)
if test "$p_headers_errno" = ""; then
case $os in
lin) p_headers_errno="${p_headers_errno:-/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h}";;
................................................................................
for obj in ${fn_objects[@]} ${rt_objects[@]} ${data_objects[@]}; do
report ar rc $to/libk.a $obj
done
report ranlib $to/libk.a
fi
if test $build_shared_library == yes; then
report ld -r ${rt_objects[@]} -o $to/kboot.o
report ld -shared ${fn_objects[@]} ${data_objects[@]} -o $to/libk.so
fi
# fifth pass: compile the executable tools
# against the libraries created in pass 5
for mod in ${modules[@]}; do
for exe in $(scan mod/$mod '*.exe.c'); do
base="$(basename $exe)"
dest="$to/$mod.${base%%.exe.c}"
if test $build_shared_library == yes; then
comp_c "$to/kboot.o $exe" "$dest" -lk
else
comp_c "$exe" "$dest" -lk
fi
done
done
set +x
say "all passes finished; build $build complete at $(timestamp)"
|