# $Progeny$

.POSIX:

VPATH=			@srcdir@
builddir=		@builddir@
abs_builddir=		@abs_builddir@
top_builddir=		@top_builddir@
abs_top_builddir=	@abs_top_builddir@
srcdir=			@srcdir@
abs_srcdir=		@abs_srcdir@
top_srcdir=		@top_srcdir@
abs_top_srcdir=		@abs_top_srcdir@

prefix=			@prefix@
exec_prefix=		@exec_prefix@
bindir=			@bindir@

INSTALL=		@INSTALL@
INSTALL_DIR=		@INSTALL_DIR@

INSTALL_SCRIPT=		${INSTALL} -m 555

CONFIG_SCRIPT=		@PROGENY_CONFIG_SCRIPT_NAME@

UNINSTALL_FILE=	@UNINSTALL_FILE@
UNINSTALL_DIR=	@UNINSTALL_DIR@

all: ${CONFIG_SCRIPT}

###############################################################################
# Build

all: ${CONFIG_SCRIPT}

${CONFIG_SCRIPT}: config-script config-script.refentry
	${INSTALL} config-script $@

config-script.refentry: ${top_srcdir}/configure.ac config-script.m4
	cp config-script.refentry.gen $@

###############################################################################
# Clean

ifdef CONFIG_SCRIPT
clean_FILES=		${CONFIG_SCRIPT}
distclean_FILES=	Makefile config-script config-script.refentry	\
			show-config config-script.refentry.gen
else
clean_FILES=
distclean_FILES=	Makefile
endif

clean:
	rm -f ${clean_FILES}

distclean:
	rm -rf ${clean_FILES} ${distclean_FILES}

maintainer-clean:
	rm -rf ${clean_FILES} ${distclean_FILES}

###############################################################################
# Installation

install: ${CONFIG_SCRIPT}
	${INSTALL_DIR} ${DESTDIR}${bindir}
ifdef CONFIG_SCRIPT
	${INSTALL_SCRIPT} ${CONFIG_SCRIPT} ${DESTDIR}${bindir}/${CONFIG_SCRIPT}
endif

uninstall:
ifdef CONFIG_SCRIPT
	${UNINSTALL_FILE} ${DESTDIR}${bindir}/${CONFIG_SCRIPT}
endif
	if /usr/bin/test -d ${DESTDIR}${bindir}; then \
		${UNINSTALL_DIR} ${DESTDIR}${bindir}; \
	fi

###############################################################################
# Distribution

PACKAGE_TARNAME=	@PACKAGE_TARNAME@
PACKAGE_VERSION=	@PACKAGE_VERSION@

distname=		${PACKAGE_TARNAME}-${PACKAGE_VERSION}
distdir=		${top_builddir}/${distname}

DISTFILES=		Makefile.in \
			README \
			check.m4 \
			config-script-mkdoc \
			config-script.in \
			config-script.m4 \
			config-script.refentry \
			config.guess \
			config.sub \
			config.rpath \
			dist \
			distcheck \
			distdir \
			gettext.h \
			gettext.m4 \
			install-sh \
			libtool.m4 \
			ltmain.sh \
			setup \
			show-config.in \
			show-config.m4 \
			build.mk \
			recur.mk

distdir: ${DISTFILES}
	${top_srcdir}/buildtools/distdir ${distdir}/${_THISDIR_} ${DISTFILES}
