8 MUSL="${MUSL:-../musl}"
27 # install headers to T.$arch
30 [ -e T.$arch ] && continue
31 make -f "$MUSL"/Makefile install-headers srcdir="$MUSL" prefix=T.$arch ARCH=$arch
32 rm -rf obj/include/bits
36 # run ctags on headers
39 [ -e T.$arch/musl.tags ] && continue
41 ctags -f ../musl.tags -R -n -u --language-force=c --c-kinds=pxdstuve --fields=k .
42 # fix wchar_t bug of ctags (not ok for c++)
43 awk '/typedef.* wchar_t/{print "wchar_t\tbits/alltypes.h\t" NR ";\"\tt"}' bits/alltypes.h >>../musl.tags
47 # add declarations (slow)
50 [ -e T.$arch/musl.decls ] && continue
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)
79 }' ../musl.tags >../musl.decls.raw
84 $3=="d" && $5 ~ /^#undef/ {next}
85 $3=="x" && $5 ~ /^(struct|union) [_0-9a-zA-Z]*;$/ {
86 a = ($5 ~ /^struct/) ? "struct " : "union "
87 b = ($5 ~ /^struct/) ? "S" : "U"
88 print a $1 "\t" $2 "\t" b "\t" $4 "\t" $5
92 print $1 "\t" $2 "\tT\t" $4 "\t" $5
95 { print $0 }' ../musl.decls.raw | sort >../musl.decls
102 grep ' bits/' T.$arch/musl.decls >data/musl.$arch.decls
106 grep -v ' bits/' T.$arch/musl.decls >data/musl.generic.decls