libk  Check-in [14172a910a]

Overview
Comment:move modules to a subdirectory in order to keep the directory tree organized and make room for OS-specific build files
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 14172a910addcc5ea3e8ec179b45b8c4a4a4c8103b99e2926be0e7fb003bcd5e
User & Date: lexi on 2019-08-21 06:00:24
Other Links: manifest | tags
Context
2019-08-21
06:43
create dist folder for OS-specific supporting build files check-in: 49b6e9c7f6 user: lexi tags: trunk
06:00
move modules to a subdirectory in order to keep the directory tree organized and make room for OS-specific build files check-in: 14172a910a user: lexi tags: trunk
04:50
Add initial build setup for Nix check-in: a26e579866 user: glow tags: trunk
Changes

Modified build.sh from [4eaecd6098] to [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)"

Modified global/common.sh from [0ffa5553a2] to [e60df5a627].

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
			else
				printf " $a";
			fi
		done
		echo
	}
else
	announce() { shift; echo " --> " $@; }
fi

# the following function is called to report a command invocation
# the person compiling the library. the first argument should be
# an ansi format string; this is used to color-code the tool being
# launched and thus should be different for each one.

report() { announce $@; $@; }







|








49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
			else
				printf " $a";
			fi
		done
		echo
	}
else
	announce() { echo " --> " $@; }
fi

# the following function is called to report a command invocation
# the person compiling the library. the first argument should be
# an ansi format string; this is used to color-code the tool being
# launched and thus should be different for each one.

report() { announce $@; $@; }

Name change from kbuild/kbuild.md to mod/kbuild/kbuild.md.

Name change from kconf/kconf.md to mod/kconf/kconf.md.

Name change from kcore/__stack_chk_fail.fn.c to mod/kcore/__stack_chk_fail.fn.c.

Name change from kcore/boot.rt.c to mod/kcore/boot.rt.c.

Name change from kcore/boot.rt.x86.lin.64.s to mod/kcore/boot.rt.x86.lin.64.s.

Name change from kcore/core.h to mod/kcore/core.h.

Name change from kcore/def.h.m to mod/kcore/def.h.m.

Name change from kcore/kcore.md to mod/kcore/kcore.md.

Name change from kcore/magic.h to mod/kcore/magic.h.

Name change from kcore/platform.syscall.fn.c to mod/kcore/platform.syscall.fn.c.

Name change from kcore/stop.fn.c to mod/kcore/stop.fn.c.

Name change from kcore/syscall.fn.x86.lin.64.s to mod/kcore/syscall.fn.x86.lin.64.s.

Name change from kcore/testbin.exe.c to mod/kcore/testbin.exe.c.

Name change from kcore/type.h.m to mod/kcore/type.h.m.

Name change from kdb/kdb.md to mod/kdb/kdb.md.

Name change from kdbg/dbg.h to mod/kdbg/dbg.h.

Name change from kdbg/kdbg.md to mod/kdbg/kdbg.md.

Name change from kfile/file.h to mod/kfile/file.h.

Name change from kfile/kfile.md to mod/kfile/kfile.md.

Name change from kgraft/attach.exe.c to mod/kgraft/attach.exe.c.

Name change from kgraft/graft.h to mod/kgraft/graft.h.

Name change from kgraft/kgraft.md to mod/kgraft/kgraft.md.

Name change from kio/io.h.m to mod/kio/io.h.m.

Name change from kio/kio.md to mod/kio/kio.md.

Name change from kio/send.fn.c to mod/kio/send.fn.c.

Name change from kmem/free.fn.c to mod/kmem/free.fn.c.

Name change from kmem/heapa.fn.c to mod/kmem/heapa.fn.c.

Name change from kmem/heapao.fn.c to mod/kmem/heapao.fn.c.

Name change from kmem/heapf.fn.c to mod/kmem/heapf.fn.c.

Name change from kmem/kmem.md to mod/kmem/kmem.md.

Name change from kmem/mem.h to mod/kmem/mem.h.

Name change from kmem/platform.mmap.fn.x86.lin.64.s to mod/kmem/platform.mmap.fn.x86.lin.64.s.

Name change from kmem/platform.munmap.fn.x86.lin.64.s to mod/kmem/platform.munmap.fn.x86.lin.64.s.

Name change from kmem/zero.fn.c to mod/kmem/zero.fn.c.

Name change from kmsg/kmsg.md to mod/kmsg/kmsg.md.

Name change from kmsg/msg.h to mod/kmsg/msg.h.

Name change from knet/knet.md to mod/knet/knet.md.

Name change from knet/net.h to mod/knet/net.h.

Name change from knum/knum.md to mod/knum/knum.md.

Name change from kproc/kproc.md to mod/kproc/kproc.md.

Name change from kproc/proc.h to mod/kproc/proc.h.

Name change from kstr/ks_to_int.c to mod/kstr/ks_to_int.c.

Name change from kstr/kstr.md to mod/kstr/kstr.md.

Name change from kstr/str.h to mod/kstr/str.h.

Name change from kterm/kterm.md to mod/kterm/kterm.md.

Name change from kterm/term.h to mod/kterm/term.h.