# $Id: Makefile 649 2014-06-23 21:52:37Z kdeugau $ # DNS Admin makefile PKGNAME=dnsadmin VERSION=1.2.3 RELEASE=1 # Include some boilerplate Gnu makefile definitions. prefix = /usr/local exec_prefix = ${prefix} bindir = ${exec_prefix}/bin libdir = ${exec_prefix}/lib infodir = ${prefix}/info includedir = ${prefix}/include datadir = ${prefix}/share localedir = $(datadir)/locale sysconfdir = ${prefix}/etc mandir = ${prefix}/man INSTALL = /usr/bin/install INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALLMODE= -m 0755 INSTALLMODE2 = -m 0555 DESTDIR = # flag to indicate if we install in a version-numbered location to # support parallel installs (packaged or otherwise) or if we're # installing to .../dnsdb/ (overwrite whatever was there last) PARA_VERSIONS = 0 # also set the leaf directories we'll be putting things in PKG_LEAF = dnsdb CFG_LEAF = dnsdb # tweak the final leaf directories we install to if PARA_VERSIONS is set ifeq "$(PARA_VERSIONS)" "1" PKG_LEAF = dnsdb-$(VERSION) CFG_LEAF = dnsdb/$(VERSION) endif MANIFEST = \ INSTALL COPYING TODO Makefile dnsadmin.spec \ \ dns.sql dns-1.0-1.2.sql dns-1.2.3-1.2.4.sql \ \ $(SCRIPTS) $(MODULES) \ \ index.shtml \ \ $(IMAGES) \ \ $(TEMPLATES) \ \ dnsdb.conf DIRS = \ images templates IMAGES = \ images/ASC.png images/DESC.png \ images/ffwd.png images/frev.png images/fwd.png images/rev.png \ images/trash2.png \ images/tree_closed.png images/tree_open.png SCRIPTS = \ compact-recs.pl dns.cgi dns-rpc.cgi dns-rpc.fcgi export.pl mergerecs textrecs.cgi tiny-import.pl \ vega-import.pl MODULES = DNSDB.pm TEMPLATES = \ templates/adddomain.tmpl templates/addgroup.tmpl templates/addrec.tmpl templates/addrevzone.tmpl \ templates/adduser.tmpl templates/axfr.tmpl templates/badpage.tmpl templates/bulkchange.tmpl \ templates/bulkdomain.tmpl templates/bulkrev.tmpl templates/confirmbulk.tmpl templates/dberr.tmpl \ templates/deldom.tmpl templates/delgrp.tmpl templates/delloc.tmpl templates/delrec.tmpl \ templates/delrevzone.tmpl templates/deluser.tmpl templates/dns.css templates/dnsq.tmpl \ templates/domlist.tmpl templates/edgroup.tmpl templates/editsoa.tmpl templates/footer.tmpl \ templates/fpnla.tmpl templates/grouptree.css templates/grouptree-ie.css templates/grpman.tmpl \ templates/grptree.tmpl templates/header.tmpl templates/lettsearch.tmpl templates/location.tmpl \ templates/loclist.tmpl templates/login.tmpl templates/log.tmpl templates/menu.tmpl \ templates/msgblock.tmpl templates/newdomain.tmpl templates/newgrp.tmpl templates/newrevzone.tmpl \ templates/permlist.tmpl templates/pgcount.tmpl templates/reclist.tmpl templates/record.tmpl \ templates/revzones.tmpl templates/sbox.tmpl templates/soadata.tmpl templates/template.tmpl \ templates/textrecs.tmpl templates/updatesoa.tmpl templates/useradmin.tmpl templates/user.tmpl \ templates/whoisq.tmpl templates/widgets.js CONFIGFILES = dnsdb.conf all: # nullop install: @mkdir -p $(DESTDIR)${datadir}/$(PKG_LEAF)/images @$(INSTALL_DATA) $(IMAGES) $(DESTDIR)${datadir}/$(PKG_LEAF)/images @mkdir -p $(DESTDIR)${datadir}/$(PKG_LEAF)/templates @$(INSTALL_DATA) $(TEMPLATES) $(DESTDIR)${datadir}/$(PKG_LEAF)/templates @# munge in necessary 'use lib ...' bits so scripts can find libs and config... @# datadir is correct; no arch-specific files @for i in $(SCRIPTS) $(MODULES); do \ $(INSTALL_SCRIPT) -D $$i $(DESTDIR)${datadir}/$(PKG_LEAF)/$$i ; \ perl -pi -e "s|use lib '.';\s+##uselib##|use lib '${datadir}/$(PKG_LEAF)/';|;" $(DESTDIR)${datadir}/$(PKG_LEAF)/$$i ; \ done @$(INSTALL) -d $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/ @# install an example config file with all known settings @for i in $(CONFIGFILES) ; do \ if [ -e $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/$$i ]; then \ echo "refusing to overwrite existing config file, created as $$i.new" ; \ $(INSTALL_DATA) $$i $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/$$i.new ; \ else \ $(INSTALL_DATA) $$i $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/ ; \ fi ; \ perl -pi -e 's|"/etc/dnsdb/dnsdb.conf",\s+##CFG_LEAF##|"${sysconfdir}/$(CFG_LEAF)/dnsdb.conf",|;' $(DESTDIR)${datadir}/$(PKG_LEAF)/DNSDB.pm ; \ done #clean: # @for i in $(DIRS) ; do \ # $(MAKE) -C $$i clean ; \ # done dist: mkdir $(PKGNAME)-$(VERSION) tar cf - $(MANIFEST) | (cd $(PKGNAME)-$(VERSION); tar xf -) /usr/bin/perl -p -e 's/#VERSION#/$(VERSION)/;s/#RELEASE#/$(RELEASE)/;s/#BETA#//g' < $(PKGNAME).spec > $(PKGNAME)-$(VERSION)/$(PKGNAME).spec /usr/bin/perl -p -e 's/#VERSION#/$(VERSION)/;s/#RELEASE#/$(RELEASE)/;s/#BETA#//g' < INSTALL > $(PKGNAME)-$(VERSION)/INSTALL perl -pi -e 's/["\d.]+;\s*##VERSION##/"$(VERSION)";/;' $(PKGNAME)-$(VERSION)/DNSDB.pm tar cf $(PKGNAME)-$(VERSION).tar $(PKGNAME)-$(VERSION) gzip -v -f -9 $(PKGNAME)-$(VERSION).tar rm -rf $(PKGNAME)-$(VERSION) gpg -a --detach-sign $(PKGNAME)-$(VERSION).tar.gz