8 MUSL="${MUSL:-../musl}"
29 # install headers to /tmp/T.$arch
32 [ -e T.$arch ] && continue
33 make -f "$MUSL"/Makefile install-headers srcdir="$MUSL" prefix=/tmp/T.$arch ARCH=$arch
34 rm -rf obj/include/bits
38 # run ctags on headers
41 [ -e /tmp/T.$arch/musl.tags ] && continue
43 cd /tmp/T.$arch/include
44 ctags -f ../musl.tags -R -n -u --language-force=c --c-kinds=pxdstuve --fields=k .
45 # fix wchar_t bug of ctags (not ok for c++)
46 awk '/typedef.* wchar_t/{print "wchar_t\tbits/alltypes.h\t" NR ";\"\tt"}' bits/alltypes.h >>../musl.tags
50 # add declarations (slow)
53 [ -e /tmp/T.$arch/musl.decls ] && continue
55 cd /tmp/T.$arch/include
59 function decl(t,h,n) {
60 cmd = "awk '\''NR==" n
62 cmd = cmd "{s=$0; if(s!~/;/){getline; s=s \" \" $0} print s; exit}"
64 cmd = cmd "{s=$0; while(gsub(/\\\\$/,\"\",s)){getline; s=s $0} print s; exit}"
82 # print $1 "\t" $2 "\t" $4 "\t" $3 "\t" decl($4,$2,$3)
84 print $1 "\t" $2 "\t" $4 "\t" decl($4,$2,$3)
85 }' ../musl.tags >../musl.decls.raw
90 $3=="d" && $4 ~ /^#undef/ {next}
91 $3=="x" && $4 ~ /^(struct|union) [_0-9a-zA-Z]*;$/ {
92 a = ($4 ~ /^struct/) ? "struct " : "union "
93 b = ($4 ~ /^struct/) ? "S" : "U"
94 print a $1 "\t" $2 "\t" b "\t" $4
98 print $1 "\t" $2 "\tT\t" $4
101 { print $0 }' ../musl.decls.raw | sort >../musl.decls
108 grep ' bits/' /tmp/T.$arch/musl.decls >data/musl.$arch.decls
112 grep -v ' bits/' /tmp/T.$arch/musl.decls >data/musl.generic.decls