| [210] | 1 | # $Id: Makefile 317 2012-04-25 21:33:53Z kdeugau $
 | 
|---|
| [114] | 2 | # DNS Admin makefile
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 | PKGNAME=dnsadmin
 | 
|---|
| [317] | 5 | VERSION=1.0.1
 | 
|---|
| [114] | 6 | RELEASE=1
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | # Include some boilerplate Gnu makefile definitions.
 | 
|---|
 | 9 | prefix = /usr/local
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | exec_prefix = ${prefix}
 | 
|---|
 | 12 | bindir = ${exec_prefix}/bin
 | 
|---|
 | 13 | libdir = ${exec_prefix}/lib
 | 
|---|
 | 14 | infodir = ${prefix}/info
 | 
|---|
 | 15 | includedir = ${prefix}/include
 | 
|---|
 | 16 | datadir = ${prefix}/share
 | 
|---|
 | 17 | localedir = $(datadir)/locale
 | 
|---|
 | 18 | sysconfdir = ${prefix}/etc
 | 
|---|
 | 19 | mandir = ${prefix}/man
 | 
|---|
 | 20 | 
 | 
|---|
| [220] | 21 | INSTALL = /usr/bin/install
 | 
|---|
| [114] | 22 | INSTALL_PROGRAM = ${INSTALL}
 | 
|---|
 | 23 | INSTALL_SCRIPT = ${INSTALL}
 | 
|---|
 | 24 | INSTALL_DATA = ${INSTALL} -m 644
 | 
|---|
 | 25 | INSTALLMODE= -m 0755
 | 
|---|
 | 26 | INSTALLMODE2 = -m 0555
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | DESTDIR =
 | 
|---|
 | 29 | 
 | 
|---|
| [219] | 30 | # flag to indicate if we install in a version-numbered location to
 | 
|---|
 | 31 | # support parallel installs (packaged or otherwise) or if we're
 | 
|---|
 | 32 | # installing to .../dnsdb/ (overwrite whatever was there last)
 | 
|---|
 | 33 | PARA_VERSIONS = 0
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | # also set the leaf directories we'll be putting things in
 | 
|---|
| [220] | 36 | PKG_LEAF = dnsdb
 | 
|---|
 | 37 | CFG_LEAF = dnsdb
 | 
|---|
| [219] | 38 | 
 | 
|---|
 | 39 | # tweak the final leaf directories we install to if PARA_VERSIONS is set
 | 
|---|
 | 40 | ifeq "$(PARA_VERSIONS)" "1"
 | 
|---|
| [220] | 41 | PKG_LEAF = dnsdb-$(VERSION)
 | 
|---|
 | 42 | CFG_LEAF = dnsdb/$(VERSION)
 | 
|---|
| [219] | 43 | endif
 | 
|---|
 | 44 | 
 | 
|---|
| [114] | 45 | MANIFEST = \
 | 
|---|
| [219] | 46 |         INSTALL COPYING TODO Makefile dnsadmin.spec \
 | 
|---|
| [114] | 47 |         \
 | 
|---|
| [263] | 48 |         new-dns.sql dns.sql dns.cgi dns-rpc.cgi DNSDB.pm vega-import.pl export.pl \
 | 
|---|
| [219] | 49 |         \
 | 
|---|
| [166] | 50 |         index.shtml \
 | 
|---|
| [114] | 51 |         \
 | 
|---|
 | 52 |         images/trash2.png images/fwd.png images/ffwd.png images/frev.png \
 | 
|---|
| [201] | 53 |         images/rev.png images/DESC.png images/ASC.png images/tree_open.png images/tree_closed.png \
 | 
|---|
| [114] | 54 |         \
 | 
|---|
| [166] | 55 |         templates/adddomain.tmpl templates/addgroup.tmpl templates/addrec.tmpl templates/adduser.tmpl \
 | 
|---|
 | 56 |         templates/axfr.tmpl templates/bulkchange.tmpl templates/bulkdomain.tmpl templates/dberr.tmpl \
 | 
|---|
 | 57 |         templates/deldom.tmpl templates/delgrp.tmpl templates/delrec.tmpl templates/deluser.tmpl \
 | 
|---|
 | 58 |         templates/dns.css templates/dnsq.tmpl templates/domlist.tmpl templates/edgroup.tmpl \
 | 
|---|
 | 59 |         templates/editsoa.tmpl templates/footer.tmpl templates/fpnla.tmpl templates/grouptree.css \
 | 
|---|
 | 60 |         templates/grouptree-ie.css templates/grpman.tmpl templates/grptree.tmpl templates/header.tmpl \
 | 
|---|
 | 61 |         templates/lettsearch.tmpl templates/login.tmpl templates/log.tmpl templates/menu.tmpl \
 | 
|---|
 | 62 |         templates/newdomain.tmpl templates/newgrp.tmpl templates/permlist_enabled.tmpl templates/permlist.tmpl \
 | 
|---|
 | 63 |         templates/pgcount.tmpl templates/reclist.tmpl templates/record.tmpl templates/sbox.tmpl \
 | 
|---|
 | 64 |         templates/soadata.tmpl templates/template.tmpl templates/updatesoa.tmpl templates/useradmin.tmpl \
 | 
|---|
| [216] | 65 |         templates/user.tmpl templates/whoisq.tmpl \
 | 
|---|
 | 66 |         \
 | 
|---|
 | 67 |         dnsdb.conf
 | 
|---|
| [114] | 68 | 
 | 
|---|
 | 69 | DIRS = \
 | 
|---|
 | 70 |         images templates
 | 
|---|
 | 71 | 
 | 
|---|
| [199] | 72 | IMAGES = \
 | 
|---|
 | 73 |         images/trash2.png images/fwd.png images/ffwd.png images/frev.png \
 | 
|---|
 | 74 |         images/rev.png images/DESC.png images/ASC.png
 | 
|---|
| [114] | 75 | 
 | 
|---|
 | 76 | SCRIPTS = \
 | 
|---|
| [263] | 77 |         dns.cgi dns-rpc.cgi vega-import.pl export.pl
 | 
|---|
| [114] | 78 | 
 | 
|---|
| [166] | 79 | MODULES = DNSDB.pm
 | 
|---|
| [114] | 80 | 
 | 
|---|
| [216] | 81 | TEMPLATES = \
 | 
|---|
 | 82 |         templates/adddomain.tmpl templates/addgroup.tmpl templates/addrec.tmpl templates/adduser.tmpl \
 | 
|---|
 | 83 |         templates/axfr.tmpl templates/bulkchange.tmpl templates/bulkdomain.tmpl templates/dberr.tmpl \
 | 
|---|
 | 84 |         templates/deldom.tmpl templates/delgrp.tmpl templates/delrec.tmpl templates/deluser.tmpl \
 | 
|---|
 | 85 |         templates/dns.css templates/dnsq.tmpl templates/domlist.tmpl templates/edgroup.tmpl \
 | 
|---|
 | 86 |         templates/editsoa.tmpl templates/footer.tmpl templates/fpnla.tmpl templates/grouptree.css \
 | 
|---|
 | 87 |         templates/grouptree-ie.css templates/grpman.tmpl templates/grptree.tmpl templates/header.tmpl \
 | 
|---|
 | 88 |         templates/lettsearch.tmpl templates/login.tmpl templates/log.tmpl templates/menu.tmpl \
 | 
|---|
 | 89 |         templates/newdomain.tmpl templates/newgrp.tmpl templates/permlist_enabled.tmpl templates/permlist.tmpl \
 | 
|---|
 | 90 |         templates/pgcount.tmpl templates/reclist.tmpl templates/record.tmpl templates/sbox.tmpl \
 | 
|---|
 | 91 |         templates/soadata.tmpl templates/template.tmpl templates/updatesoa.tmpl templates/useradmin.tmpl \
 | 
|---|
 | 92 |         templates/user.tmpl templates/whoisq.tmpl
 | 
|---|
| [114] | 93 | 
 | 
|---|
| [216] | 94 | CONFIGFILES = dnsdb.conf
 | 
|---|
 | 95 | 
 | 
|---|
| [114] | 96 | all:
 | 
|---|
 | 97 |         # nullop
 | 
|---|
 | 98 | 
 | 
|---|
 | 99 | install:
 | 
|---|
| [220] | 100 |         @mkdir -p $(DESTDIR)${datadir}/$(PKG_LEAF)/images
 | 
|---|
 | 101 |         @$(INSTALL_DATA) $(IMAGES) $(DESTDIR)${datadir}/$(PKG_LEAF)/images
 | 
|---|
 | 102 |         @mkdir -p $(DESTDIR)${datadir}/$(PKG_LEAF)/templates
 | 
|---|
 | 103 |         @$(INSTALL_DATA) $(TEMPLATES) $(DESTDIR)${datadir}/$(PKG_LEAF)/templates
 | 
|---|
| [216] | 104 |         @# munge in necessary 'use lib ...' bits so scripts can find libs and config...
 | 
|---|
 | 105 |         @# datadir is correct;  no arch-specific files
 | 
|---|
| [114] | 106 |         @for i in $(SCRIPTS) $(MODULES); do \
 | 
|---|
| [219] | 107 |                 $(INSTALL_SCRIPT) -D $$i $(DESTDIR)${datadir}/$(PKG_LEAF)/$$i ; \
 | 
|---|
 | 108 |                 perl -pi -e 's|use lib '.';     ##uselib##|use lib "${datadir}/$(PKG_LEAF)/";|;' $(DESTDIR)${datadir}/$(PKG_LEAF)/$$i ; \
 | 
|---|
 | 109 |                 perl -pi -e 's|use lib '.';     ##uselib##|use lib "${datadir}/$(PKG_LEAF)/";|;' $(DESTDIR)${datadir}/$(PKG_LEAF)/$$i ; \
 | 
|---|
| [114] | 110 |         done
 | 
|---|
| [219] | 111 |         @$(INSTALL) -d $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/
 | 
|---|
| [216] | 112 |         @# install an example config file with all known settings
 | 
|---|
 | 113 |         @for i in $(CONFIGFILES) ; do \
 | 
|---|
| [219] | 114 |                 if [ -e $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/$$i ]; then \
 | 
|---|
| [216] | 115 |                         echo "refusing to overwrite existing config file, created as $$i.new" ; \
 | 
|---|
| [219] | 116 |                         $(INSTALL_DATA) $$i $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/$$i.new ; \
 | 
|---|
| [216] | 117 |                 else \
 | 
|---|
| [219] | 118 |                         $(INSTALL_DATA) $$i $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/ ; \
 | 
|---|
 | 119 |                 fi ; \
 | 
|---|
 | 120 |                 perl -pi -e 's|"/etc/dnsdb";    ##CFG_LEAF##|"${sysconfdir}/$(CFG_LEAF)";|;' $(DESTDIR)${datadir}/$(PKG_LEAF)/DNSDB.pm ; \
 | 
|---|
| [114] | 121 |         done
 | 
|---|
| [199] | 122 | #       # and now munge MyDNSDB.pm so it can find the core library
 | 
|---|
 | 123 | #       perl -pi -e 's|##uselib##|use lib "${libdir}/dnsdb";|;' $(DESTDIR)${sysconfdir}/dnsdb/MyDNSDB.pm
 | 
|---|
| [114] | 124 | 
 | 
|---|
 | 125 | #clean:
 | 
|---|
 | 126 | #       @for i in $(DIRS) ; do \
 | 
|---|
 | 127 | #               $(MAKE) -C $$i clean ; \
 | 
|---|
 | 128 | #       done
 | 
|---|
 | 129 | 
 | 
|---|
 | 130 | dist:
 | 
|---|
 | 131 |         mkdir $(PKGNAME)-$(VERSION)
 | 
|---|
 | 132 |         tar cf - $(MANIFEST) | (cd $(PKGNAME)-$(VERSION); tar xf -)
 | 
|---|
| [219] | 133 |         /usr/bin/perl -p -e 's/#VERSION#/$(VERSION)/;s/#RELEASE#/$(RELEASE)/;s/#BETA#//g' < $(PKGNAME).spec > $(PKGNAME)-$(VERSION)/$(PKGNAME).spec
 | 
|---|
| [114] | 134 |         /usr/bin/perl -p -e 's/#VERSION#/$(VERSION)/;s/#RELEASE#/$(RELEASE)/;s/#BETA#//g' < INSTALL > $(PKGNAME)-$(VERSION)/INSTALL
 | 
|---|
| [199] | 135 |         perl -pi -e 's/[\d.]+;\s*##VERSION##/$(VERSION);/;' $(PKGNAME)-$(VERSION)/DNSDB.pm
 | 
|---|
| [114] | 136 |         tar cf $(PKGNAME)-$(VERSION).tar $(PKGNAME)-$(VERSION)
 | 
|---|
 | 137 |         gzip -v -f -9 $(PKGNAME)-$(VERSION).tar
 | 
|---|
 | 138 |         rm -rf $(PKGNAME)-$(VERSION)
 | 
|---|
| [263] | 139 |         gpg -a --detach-sign $(PKGNAME)-$(VERSION).tar.gz
 | 
|---|