diff options
Diffstat (limited to 'build-0.3/meta/automake')
-rwxr-xr-x | build-0.3/meta/automake | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/build-0.3/meta/automake b/build-0.3/meta/automake new file mode 100755 index 0000000..ede1958 --- /dev/null +++ b/build-0.3/meta/automake @@ -0,0 +1,64 @@ +#! /usr/bin/env bash + +# file : build/meta/automake +# copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# Process automake Makefile.am templates. +# +# Options: +# +# -o <output-file> +# +# Arguments: +# +# <template-file> +# +trap 'exit 1' ERR + +function error () +{ + echo "$*" 1>&2 +} + +output= + +while [ $# -gt 0 ]; do + case $1 in + -o) + output=$2 + shift 2 + ;; + *) + break + ;; + esac +done + +input=$1 + +if [ "$input" = "" ]; then + error "no input file" + exit 1 +fi + +if [ "$output" = "" ]; then + error "no output file" + exit 1 +fi + +m4=m4 + +# Assume this script is never found via PATH. +# +meta=`dirname $0` + +build="$meta/.." +install=$build/install/install + +# Make sure the output directory exist. +# +$install -d -m 755 `dirname $output` + +$m4 -P -D__meta_base__=$meta $meta/automake.m4 $input >$output +chmod 644 $output |