unset pwd base source target
}
+# Write a warning to $1 to make clear it should not be modified. $2 is the
+# source for the generated file.
+setup_warning() {
+ echo "###################################" > $1
+ echo "# WARNING! DO NOT EDIT THIS FILE! #" >> $1
+ echo "###################################" >> $1
+ echo >> $1
+ echo "# It was generated from $2 on `date`." >> $1
+ echo >> $1
+}
+
# m4 wrapper which uses $1.m4 as template file, feeds it to m4 and writes it
# to $1 with a warning at the beginning to not edit the generated file.
#
file=$1
shift
- # Write a warning to the generated file.
- echo "###################################" > $file
- echo "# WARNING! DO NOT EDIT THIS FILE! #" >> $file
- echo "###################################" >> $file
- echo >> $file
- echo "# It was generated from $file.m4 on `date`." >> $file
- echo >> $file
+ # Write a warning to the generated file to not edit it.
+ setup_warning $file $file.m4
# Process $1.m4 with m4 using the given options.
echo "m4(): generating '$file' from '$file.m4' with options '$*'"