# Generated automatically from Makefile.in by configure.
# $Id: Makefile.in,v 1.25 1997/03/15 23:49:05 bfriesen Exp $
# Generated automatically from Makefile.in by configure.
#
# Gifmap Makefile
# Written by Bob Friesenhahn, 1996
#

SHELL	= /bin/sh

# Berkely compatable install program
INSTALL	= ./install-sh -c

# Default top-level directories in which to install architecture-
# specific files (exec_prefix) and machine-independent files such
# as scripts (prefix).  The values specified here may be overridden
# at configure-time with the --exec-prefix and --prefix options
# to the "configure" script.
 
prefix =                /usr/local
exec_prefix =           ${prefix}

# The following definition can be set to non-null for special systems
# like AFS with replication.  It allows the pathnames used for installation
# to be different than those used for actually reference files at
# run-time.  INSTALL_ROOT is prepended to $prefix and $exec_prefix
# when installing files.
INSTALL_ROOT =

# Directory in which to install executables:
BIN_INSTALL_DIR =       $(INSTALL_ROOT)$(exec_prefix)/bin

# Top-level directory for manual entries:
MAN_INSTALL_DIR =       $(INSTALL_ROOT)$(prefix)/man
 
# Directory in which to install manual pages:
MAN1_INSTALL_DIR =      $(MAN_INSTALL_DIR)/man1

all: gifmap.man gifmap.txt gifmap.html gifmap.lsm configure gifmap

#
# Build manual page
#
gifmap.man: gifmap.pod
	pod2man --section 1 --center 'User Commands' \
	--release `head -5 gifmap | grep 'Id: gifmap\.in,v' | awk '{ print $$4 }'` \
	gifmap.pod > gifmap.man

#
# Build text version
#
gifmap.txt: gifmap.man
	nroff -man < gifmap.man | col -b > gifmap.txt

#
# Build HTML page
#
gifmap.html: gifmap.pod
	pod2html gifmap.pod

#
# Do install
# You likely have to be super-user for install to work
# if installing in common area
#
install: gifmap.man
	$(INSTALL) -m 0755 gifmap $(BIN_INSTALL_DIR)/gifmap
	$(INSTALL) -m 0644 gifmap.man $(MAN1_INSTALL_DIR)/gifmap.1

#
# Automatically regenerate configure script
#
configure: configure.in
	autoconf

# Automatically regenerate Makefile if required
# May not be supported by all makes (works with GNU make)
Makefile: Makefile.in configure
	./configure

#
# Process gifmap.in into gifmap
#
gifmap: Makefile gifmap.in configure
	./configure

#
# Build distribution
#
DISTFILES = \
	INSTALL \
	INSTALL.generic \
	Makefile.in \
	MANIFEST \
	README \
	TODO \
	configure \
	configure.in \
	gifmap.html \
	gifmap.in \
	gifmap.lsm \
	gifmap.lsm.in \
	gifmap.man \
	gifmap.pod \
	gifmap.txt \
	gifmaprc.in \
	install-sh \
	release \
	icons/aqua_next.gif \
	icons/aqua_prev.gif \
	icons/blue_ball.gif \
	icons/blue_ball_large.gif \
	icons/blue_ball_medium.gif \
	icons/blue_dir.gif \
	icons/blue_down.gif \
	icons/blue_help.gif \
	icons/blue_next.gif \
	icons/blue_prev.gif \
	icons/blue_readme.gif \
	icons/blue_top.gif \
	icons/blue_up.gif \
	icons/gray_next.gif \
	icons/gray_prev.gif

#
# Apply tag based on current date & time
# Avoid tagging unless distributed file has been updated
#
.tag : $(DISTFILES)
	cvs tag R-`date +%y%m%d-%H%M` .
	touch .tag

.PHONY: tag
tag: .tag

#
# Extract release info from gifmap.in
# Gifmap release is same as gifmap.in revision
#
release: gifmap.in
	head -5 gifmap.in | grep 'Id: gifmap\.in,v' | awk '{ print $$4 }' > release

#
# Build Linux LSM file
# Adds date & release info to template file
#
gifmap.lsm: release gifmap.lsm.in
	release=`cat release`; \
	date=`date +"%d%b%y" | tr '[a-z]' '[A-Z]'`; \
	sed -e "s/@RELEASE@/$$release/g" < gifmap.lsm.in | \
	sed -e "s/@DATE@/$$date/g" > gifmap.lsm

# Build a .tar.gz file
tar:	release tag configure gifmap.lsm gifmap.man gifmap.txt gifmap.html
	release=`cat release`; \
	distname=gifmap-$$release; \
	rm -fr $$distname; \
	mkdir $$distname; \
	for file in $(DISTFILES); do \
	  echo $$file; \
	done | cpio -pdlu $$distname ; \
	chmod -R a+rX $$distname; \
	tar -chz -f $$distname.tar.gz $$distname; \
	rm -fr $$distname

# Build a shar file
shar:	release tag configure gifmap.lsm gifmap.man gifmap.txt gifmap.html
	release=`cat release`; \
	distname=gifmap-$$release; \
	rm -fr $$distname; \
	mkdir $$distname; \
	for file in $(DISTFILES); do \
	  echo $$file; \
	done | cpio -pdlu $$distname ; \
	chmod -R a+rX $$distname; \
	shar --gzip $$distname > $$distname.shar; \
	rm -fr $$distname

