4 # Generate an h tree that includes the appropriate sys headers
6 # Usage: make_h_tree ${SRC} ...
8 # The source files in the specified directories will be scanned for include
9 # directives. The h directory will be created under the current directory and
10 # populated with stubs that include the actual header file for every header
11 # included by any source file in the ${SRC} directories. Since this script is
12 # for userspace only, this effectively just makes a file called h/foo.h that
14 # #include <sys/foo.h>
15 # For every include directive that is found that looks like #include <h/foo.h>
16 # This is an ugly hack to work around the naming of header files using h
17 # instead of their proper names elsewhere in the code.
22 for hsrc
in `cat "$dir"/*.c | \
23 sed -n -e 's|^[ ]*#[ ]*include[ ]*[<"]h/\([^>"/]*\)[>"].*$|\1|p' | \
26 echo "#include <sys/$hsrc>" > h
/"$hsrc"