summaryrefslogtreecommitdiff
path: root/tools/update-spec-gen-am.sh
blob: 35fc16c00b3f1d7589687e2ee6361165ac40b83e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh

mk_specdir="extensions"
mk_toolsdir="extensions/tools"

test -n "$XSLTPROC" || XSLTPROC=xsltproc
test -n "$TOP_SRCDIR" || TOP_SRCDIR=..

toolsdir="tools"
specdir="."

outfile="$1"
gendir="$2"
whitelist="$3"

SPEC_INTERFACES="`$XSLTPROC --nonet --novalid --xinclude $toolsdir/ls-interfaces.xsl $specdir/all.xml`"

install -d ./`dirname "$outfile"`
exec > "$outfile.tmp"

echo "# Rules to re-generate this file"
printf "$outfile: \$(top_srcdir)/$mk_specdir/all.xml \\\\\\n"
printf "\\t\\t\$(top_srcdir)/$mk_specdir/all.xml \\\\\\n"
printf "\\t\\t\$(SPEC_INTERFACE_XMLS) \\\\\\n"
printf "\\t\\t\$(top_srcdir)/$mk_toolsdir/ls-interfaces.xsl \\\\\\n"
printf "\\t\\t\$(top_builddir)/$mk_toolsdir/update-spec-gen-am.sh\\n"
printf "\\tXSLTPROC=xsltproc TOP_SRCDIR=\$(top_srcdir) \$(SHELL) \$(top_builddir)/$mk_toolsdir/update-spec-gen-am.sh $outfile $gendir $whitelist\\n"
echo

for class in INTERFACES INTERFACE_XMLS GENERATED_CS GENERATED_HS \
       GENERATED_LISTS GLUE_HS
do
  if test -z "$whitelist"
  then
    echo "SPEC_$class ="
  else
    echo "STABLE_SPEC_$class ="
    echo "UNSTABLE_SPEC_$class ="
  fi
done

for iface in $SPEC_INTERFACES
do
  if test -z "$whitelist"
  then
    # just output the combined variables directly
    stability=
  elif grep "^$iface\$" "$whitelist" >/dev/null
  then
    stability=STABLE_
  else
    stability=UNSTABLE_
  fi
  echo "${stability}SPEC_INTERFACES += $iface"
  echo "${stability}SPEC_INTERFACE_XMLS += \$(top_srcdir)/$mk_specdir/$iface.xml"
  if test -n "$gendir"
  then
    echo "${stability}SPEC_GENERATED_CS += $gendir/svc-$iface.c"
    echo "${stability}SPEC_GENERATED_HS += $gendir/svc-$iface.h"
    echo "${stability}SPEC_GLUE_HS += $gendir/svc-$iface-glue.h"
    echo "${stability}SPEC_GENERATED_LISTS +="\
         "$gendir/svc-$iface-signals-marshal.list"
  fi
done

if test -n "$whitelist"
then
  for class in INTERFACES INTERFACE_XMLS GENERATED_CS GENERATED_HS \
               GENERATED_LISTS GLUE_HS
  do
    echo "SPEC_$class = \$(STABLE_SPEC_$class) \$(UNSTABLE_SPEC_$class)"
  done
fi

mv "$outfile.tmp" "$outfile"