#!/bin/sh
#
#	vii - buffer and display output
#	Copyright (C) 1991-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 file
#
ALL="bin/vii"
xi_files=
txt2c_files="common/ac/string.o common/arglex.o common/error.o common/mem.o \
common/mprintf.o common/option.o common/str.o common/trace.o"
common=
test_files=
clean_files="core bin/txt2c"
man_files=
for file in $*
do
	case $file in

	vii/*.c)
		stem=`echo $file | sed 's/\.c$//'`
		xi_files="$xi_files ${stem}.o"
		clean_files="$clean_files ${stem}.o"
		;;

	txt2c/*.c)
		stem=`echo $file | sed 's/.c$//'`
		txt2c_files="$txt2c_files ${stem}.o"
		clean_files="$clean_files ${stem}.o"
		;;

	common/*.c)
		stem=`echo $file | sed 's/.c$//'`
		common_files="$common_files ${stem}.o"
		clean_files="$clean_files ${stem}.o"
		;;

	test/*/*)
		root=`basename $file .sh`
		test_files="$test_files ${root}"
		;;

	man1/*.1)
		root=`basename $file .1`
		man_files="$man_files \$(mandir)/man1/$root.1"
		clean_files="$clean_files man1/${root}.h"
		;;

	man1/*.so)
		root=`basename $file .so`
		clean_files="$clean_files man1/${root}.h"
		;;

	*)
		;;
	esac
done

echo ""
echo "CommonObj =" $common_files

echo ""
echo "common/lib.a: \$(CommonObj)"
echo "	rm -f common/lib.a"
echo "	\$(AR) qc common/lib.a \$(CommonObj)"
echo "	\$(RANLIB) common/lib.a"

echo ""
echo ".bin:"
echo "	-mkdir bin"
echo "	@touch .bin"

echo ""
echo "XiObj =" $xi_files

echo ""
echo "bin/vii: \$(XiObj) common/lib.a .bin"
echo "	\$(CC) \$(LDFLAGS) -o bin/vii \$(XiObj) common/lib.a \$(LIBS)"

echo ""
echo "Txt2cObj =" $txt2c_files

echo ""
echo "bin/txt2c: \$(Txt2cObj) .bin"
echo "	@sleep 1"
echo "	\$(CC) \$(LDFLAGS) -o bin/txt2c \$(Txt2cObj) \$(LIBS)"
echo "	@sleep 1"

echo ""
echo "sure:" $test_files
echo "	@echo Passed All Tests"

echo ""
echo "clean-obj:"
echo "	rm -f" $clean_files

echo ""
echo "clean: clean-obj"
echo "	rm -f" $ALL

echo ""
echo "distclean: clean"
echo "	rm -f Makefile common/config.h config.status config.cache"

ALLinst=
for f in $ALL
do
	root=`basename $f`
	ALLinst="$ALLinst \$(bindir)/$root"

	echo ""
	echo "\$(bindir)/$root: $f"
	echo "	\$(INSTALL_PROGRAM) $f \$(bindir)/$root"
done

echo ""
echo "install-bin:" $ALLinst

echo ""
echo "install-man:" $man_files

echo ""
echo "install: install-bin install-man"

exit 0


syntax highlighted by Code2HTML, v. 0.9.1