#!/bin/sh
#
#	vii - buffer and display output
#	Copyright (C) 1990-1995, 1999, 2005 Peter Miller
#
#	This program is free software; you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation; either version 2 of the License, or
#	(at your option) any later version.
#
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this program; if not, write to the Free Software
#	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
#
# MANIFEST: shell script to generate Makefile fragment for each source file
#
case $# in
3)
	depfile="$3"
	;;
2)
	depfile=/dev/null
	;;
*)
	echo "usage: $0 filename resolved-filename" 1>&2
	exit 1
	;;
esac
file="$1"
rfn="$2"

case $file in

*/*.c)
	root=`basename $file .c`
	stem=`echo $file | sed 's/\.c$//'`
	dir=`echo $file | sed 's|/.*||'`

	dep=`cat $depfile`

	echo ""
	echo "${stem}.o: $file" $dep
	echo "	\$(CC) \$(CFLAGS)" "-I$dir -Icommon -c $file"
	echo "	mv ${root}.o ${stem}.o"
	;;

man1/*.1)
	root=`basename $file .1`
	echo ""
	echo "man1/$root.h: $file bin/txt2c"
	echo "	bin/txt2c $file man1/$root.h"

	echo ""
	echo "\$(mandir)/man1/$root.1: $file bin/roffpp"
	echo "	bin/roffpp -Iman1 $file tmp"
	echo "	\$(INSTALL_DATA) tmp \$(mandir)/man1/$root.1"
	echo "	@rm tmp"
	;;

man1/*.so)
	root=`basename $file .so`
	echo ""
	echo "man1/$root.h: $file bin/txt2c"
	echo "	bin/txt2c $file man1/$root.h"
	;;

test/*/*)
	root=`basename $file .sh`
	echo ""
	echo "$root: $file all"
	echo "	\$(SH) $file"
	;;

*)
	;;
esac
exit 0


syntax highlighted by Code2HTML, v. 0.9.1