# =========================================================================
# Copyright (c) 2003 Josh Glover <jmglov@jmglov.net>
#
# LICENCE:
#
#   This file is distributed under the terms of the BSD License, v2. See
#   the COPYING file, which should have been distributed with this file,
#   for details. If you did not receive the COPYING file, see:
#
#   http://www.jmglov.net/open-source/licences/bsd.txt
#
# Makefile
#
# DESCRIPTION:
#
#   Makefile for mkDoxy
#
# USAGE:
#
#   make {<macro> = <value>} {target}
#
#   Run 'make help' for a list of valid macros and targets.
#
# EXAMPLES:
#
#   make install
#
# DEPENDENCIES:
#
#   GNU Make
#
# TODO:
# 
#   - Nothing, this code is perfect
#  
# MODIFICATIONS:
#
#   Josh Glover <josh.glover@tfcci.com> (2003/11/18): Initial revision
# =========================================================================


# GNU Autotools-compatible path macros
#--------------------------------------------------------------------------

## Root destination directory, prepended to *all* macros in this section
DESTDIR =

## install architecture-independent files
PREFIX = /usr/local

## install architecture-dependent files
EPREFIX = $(PREFIX)

## user executables
BINDIR = $(EPREFIX)/bin

## system admin executables
SBINDIR = $(EPREFIX)/sbin

## program executables
LIBEXECDIR = $(EPREFIX)/libexec

## read-only architecture-independent data
DATADIR = $(PREFIX)/share

## read-only single-machine data
SYSCONFDIR = $(PREFIX)/etc

## modifiable architecture-independent data
SHAREDSTATEDIR = $(PREFIX)/com

## modifiable single-machine data
LOCALSTATEDIR = $(PREFIX)/var

## object code libraries
LIBDIR = $(EPREFIX)/lib

## C header files
INCLUDEDIR = $(PREFIX)/include

## C header files for non-gcc 
OLDINCLUDEDIR = /usr/include

## info documentation
INFODIR = $(PREFIX)/info

## man documentation
MANDIR = $(PREFIX)/man

#--------------------------------------------------------------------------


## Other path-related macros
#--------------------------------------------------------------------------

## Directory where distribution tarballs will be created
DISTDIR = $(TMPDIR)

## Temporary directory (used by dist: target)
TMPDIR = /tmp

#--------------------------------------------------------------------------


## Distribution files
#--------------------------------------------------------------------------

## Set to skip generation of gzip'd tarball
SKIP_TARGZ = 

## Set to skip generation of bzip2'd tarball
SKIP_TARBZ2 = 

#--------------------------------------------------------------------------


## Gentoo Portage-compatible package macros
#--------------------------------------------------------------------------

## The name of the package
PN = mkdoxy

## The version of the package
PV = $(VERSION)

## The name and version of the package
P = $(PN)-$(PV)

#--------------------------------------------------------------------------


## Programs
#--------------------------------------------------------------------------

## rsync binary
RSYNC = rsync

## GNU tar binary
TAR = tar

#--------------------------------------------------------------------------


## Internal OSS-DISK magic, alter at your own risk!
#--------------------------------------------------------------------------

## Determine the version by cat-ing the VERSION file
VERSION = `cat VERSION`

#--------------------------------------------------------------------------


## User-defined targets
#--------------------------------------------------------------------------

# Add any extra targets that your project requires here

#--------------------------------------------------------------------------


## Standard OSS-DISK targets
#--------------------------------------------------------------------------

## Does any compilation necessary
build :
#	Implement as applicable

## Builds a distribution tarball
dist : # Any pre-reqs? (e.g. clean)
	@ echo cp VERSION $(TMPDIR)/
	@ cp VERSION $(TMPDIR)/
	@ echo $(RSYNC) -Ca ./ $(TMPDIR)/$(P)
	@ $(RSYNC) -Ca ./ $(TMPDIR)/$(P)
	@ if [ -z $(SKIP_TARGZ) ]; then \
	  echo cd $(TMPDIR) \&\& \\; \
	  echo $(TAR) --exclude=CVS -czf $(DISTDIR)/$(P).tar.gz $(P); \
	  cd $(TMPDIR) && \
	  $(TAR) --exclude=CVS -czf $(DISTDIR)/$(P).tar.gz $(P); \
	fi
	@ echo rm -rf $(TMPDIR)/VERSION $(TMPDIR)/$(P)
	@ rm -rf $(TMPDIR)/VERSION $(TMPDIR)/$(P)

## Displays usage information
help :
	@ echo 'Usage: make {<macro> = <value>} {target}'
	@ echo
	@ echo '  where commonly-used macros are:'
	@ echo
	@ echo '    PREFIX = <path>  installation prefix'
	@ echo
	@ echo '  and valid targets are:'
	@ echo
	@ echo '    build      build / compile software'
	@ echo '    help       displays this usage message'
	@ echo '    install    install to $(PREFIX)'
	@ echo '    uninstall  uninstall from $(PREFIX)'

## Installs files to $(DESTDIR)/
## (see -GNU Autotools-compatible path macros-, above)
install :
	cp mkdoxy $(DESTDIR)$(BINDIR)/

## Uninstalls files from $(DESTDIR)/
## (see -GNU Autotools-compatible path macros-, above)
uninstall :
	rm $(DESTDIR)$(BINDIR)/mkdoxy
