genode/repos/os/tool/dde_kit_find_initcalls
Norman Feske ca971bbfd8 Move repositories to 'repos/' subdirectory
This patch changes the top-level directory layout as a preparatory
step for improving the tools for managing 3rd-party source codes.
The rationale is described in the issue referenced below.

Issue #1082
2014-05-14 16:08:00 +02:00

25 lines
567 B
Bash
Executable File

#!/bin/sh
#
# usage: dde_kit_find_initcalls <list of object files>
#
tempfile="/tmp/dde_kit-$(date +%s)"
nm -C "$@" | grep "dde_kit_initcall_" > $tempfile
sed -i "s/^.* \(dde_kit_initcall_.*\)/\1/" $tempfile
echo "/*"
echo " * Automatically generated by \"os/tool/dde_kit_find_initcalls $@\"."
echo " */"
cat $tempfile | sed "s/\(.*\)/extern int (*\1)(void);/" | sort | uniq
echo
echo "void do_initcalls(void)"
echo "{"
cat $tempfile | sed "s/\(.*\)/ \1();/" | sort | uniq
echo "}"
echo "/*"
echo " * End of automatically generated code."
echo " */"
rm $tempfile