###########################################################################
#
# $Id: Makefile.dist,v 2.4 2002/02/25 20:34:56 peters Exp $
#
# Graft Makefile
#
###########################################################################
#
# Version number. Don't change this.

VERSION		= 2.4

###########################################################################
#
# User configurable options. Don't put any whitespace after the values.
# GNU make seems to pick up the whitespace as part of the value and
# this will put incorrect values into the generated files.

# The default package installation and target directories. For your
# particular environment you will set the PACKAGEDIR to the directory
# in which you'll be installing packages and the TARGETDIR to the
# directory in which you'll be grafting those packages. For example, if
# you will be installing packages in /pkgs and grafting them into
# /usr/local, set the variables as:
#
#	PACKAGEDIR	= /pkgs
#	TARGETDIR	= /usr/local
#
# These values can be overridden on the command line in a
# number of ways. See the man page and the documentation in
# doc/graft.{html,pdf,ps,txt}.

PACKAGEDIR	= %%GRAFT_PACKAGEDIR%%
TARGETDIR	= %%GRAFT_TARGETDIR%%

# You should only need to change the value of TOP to reflect the
# installation directory for graft if it is different from your default
# package installation directory as specified by PACKAGEDIR above. The
# other directories should be relative to TOP. If you want to change
# these values, you may be confused about what graft is for. Please
# re-read the documentation in doc/graft.{html,pdf,ps,txt}.

TOP		= %%PREFIX%%
BIN		= $(TOP)/bin
MAN		= %%MANPREFIX%%/man
DOC		= %%DOCSDIR%%

# The final grafted location of perl. See the bootstrap section in
# the documentation in doc/graft.{html,pdf,ps,txt}. This value will be
# patched into the graft executable. So if you set
#
#	PERL	= /usr/bin/perl
#
# then the first line of the graft executable will be
#
#	#!/usr/bin/perl -w

PERL		= %%PERL%%

# The location of the perl executable used to build the graft
# executable. You'll need to change this only if you do not have a fixed
# location for the perl executable and you plan on grafting in your
# own version of perl. See the bootstrap section in the documentation
# in doc/graft.{html,pdf,ps,txt}.

BUILDPERL	= $(PERL)

# The graft log file. All of graft's actions will be logged in this file.
# If you don't want any logging, set this to /dev/null.

LOGFILE		= %%GRAFT_LOGFILE%%

# The names of the special graft control files. GRAFT-IGNORE controls
# the exclusion of subdirectories, GRAFT-EXCLUDE controls the exclusion
# of individual files and/or directories and GRAFT-INCLUDE controls the
# inclusion of individual files and/or directories.

GRAFT-IGNORE	= .nograft
GRAFT-EXCLUDE	= .graft-exclude
GRAFT-INCLUDE	= .graft-include

# The names of files and/or directories that graft may automatically
# ignore. Typically these are directories containing files that should
# never be grafted. Examples include source code repository directories
# such as CVS, RCS and SCCS or lock files. There should only be whitespace
# between the filenames.  Wildcards are not supported. For example
#
# GRAFT-NEVER	= CVS RCS SCCS lib libexec .lock
#
# The default implementation ships with an empty value.

GRAFT-NEVER	=

# Should graft always ignore the files and directories specified by the
# value of GRAFT-NEVER above? If this flag is set to 0, graft will only
# ignore these files and directories if the -C option is specified. If
# this value is set to 1, graft will always ignore these files and
# directories unless the -C option is specified. This whole concept
# is overridden by the presence of the presence of $(GRAFT-IGNORE)
# or $(GRAFT-INCLUDE) files.

NEVERGRAFT	= 0
#NEVERGRAFT	= 1

# The suffix used when pruning files. Pruned files will be renamed as
# file.$(PRUNED-SUFFIX).

PRUNED-SUFFIX	= .pruned

# Is superuser access required to install/delete/prune packages? If you
# are installing your own private copy of graft to manage packages in
# your home directory, set this value to 0. If you're using graft to
# manage a global set of packages, superuser access should be enabled.
# If you set SUPERUSER to 1 it can be overridden on the command line
# so that graft can be used by ordinary users to manage their own
# package repositories.

SUPERUSER	= 1
#SUPERUSER	= 0

# When graft creates new directories, it can either create them with
# the superuser's user id and group id with modes 755 or it can preserve
# the original directories user id, group id and modes. This only
# applies if SUPERUSER is set to 1 above.
# 0 for NO, 1 for YES.

PRESERVEPERMS	= 0
#PRESERVEPERMS	= 1

# When graft deletes symbolic links it may leave target directories
# empty. Should it remove these directories? When used in prune mode,
# should graft remove any conflicting objects it finds?
# 0 for NO, 1 for YES. NO is the safer option.

DELETEOBJECTS	= 0
#DELETEOBJECTS	= 1

# End of user configurable section. There should be no need to change
# anything below this point.
#
###########################################################################

PROGS		= \
		graft

MANUALS		= \
		graft.1

DOCS		= \
		graft.html	\
		graft.pdf	\
		graft.ps	\
		graft.txt

DIST		=						\
		graft-$(VERSION)/CHANGES			\
		graft-$(VERSION)/COPYING			\
		graft-$(VERSION)/Makefile.dist			\
		graft-$(VERSION)/README				\
		graft-$(VERSION)/THOUGHTS			\
		graft-$(VERSION)/contrib/README			\
		graft-$(VERSION)/contrib/graftBootStrap.sh	\
		graft-$(VERSION)/doc/graft.html			\
		graft-$(VERSION)/doc/graft.pdf			\
		graft-$(VERSION)/doc/graft.ps			\
		graft-$(VERSION)/doc/graft.txt			\
		graft-$(VERSION)/graft.1			\
		graft-$(VERSION)/graft.pl

RM		= rm -f

###########################################################################

all:		Makefile $(PROGS)

clean:
		$(RM) $(PROGS)

manuals:
		for i in $(MANUALS);					\
		do							\
		    manpage=`basename $$i`;				\
		    man=`expr $$i : '.*\.\(.\)'`;			\
		    mkdir -p $(MAN)/man$$man;				\
		    sed							\
			-e 's#xDELETEOBJECTSx#$(DELETEOBJECTS)#g'	\
			-e 's#xGRAFT-EXCLUDEx#$(GRAFT-EXCLUDE)#g'	\
			-e 's#xGRAFT-IGNOREx#$(GRAFT-IGNORE)#g'		\
			-e 's#xGRAFT-INCLUDEx#$(GRAFT-INCLUDE)#g'	\
			-e 's#xGRAFT-NEVERx#$(GRAFT-NEVER)#g'		\
			-e 's#xLOGFILEx#$(LOGFILE)#g'			\
			-e 's#xNEVERGRAFTx#$(NEVERGRAFT)#g'		\
			-e 's#xPACKAGEDIRx#$(PACKAGEDIR)#g'		\
			-e 's#xPRESERVEPERMSx#$(PRESERVEPERMS)#g'	\
			-e 's#xPRUNED-SUFFIXx#$(PRUNED-SUFFIX)#g'	\
			-e 's#xSUPERUSERx#$(SUPERUSER)#g'		\
			-e 's#xTARGETDIRx#$(TARGETDIR)#g'		\
			-e 's#xVERSIONx#$(VERSION)#g'			\
			< $$i > $(MAN)/man$$man/$$manpage;		\
		    chmod 644 $(MAN)/man$$man/$$manpage;		\
		done

docs:
		for i in $(DOCS);			\
		do					\
		    mkdir -p $(DOC);			\
		    cp doc/$$i $(DOC);			\
		    chmod 644 $(DOC)/$$i;		\
		done

bin:		all
		@mkdir -p $(BIN)
		cp $(PROGS) $(BIN)

install:	bin manuals docs

archive:
		@$(RM) ../graft-$(VERSION).tar ../graft-$(VERSION).tar.gz
		@cd .. ; tar cvf graft-$(VERSION).tar graft-$(VERSION)
		@gzip ../graft-$(VERSION).tar

dist:
		@$(RM) ../graft-$(VERSION).tar ../graft-$(VERSION).tar.gz
		@cd .. ; tar cvf graft-$(VERSION).tar $(DIST)
		@gzip ../graft-$(VERSION).tar

graft:		graft.pl Makefile
		$(BUILDPERL) -wc graft.pl
		sed						\
		    -e 's#xDELETEOBJECTSx#$(DELETEOBJECTS)#g'	\
		    -e 's#xGRAFT-EXCLUDEx#$(GRAFT-EXCLUDE)#g'	\
		    -e 's#xGRAFT-IGNOREx#$(GRAFT-IGNORE)#g'	\
		    -e 's#xGRAFT-INCLUDEx#$(GRAFT-INCLUDE)#g'	\
		    -e 's#xGRAFT-NEVERx#$(GRAFT-NEVER)#g'	\
		    -e 's#xLOGFILEx#$(LOGFILE)#g'		\
		    -e 's#xNEVERGRAFTx#$(NEVERGRAFT)#g'		\
		    -e 's#xPACKAGEDIRx#$(PACKAGEDIR)#g'		\
		    -e 's#xPERLx#$(PERL)#g'			\
		    -e 's#xPRESERVEPERMSx#$(PRESERVEPERMS)#g'	\
		    -e 's#xPRUNED-SUFFIXx#$(PRUNED-SUFFIX)#g'	\
		    -e 's#xSUPERUSERx#$(SUPERUSER)#g'		\
		    -e 's#xTARGETDIRx#$(TARGETDIR)#g'		\
		    < graft.pl > graft
		chmod +x graft
		$(BUILDPERL) -wc graft

Makefile:	Makefile.dist
		cp Makefile.dist Makefile
		chmod 644 Makefile
		@echo
		@echo "######################################################"
		@echo "#                                                    #"
		@echo "#       You'll now need to modify the Makefile       #"
		@echo "#      variables to suit your local conditions.      #"
		@echo "#                                                    #"
		@echo "######################################################"
		@echo
		@false


syntax highlighted by Code2HTML, v. 0.9.1