]> granicus.if.org Git - postgresql-autodoc/commitdiff
Dramatically simplify installation process (Thanks Simon Bertrang).
authorrbt <rbt>
Fri, 24 Apr 2009 03:46:28 +0000 (03:46 +0000)
committerrbt <rbt>
Fri, 24 Apr 2009 03:46:28 +0000 (03:46 +0000)
Complex installation checks have never been required so drop it and replace with simple
make functionality.

Targetting to a different installation prefix is done by setting the PREFIX variable:

make PREFIX=/some/new/home install

Makefile
config.mk.in [deleted file]
configure.ac [deleted file]

index fdddc1a5919ce64afa332d86ef0c6fc8b3732142..8b8508af640afe08081f3c06d62033261f84e83a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,87 +1,51 @@
-# $Header: /cvsroot/autodoc/autodoc/Makefile,v 1.3 2006/05/16 18:57:24 rbt Exp $
+# $Header: /cvsroot/autodoc/autodoc/Makefile,v 1.4 2009/04/24 03:46:28 rbt Exp $
 
+# install configuration
+DESTDIR =
+PREFIX = /usr/local
+BINDIR = ${PREFIX}/bin
+DATADIR = ${PREFIX}/share/postgresql_autodoc
+
+# build configuration
 TEMPLATES = dia.tmpl dot.tmpl html.tmpl neato.tmpl xml.tmpl zigzag.dia.tmpl
 BINARY = postgresql_autodoc
-CONFIGFILE = config.mk
-
-RELEASE_FILES = Makefile config.mk.in configure \
-                               configure.ac $(TEMPLATES) install-sh \
-                               postgresql_autodoc.pl
-
-cur-dir   := $(shell basename ${PWD})
-REAL_RELEASE_FILES = $(addprefix $(cur-dir)/,$(RELEASE_FILES))
-
-# Global dependencies
-ALWAYS_DEPEND = Makefile configure $(CONFIGFILE)
+SOURCE = ${BINARY}.pl
+RELEASE_FILES =        ${SOURCE} ${TEMPLATES}
 
+# system tools
+INSTALL_SCRIPT = $$(which install) -c
+PERL = $$(which perl)
+SED = $$(which sed)
 
-####
-# Test to see if $(CONFIGFILE) has been generated.  If so, include it. Otherwise we assume
-# it will be created for us.
-has_configmk := $(wildcard $(CONFIGFILE))
 
-ifeq ($(has_configmk),$(CONFIGFILE))
-include $(CONFIGFILE)
-endif
+all: ${BINARY}
 
-####
-# ALL
-.PHONY: all
-all: $(ALWAYS_DEPEND) $(BINARY)
+${BINARY}: ${SOURCE}
+       ${SED} -e "s,/usr/bin/env perl,${PERL}," \
+                       -e "s,@@TEMPLATE-DIR@@,${DATADIR}," \
+                ${SOURCE} > ${BINARY}
+       -chmod +x ${BINARY}
 
-####
-# Replace the /usr/bin/env perl with the supplied path
-# chmod to make testing easier
-$(BINARY): postgresql_autodoc.pl $(CONFIGFILE)
-       $(SED) -e "s,/usr/bin/env perl,$(PERL)," \
-                       -e "s,@@TEMPLATE-DIR@@,$(datadir)," \
-                postgresql_autodoc.pl > $(BINARY)
-       -chmod +x $(BINARY)
-
-####
-# INSTALL Target
-.PHONY: install uninstall
-install: all $(ALWAYS_DEPEND)
-       $(INSTALL_SCRIPT) -d $(bindir)
-       $(INSTALL_SCRIPT) -d $(datadir)
-       $(INSTALL_SCRIPT) -m 755 $(BINARY) $(bindir)
-       for entry in $(TEMPLATES) ; \
-               do $(INSTALL_SCRIPT) -m 644 $${entry} $(datadir) ; \
+install: all
+       ${INSTALL_SCRIPT} -d ${DESTDIR}${BINDIR}
+       ${INSTALL_SCRIPT} -d ${DESTDIR}${DATADIR}
+       ${INSTALL_SCRIPT} -m 755 ${BINARY} ${DESTDIR}${BINDIR}
+       for entry in ${TEMPLATES} ; \
+               do ${INSTALL_SCRIPT} -m 644 $${entry} ${DESTDIR}${DATADIR} ; \
        done
 
 uninstall:
-       -$(RM) $(bindir)/$(BINARY)
-       for entry in $(TEMPLATES) ; \
-               do $(RM) $(datadir)/$${entry} ; \
+       -rm ${DESTDIR}${BINDIR}/${BINARY}
+       -for entry in ${TEMPLATES} ; \
+               do rm ${DESTDIR}${DATADIR}/$${entry} ; \
        done
-       -rmdir $(datadir)
-       -rmdir $(bindir)
-
-####
-# CLEAN / DISTRIBUTION-CLEAN / MAINTAINER-CLEAN Targets
-.PHONY: clean
-clean: $(ALWAYS_DEPEND)
-       $(RM) $(BINARY)
+       -rmdir ${DESTDIR}${DATADIR}
+       -rmdir ${DESTDIR}${BINDIR}
 
-.PHONY: distribution-clean distclean
-distribution-clean distclean: clean
-       $(RM) $(CONFIGFILE) config.log config.status
-       $(RM) -r autom4te.cache
-       $(RM) $(patsubst %.tmpl,*.%,$(wildcard *.tmpl))
+clean:
+       rm -f ${BINARY}
 
-.PHONY: maintainer-clean
-maintainer-clean: distribution-clean
-       $(RM) configure
-
-####
-# Build a release
-#
-#      Clean
-#      Ensure configure is up to date
-#      Commit any pending elements
-#      Tar up the results
-.PHONY: release
-release: distribution-clean configure $(RELEASE_FILES)
+release: clean ${RELEASE_FILES}
        @if [ -z ${VERSION} ] ; then \
                echo "-------------------------------------------"; \
                echo "VERSION needs to be specified for a release"; \
@@ -90,14 +54,7 @@ release: distribution-clean configure $(RELEASE_FILES)
        fi
        cvs2cl
        -cvs commit
-       cd ../ && tar -czvf postgresql_autodoc-${VERSION}.tar.gz $(REAL_RELEASE_FILES)
-
-####
-# Build and Run configure files when configure or a template is updated.
-configure: configure.ac
-       autoconf
+       dir=$${pwd) && cd .. && tar -czvf postgresql_autodoc-${VERSION}.tar.gz \
+               -C $${dir} ${RELEASE_FILES}
 
-# Fix my makefile, then execute myself
-$(CONFIGFILE) : config.mk.in configure
-       ./configure
-       $(MAKE) $(MAKEFLAGS)
+.PHONY: install uninstall clean release
diff --git a/config.mk.in b/config.mk.in
deleted file mode 100644 (file)
index e56ec83..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-SHELL = /bin/sh
-VPATH = @srcdir@
-
-# Configure replacements
-INSTALL_SCRIPT = @INSTALL@
-PERL = @PERL@
-SED = @SED@
-
-# installation directories
-prefix = @prefix@
-exec_prefix= @exec_prefix@
-bindir = @bindir@
-datadir = @datarootdir@/postgresql_autodoc
diff --git a/configure.ac b/configure.ac
deleted file mode 100644 (file)
index 7af2abe..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-AC_PREREQ(2.53)
-AC_REVISION($Header: /cvsroot/autodoc/autodoc/Attic/configure.ac,v 1.2 2007/01/02 13:53:19 rbt Exp $)
-AC_INIT(postgresql_autodoc.pl)
-
-
-# Programs
-AC_PROG_INSTALL
-
-AC_PATH_PROGS([SED], [sed], ,
-             [$PATH:/bin:/usr/bin])
-
-# Check for Perl
-AC_ARG_WITH(perl-prefix,
-       [  --with-perl-prefix      Location of Perl],
-       PERLPATH=$withval,
-       PERLPATH="")
-
-if ( test -n "$PERLPATH" -a "`echo $PERLPATH | cut -c-3`" = "../" ); then
-       PERLPATH="$PWD/$PERLPATH"
-fi
-
-PERL=""
-if ( test -n "$PERLPATH" ); then
-       AC_CHECK_FILE("$PERLPATH/bin/perl",PERL="$PERLPATH/bin/perl")
-else
-       AC_PATH_PROGS([PERL], [perl], ,
-                 [$PATH:/usr/bin:/usr/local/bin:/usr/pkg/bin:/usr/local/perl/bin:/opt/sfw/bin])
-fi
-if ( test -z "$PERL" ); then
-       AC_MSG_ERROR("Perl is required")
-fi
-AC_SUBST(PERL)
-
-
-# Check that Perl Libraries are available:
-#      DBI
-#      DBD::Pg
-#      Fcntl
-#      HTML::Template
-#      Term::ReadKey
-#
-# Output of if test redirected to /dev/null to keep quiet
-for module in DBI DBD::Pg Fcntl HTML::Template Term::ReadKey ; do
-       AC_MSG_CHECKING(${module})
-       if [ ! (${PERL} -e "use ${module}" 2>&1 /dev/null ) ]; then
-               AC_MSG_RESULT(no)
-               AC_MSG_ERROR(Perl module ${module} is required)
-       else
-               AC_MSG_RESULT(yes)
-       fi
-done
-
-
-AC_OUTPUT([
-config.mk
-])