Update makeheader.sh

This commit is contained in:
Manoel Trapier 2013-03-20 20:35:46 +01:00 committed by Manoël Trapier
parent 2830ec90b1
commit 46f101f4dd

View File

@ -11,25 +11,32 @@ for fil in /tmp/ack-temp/pmcache/*; do
fi fi
done done
POSTFIX=".h"
if [ -f ${file}.str ]; then
POSTFIX="_loc.h"
fi
if [ ! -f ${file}.h ]; then if [ ! -f ${file}${POSTFIX} ]; then
echo "No header, building it" echo "No header, building it"
touch ${file}.h # Be carefull if a ${file}.str file exist use _loc.h postfix.
cat > ${file}.h <<EOF
HEADERMAGIC=`echo ${file}.h | tr '[.-/]' '_' | tr '[a-z]' '[A-Z]'`
BASE=`dirname ${file}.c`
touch ${file}${POSTFIX}
cat > ${file}${POSTFIX} <<EOF
/* /*
* The Amsterdam Compiler Kit * The Amsterdam Compiler Kit
* See the copyright notice in the ACK home directory, in the file "Copyright". * See the copyright notice in the ACK home directory, in the file "Copyright".
*/ */
EOF EOF
HEADERMAGIC=`echo ${file}.h | tr '[.-/]' '_' | tr '[a-z]' '[A-Z]'` echo "#ifndef ${HEADERMAGIC}" >> ${file}${POSTFIX}
BASE=`dirname ${file}.c` echo "#define ${HEADERMAGIC}" >> ${file}${POSTFIX}
echo "#ifndef ${HEADERMAGIC}" >> ${file}.h echo "" >> ${file}${POSTFIX}
echo "#define ${HEADERMAGIC}" >> ${file}.h cproto -U__BLOCKS__ ${INCPATH[*]} ${file}.c >> ${file}${POSTFIX}
echo "" >> ${file}.h echo "" >> ${file}${POSTFIX}
cproto -U__BLOCKS__ ${INCPATH[*]} ${file}.c >> ${file}.h echo "#endif /* ${HEADERMAGIC} */" >> ${file}${POSTFIX}
echo "" >> ${file}.h echo "" >> ${file}${POSTFIX}
echo "#endif /* ${HEADERMAGIC} */" >> ${file}.h
echo "" >> ${file}.h
else else
echo "Header existing... try to update.. (manual check should be done)" echo "Header existing... try to update.. (manual check should be done)"
cp ${file}.h ${file}.h.old cp ${file}.h ${file}.h.old
@ -45,5 +52,6 @@ else
echo "" >> ${file}.h.new echo "" >> ${file}.h.new
cp ${file}.h.new ${file}.h cp ${file}.h.new ${file}.h
rm ${file}.h.new
# #
fi fi