summaryrefslogtreecommitdiff
path: root/device/non-free/include/pic14/recreate.sh
blob: aba16d2b43596bada17b0c271bbb574bd649b1b9 (plain) (blame)
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
#!/bin/sh

# This script can be used to recreate the device library files from
# gputils' .inc files.
# Usage:
#     mkdir temp && cd temp && ../recreate.sh
#
# You will need to adjust the paths to SDCC and gputils before running!

GPUTILS=$HOME/svn/gputils
SDCC=$HOME/svn/plain

is_in()
{
  local f l j
  f=$1
  shift
  l=$*

  for j in $l; do
    if [ $f = $j ]
    then
      return 0
    fi
  done

  return 1
}

NO_LEGACY_NAMES=

for i in ../pic*.h
do
  if ! is_in $i ../pic14regs.h ../pic16fam.h ]
  then
    test -e $i && grep -q NO_LEGACY_NAMES $i && NO_LEGACY_NAMES="$NO_LEGACY_NAMES $i"
  fi
done

for i in ../pic*.h
do
  if ! is_in $i ../pic14regs.h ../pic16fam.h ]
  then
    if is_in $i $NO_LEGACY_NAMES
    then
      emit_legacy_names=1
    else
      emit_legacy_names=
    fi
    DEV=`echo "$i" | sed -e "s:../pic::;s/\.h//"`;
    echo "Creating ${DEV} ${emit_legacy_names}...";
    "${SDCC}/support/scripts/inc2h.pl" "${DEV}" "${GPUTILS}" "${emit_legacy_names}";
  fi
done