8 MUSL="${MUSL:-../musl}"
28 # install headers to /tmp/T.$arch
31 [ -e T.$arch ] && continue
32 make -f "$MUSL"/Makefile install-headers srcdir="$MUSL" prefix=/tmp/T.$arch ARCH=$arch
33 rm -rf obj/include/bits
37 # run ctags on headers
40 [ -e /tmp/T.$arch/musl.tags ] && continue
42 cd /tmp/T.$arch/include
43 ctags -f ../musl.tags -R -n -u --language-force=c --c-kinds=pxdstuve --fields=k .
44 # fix wchar_t bug of ctags (not ok for c++)
45 awk '/typedef.* wchar_t/{print "wchar_t\tbits/alltypes.h\t" NR ";\"\tt"}' bits/alltypes.h >>../musl.tags
49 # add declarations (slow)
52 [ -e /tmp/T.$arch/musl.decls ] && continue
54 cd /tmp/T.$arch/include
58 function decl(t,h,n) {
59 cmd = "awk '\''NR==" n
61 cmd = cmd "{s=$0; if(s!~/;/){getline; s=s \" \" $0} print s; exit}"
63 cmd = cmd "{s=$0; while(gsub(/\\\\$/,\"\",s)){getline; s=s $0} print s; exit}"
81 # print $1 "\t" $2 "\t" $4 "\t" $3 "\t" decl($4,$2,$3)
83 print $1 "\t" $2 "\t" $4 "\t" decl($4,$2,$3)
84 }' ../musl.tags >../musl.decls.raw
89 $3=="d" && $4 ~ /^#undef/ {next}
90 $3=="x" && $4 ~ /^(struct|union) [_0-9a-zA-Z]*;$/ {
91 a = ($4 ~ /^struct/) ? "struct " : "union "
92 b = ($4 ~ /^struct/) ? "S" : "U"
93 print a $1 "\t" $2 "\t" b "\t" $4
97 print $1 "\t" $2 "\tT\t" $4
100 { print $0 }' ../musl.decls.raw | sort >../musl.decls
107 grep ' bits/' /tmp/T.$arch/musl.decls >data/musl.$arch.decls
111 grep -v ' bits/' /tmp/T.$arch/musl.decls >data/musl.generic.decls