##############################################################################
##############################################################################
##
## FILE: Makefile
##
## SCCS ID: @(#) Makefile 1.4
##
## DESCRIPTION:
##	- This file contains the rules to build the overlay filesystem
##	  module.
##
## NOTES:
##	- if a package is needed for installing the software, set the prefix
##	  make variable to the name of an existing directory in order to
##	  install all files into that directory tree.  Then the makepkg, or
##	  equivalent command may be used to create a package.
##
##	- run "make all" to build the overlay filesystem module and the
##	  needed kernel lists module.
##
##	- run "make install" to install the modules:
##
##		$(prefix)/lib/module/<KERNEL VERSION>/fs/ovl.o
##		$(prefix)/lib/module/<KERNEL VERSION>/misc/klists.o
##
##	- run "make install_doc" to install the manual page and to install
##	  documents to the directory:
##
##		$(prefix)/usr/doc/ovlfs
##
##	- run "make clean" to cleanup.
##
##
## REVISION HISTORY:
##
## DATE		AUTHOR		DESCRIPTION
## ==========	===============	==============================================
## 03/08/1998	ARTHUR N.	Added to source code control.
## 03/11/1998	ARTHUR N.	Added the install_doc target.
## 03/11/1998	ARTHUR N.	Added more targets.
## 03/11/1998	ARTHUR N.	Added MAKEFLAGS to recursive makes.
##
##############################################################################
##############################################################################

DOC_INST_DIR=$(prefix)/usr/doc/ovlfs

LOG_FILES=\
	All.log \
	Doc.log \
	Install.log \
	Instdoc.log


.PHONY: all klists ovl doc tools install clean fresh \
        install_klists install_ovl install_doc install_doc_subdir \
        fresh_klists fresh_ovl \
        clean_klists clean_ovl clean_tools


##
## STANDARD TARGETS
##

all: klists ovl tools

install: install_klists install_ovl

clean: clean_klists clean_ovl clean_tools clean_local

fresh: fresh_klists fresh_ovl



##
## INSTALLATION
##

install_doc: install_doc_subdir
	@echo "Installing COPYING to $(DOC_INST_DIR)/"
	@/bin/cp COPYING $(DOC_INST_DIR)/COPYING



##
## CLEANUP
##

clean_local:
	@/bin/rm -f $(LOG_FILES)



##
## SUBDIRECTORY TARGETS
##
##	NOTE: I know that there are ways to consolidate these, but it is easier
##	      to read and maintain as is.
##

klists:
	@cd lists; $(MAKE) $(MAKEFLAGS)

ovl:
	@cd fs; $(MAKE) $(MAKEFLAGS)

doc:
	@cd doc; $(MAKE) $(MAKEFLAGS)

tools:
	@cd tools; $(MAKE) $(MAKEFLAGS)


install_klists:
	@cd lists; $(MAKE) $(MAKEFLAGS) install

install_ovl:
	@cd fs; $(MAKE) $(MAKEFLAGS) install

install_doc_subdir:
	@cd doc; $(MAKE) $(MAKEFLAGS) install


fresh_klists:
	@cd lists; $(MAKE) $(MAKEFLAGS) fresh

fresh_ovl:
	@cd lists; $(MAKE) $(MAKEFLAGS) fresh


clean_klists:
	@cd lists; $(MAKE) $(MAKEFLAGS) clean

clean_ovl:
	@cd fs; $(MAKE) $(MAKEFLAGS) clean

clean_tools:
	@cd tools; $(MAKE) $(MAKEFLAGS) clean
