|
0
|
1 |
#!/bin/sh
|
|
|
2 |
|
|
|
3 |
newfile() {
|
|
|
4 |
local old=$1
|
|
|
5 |
local new=${old}.new
|
|
|
6 |
cat >$new
|
|
|
7 |
if cmp -s $old $new; then
|
|
|
8 |
echo "$old is unchanged." >&2
|
|
|
9 |
rm -f $new
|
|
|
10 |
else
|
|
|
11 |
echo "$old was changed, REPLACING." >&2
|
|
|
12 |
mv -f $new $old
|
|
|
13 |
fi
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
{
|
|
|
17 |
sed -e '/^%%LIST%%$/,$d' showvconfig.cc.in
|
|
|
18 |
while read type ext name default; do
|
|
|
19 |
filename=`echo $name | sed -e 's/_/-/g'`
|
|
|
20 |
sed -e "s|%NAME%|$name|g" \
|
|
|
21 |
-e "s|%EXT%|$ext|g" \
|
|
|
22 |
-e "s|%TYPE%|$type|g" \
|
|
|
23 |
-e "s|%DEFAULT%|$default|g" \
|
|
|
24 |
-e "s|%FILENAME%|$filename|g" \
|
|
|
25 |
configvar.in | newfile _${name}.cc
|
|
|
26 |
echo " show_$ext(\"${filename}\", config->${name}());"
|
|
|
27 |
done <configrc.in
|
|
|
28 |
sed -e '1,/^%%LIST%%$/d' showvconfig.cc.in
|
|
|
29 |
} | newfile showvconfig.cc
|
|
|
30 |
|
|
|
31 |
{
|
|
|
32 |
sed -e '/^%%LIST%%$/,$d' configrc.h.in
|
|
|
33 |
while read type ext name default; do
|
|
|
34 |
echo "public: $type $name() const;"
|
|
|
35 |
echo "private: config_cache<$type> ${name}_cache;"
|
|
|
36 |
done <configrc.in
|
|
|
37 |
sed -e '1,/^%%LIST%%$/d' configrc.h.in
|
|
|
38 |
} | newfile configrc.h
|
|
|
39 |
|
|
|
40 |
{
|
|
|
41 |
sed -e '/^%%LIST%%$/,$d' Makefile.am.in
|
|
|
42 |
while read type ext name default; do
|
|
|
43 |
echo " _${name}.cc \\"
|
|
|
44 |
done <configrc.in
|
|
|
45 |
sed -e '1,/^%%LIST%%$/d' Makefile.am.in
|
|
|
46 |
} | newfile Makefile.am
|