1#!/bin/sh
2
3#
4# Run this script every time the set of supported devices changes.
5#
6
7LIB=".";
8OUTPUT="$LIB/processors.ac";
9
10# Update configure script.
11echo "### Generating configure script for AM_CONDITIONALs ...";
12rm -f "$OUTPUT";
13for i in "$LIB/libdev/pic1"*.c; do
14    p="${i##*/pic}";
15    p="${p%.c}";
16    P=$(echo "$p" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ);
17    cat >> "$OUTPUT" <<EOT
18AM_CONDITIONAL([ENABLE_${P}], [ grep -i "^${P}\$" pics.supported >/dev/null 2>/dev/null ])
19EOT
20done;
21
22# Update libdev/Makefile.am.
23echo "### Updating libdev/Makefile.am ...";
24( cd "$LIB/libdev" && sh ./mkmk.sh > Makefile.am )
25
26# Recreate configure script.
27echo "### Updating build system ..."
28( cd "$LIB" && autoreconf )
29
30# Also update the free library part.
31echo "### Updating dependent build system in ../../../lib/pic16 ..."
32( cd "$LIB/../../../lib/pic16/libio" && sh ./mkmk.sh > Makefile.am )
33( cd "$LIB/../../../lib/pic16" && autoreconf )
34