##############################################################################
##############################################################################
##
## FILE: Makefile
##
## SCCS ID: @(#) Makefile 1.3
##
## DESCRIPTION:
##	- This file contains the dependencies and build rules for the
##	  documentation for the overlay filesystem.
##
## NOTES:
##	- run "make all" to build the overlay filesystem manual page.
##
##	- run "make install" to put the ovl.8 file, and the ovlfs.8 link, into
##	  the directory, $(prefix)/usr/man/man8.
##
##
## REVISION HISTORY:
##
## DATE		AUTHOR		DESCRIPTION
## ==========	===============	==============================================
## 03/09/1998	ARTHUR N.	Added to source code control.
## 03/10/1998	ARTHUR N.	Added the Troubleshooting file to the list of
##				 files to be installed.
## 03/11/1998	ARTHUR N.	Make installation directories.
##
##############################################################################
##############################################################################

##
## MACRO DEFINITIONS
##

M4=/usr/bin/m4

DOC_FILES=\
	Author \
	Description \
	Options \
	Readme \
	Support \
	Troubleshooting \
	Version \
	ovl.8

SRC_FILES=\
	ovl.m

MAN_FILES=\
	ovl.8


## Intallation directories:

MAN8_INST_DIR=$(prefix)/usr/man/man8
DOC_INST_DIR=$(prefix)/usr/doc/ovlfs


##############################################################################
##############################################################################
##
## DEFAULT TARGETS
##

.PHONY: all fresh install

all:	$(MAN_FILES)

fresh:	clean all



##############################################################################
##############################################################################
##
## MAN PAGE TARGETS
##

ovl.8: ovl.m
	@echo "Compiling $@"
	@$(M4) ovl.m >ovl.8.new
	@/bin/mv ovl.8.new ovl.8



##############################################################################
##############################################################################
##
## MISCELLANEOUS TARGETS
##
## NOTE: Do not remove the existing manual pages on "clean" because the user
##       may not have m4 to create a new one.
##

clean:
	@/bin/rm -f ovl.8.new

install:
	@echo "Installing ovl.8 to $(MAN8_INST_DIR)"
	@/bin/mkdir -p $(MAN8_INST_DIR)
	@/bin/cp ovl.8 $(MAN8_INST_DIR)/ovl.8
	@/bin/rm -f $(MAN8_INST_DIR)/ovlfs.8
	@/bin/ln $(MAN8_INST_DIR)/ovl.8 $(MAN8_INST_DIR)/ovlfs.8
	@echo "Installing $(DOC_FILES) to $(DOC_INST_DIR)"
	@/bin/mkdir -p $(DOC_INST_DIR)
	@/bin/cp $(DOC_FILES) $(DOC_INST_DIR)/



##############################################################################
##############################################################################
##
## Suffixes
##

.SUFFIXES: .m .8

.m.8:
	@echo "Compiling $*.8"
	@$(M4) $*.m >$*.8.new
	@/bin/mv $*.8.new $*.8
