summaryrefslogtreecommitdiff
path: root/newlib-tester/do_rst
blob: 3c07c356cd8ac8520a82fb3ebe9577585619e721 (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
#! /bin/sh
#
#  Find all the newlib C files with documentation markup and convert
#  them to Rest.
#

### XXX LOCALIZE THESE
newlib=/home/joel/test-gcc/newlib-cygwin
outd=/home/joel/rtems-work/rtems-docs/newlib-tester/newlib-rest
converter=${newlib}/../NewlibMarkup2SphinxConverter

startd=`pwd`

rm -rf ${outd}
mkdir  ${outd}

find ${newlib}/newlib -name "*.c" | \
  sed -e '/libc\/machine\//d' -e '/libc\/sys\//d' | \
  xargs -e grep -l "^FUNCTION" | \
while read f
do
  foutd=`dirname ${f} | sed -e 's/^.*\/newlib\///'`
  foutd=${outd}/${foutd}
  if [ ! -d ${foutd} ] ; then
    mkdir -p ${foutd}
  fi

  rstf=`basename ${f} | sed -e 's/\.c$/.rst/'`
  # echo "${f} -> ${foutd}/${rstf}"
  ${converter}/gen_rst_from_makedoc.py \
     -c ${f} \
     -r ${foutd}/${rstf}


done