libk  Diff

Differences From Artifact [4eaecd6098]:

To Artifact [9bf8bf8013]:


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
...
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
...
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
awk -f global/gen-ident.awk <global/modules >$gen/internal.ident.c
comp_co $gen/internal.ident.c $to/internal.ident.o

# first pass: copy all headers into place,
# including ones we need to generate

for mod in ${modules[@]}; do
	for h in $(scan $mod '*.h'); do
		base=$(basename $h)
		cp "$h" "$to/k/$base"
	done

	for h in $(scan $mod '*.h.m'); do
		base=$(basename $h)
		dest=${base%%.m}
		comp_mac "$h" "$to/k/$dest"
	done
done

# second pass: generate manpage, html, and pdf
# versions of the documentation from the md src

if test "$doc" = "yes"; then
	global/build-manpage.sh libk.md
	for mod in ${modules[@]}; do
		for doc in $(scan $mod '*.md'); do
			base="$(basename $doc)"
			stem="${base%%.md}"
			report global/build-manpage.sh "$doc"
		done
	done
fi

................................................................................
# which is a runtime or function unit. exe's
# will not be compiled until a later pass

fn_objects=()
rt_objects=()
data_objects=( $to/internal.ident.o )
for mod in ${modules[@]}; do
	for fn in $(scan $mod '*.fn.c'); do
		base="$(basename $fn)"
		dest="$to/$mod.${base%%.c}.o"
		comp_co "$fn" "$dest"
		fn_objects+=("$dest")
	done

	for rt in $(scan $mod '*.rt.c'); do
		base="$(basename $rt)"
		dest="$to/$mod.${base%%.c}.o"
		comp_co "$rt" "$dest"
		rt_objects+=("$dest")
	done

	for fn in $(scan $mod "*.fn.$target.s"); do
		base="$(basename $fn)"
		dest="$to/$mod.${base%%.s}.o"
		comp_asm "$fn" "$dest"
		fn_objects+=("$dest")
	done

	for rt in $(scan $mod "*.rt.$target.s"); do
		base="$(basename $rt)"
		dest="$to/$mod.${base%%.s}.o"
		comp_asm "$rt" "$dest"
		rt_objects+=("$dest")
	done
done

................................................................................
	report ld -shared ${fn_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 '*.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)"







|




|












|







 







|






|






|






|







 







|












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
...
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
...
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
awk -f global/gen-ident.awk <global/modules >$gen/internal.ident.c
comp_co $gen/internal.ident.c $to/internal.ident.o

# first pass: copy all headers into place,
# including ones we need to generate

for mod in ${modules[@]}; do
	for h in $(scan mod/$mod '*.h'); do
		base=$(basename $h)
		cp "$h" "$to/k/$base"
	done

	for h in $(scan mod/$mod '*.h.m'); do
		base=$(basename $h)
		dest=${base%%.m}
		comp_mac "$h" "$to/k/$dest"
	done
done

# second pass: generate manpage, html, and pdf
# versions of the documentation from the md src

if test "$doc" = "yes"; then
	global/build-manpage.sh libk.md
	for mod in ${modules[@]}; do
		for doc in $(scan mod/$mod '*.md'); do
			base="$(basename $doc)"
			stem="${base%%.md}"
			report global/build-manpage.sh "$doc"
		done
	done
fi

................................................................................
# which is a runtime or function unit. exe's
# will not be compiled until a later pass

fn_objects=()
rt_objects=()
data_objects=( $to/internal.ident.o )
for mod in ${modules[@]}; do
	for fn in $(scan mod/$mod '*.fn.c'); do
		base="$(basename $fn)"
		dest="$to/$mod.${base%%.c}.o"
		comp_co "$fn" "$dest"
		fn_objects+=("$dest")
	done

	for rt in $(scan mod/$mod '*.rt.c'); do
		base="$(basename $rt)"
		dest="$to/$mod.${base%%.c}.o"
		comp_co "$rt" "$dest"
		rt_objects+=("$dest")
	done

	for fn in $(scan mod/$mod "*.fn.$target.s"); do
		base="$(basename $fn)"
		dest="$to/$mod.${base%%.s}.o"
		comp_asm "$fn" "$dest"
		fn_objects+=("$dest")
	done

	for rt in $(scan mod/$mod "*.rt.$target.s"); do
		base="$(basename $rt)"
		dest="$to/$mod.${base%%.s}.o"
		comp_asm "$rt" "$dest"
		rt_objects+=("$dest")
	done
done

................................................................................
	report ld -shared ${fn_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)"