8 MUSL="${MUSL:-../musl}"
25 # install headers to /tmp/T.$arch
28 [ -e T.$arch ] && continue
29 make -f "$MUSL"/Makefile install-headers srcdir="$MUSL" prefix=/tmp/T.$arch ARCH=$arch
30 rm -rf obj/include/bits
34 # run ctags on headers
37 [ -e /tmp/T.$arch/musl.tags ] && continue
39 cd /tmp/T.$arch/include
40 ctags -f ../musl.tags -R -n -u --language-force=c --c-kinds=pxdstuve --fields=k .
41 # fix wchar_t bug of ctags (not ok for c++)
42 awk '/typedef.* wchar_t/{print "wchar_t\tbits/alltypes.h\t" NR ";\"\tt"}' bits/alltypes.h >>../musl.tags
46 # add declarations (slow)
49 [ -e /tmp/T.$arch/musl.decls ] && continue
51 cd /tmp/T.$arch/include
55 function decl(t,h,n) {
56 cmd = "awk '\''NR==" n
58 cmd = cmd "{s=$0; if(s!~/;/){getline; s=s \" \" $0} print s; exit}"
60 cmd = cmd "{s=$0; while(gsub(/\\\\$/,\"\",s)){getline; s=s $0} print s; exit}"
78 # print $1 "\t" $2 "\t" $4 "\t" $3 "\t" decl($4,$2,$3)
80 print $1 "\t" $2 "\t" $4 "\t" decl($4,$2,$3)
81 }' ../musl.tags >../musl.decls.raw
86 $3=="d" && $4 ~ /^#undef/ {next}
87 $3=="x" && $4 ~ /^(struct|union) [_0-9a-zA-Z]*;$/ {
88 a = ($4 ~ /^struct/) ? "struct " : "union "
89 b = ($4 ~ /^struct/) ? "S" : "U"
90 print a $1 "\t" $2 "\t" b "\t" $4
94 print $1 "\t" $2 "\tT\t" $4
97 { print $0 }' ../musl.decls.raw | sort >../musl.decls
104 grep ' bits/' /tmp/T.$arch/musl.decls >data/musl.$arch.decls
108 grep -v ' bits/' /tmp/T.$arch/musl.decls >data/musl.generic.decls