# -*-makefile-*-
# JLdL 08Dec13.
#
# This makefile closes the "cluster-tools-server" package, as an
# _ "all" arch package; the main part of its structure is meant
# _ to install everything within the debian/package subdirectory.

# Edited for Debian GNU/Linux.
DESTDIR = 

# The package this makefile is meant for.
PACKAGE = cluster-tools-server

# Where the configuration file goes.
ETC = $(DESTDIR)/etc

# Where the user executables go.
CBIN = $(DESTDIR)/usr/bin

# Where the root executables go.
SBIN = $(DESTDIR)/usr/sbin

# Where the server library goes.
SLIB = $(DESTDIR)/usr/lib/cluster

# Where the man pages go.
MANS = $(DESTDIR)/usr/share/man

# Where the additional documentation goes.
DOCS = $(DESTDIR)/usr/share/doc/$(PACKAGE)

# The configuration files.
CONFFILES = \
cluster.conf \
cluster.aliases

# The user executables.
CBINFILES = \
cdsh \
cjobs \
cruptime

# The root executables.
SBINFILES = \
distribute-configs \
hard-link-common-files \
hard-link-packages \
make-new-netboot-node \
multi-apt-get \
multi-apt-get-chroot \
multi-apt-get-remote \
multi-crontab-chroot \
multi-dpkg \
multi-dpkg-chroot \
multi-dpkg-remote

# The server library.
SLIBFILES = \
hard-link-common-files.sub \
hard-link-exclusions.root \
hard-link-exclusions.var \
hard-link-exclusions.usr \
hard-link-packages.sub \
hard-link-required-exclusions.root \
hard-link-required-exclusions.var \
make-new-netboot-node.sub \
fake-var-run.README \
fake-var-yp-binding.README \
cluster.conf.client \
cluster.conf.server

# The user man pages.
MAN1FILES = \
cdsh.1.gz \
cjobs.1.gz \
cruptime.1.gz

# The file man pages.
MAN5FILES = \
cluster.conf.5.gz

# The description man pages.
MAN7FILES = \
cluster.7.gz

# The root man pages.
MAN8FILES = \
distribute-configs.8.gz \
hard-link-common-files.8.gz \
hard-link-packages.8.gz \
make-new-netboot-node.8.gz \
multi-apt-get.8.gz \
multi-apt-get-chroot.8.gz \
multi-apt-get-remote.8.gz \
multi-crontab-chroot.8.gz \
multi-dpkg.8.gz \
multi-dpkg-chroot.8.gz \
multi-dpkg-remote.8.gz

# Extra documentation files and directories.
DOCSFILES = \
debian/README.Debian \
config-library \
disk-sizes \
first-node \
kernel-configs \
kernel-patches \
package-lists \
WARNINGS \
PACKINST

default:
	@echo "Nothing to do: no actual compilation is needed."

# Install files on the server.
install: $(MAN1FILES) $(MAN5FILES) $(MAN7FILES) $(MAN8FILES)
	@echo Installing the configuration files in $(ETC)/
	@mkdir -p $(ETC)/
	@cp -pf $(CONFFILES) $(ETC)/
	@echo Installing user executables in $(CBIN)/
	@mkdir -p $(CBIN)/
	@cp -pf $(CBINFILES) $(CBIN)/
	@echo Installing root executables in $(SBIN)/
	@mkdir -p $(SBIN)/
	@cp -pf $(SBINFILES) $(SBIN)/
	@echo Installing the server library in $(SLIB)/
	@mkdir -p $(SLIB)/
	@cp -pf $(SLIBFILES) $(SLIB)/
	@echo Installing man pages in $(MANS)/man1/
	@mkdir -p $(MANS)/man1/
	@cp -pf $(MAN1FILES) $(MANS)/man1/
	@echo Installing man pages in $(MANS)/man5/
	@mkdir -p $(MANS)/man5/
	@cp -pf $(MAN5FILES) $(MANS)/man5/
	@echo Installing man pages in $(MANS)/man7/
	@mkdir -p $(MANS)/man7/
	@cp -pf $(MAN7FILES) $(MANS)/man7/
	@echo Installing man pages in $(MANS)/man8/
	@mkdir -p $(MANS)/man8/
	@cp -pf $(MAN8FILES) $(MANS)/man8/
	@echo Installing additional documentation in $(DOCS)/
	@mkdir -p $(DOCS)/
	@cp -af $(DOCSFILES) $(DOCS)/

# Make the package.
package:
	dpkg-buildpackage -kE92A1F5C

# Clean up this directory.
clean:
	rm -f *~

