| 1 | # $Id: Makefile 546 2013-12-11 20:31:44Z kdeugau $ | 
|---|
| 2 | # DNS Admin makefile | 
|---|
| 3 |  | 
|---|
| 4 | PKGNAME=dnsadmin | 
|---|
| 5 | VERSION=1.0.5 | 
|---|
| 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 |  | 
|---|
| 21 | INSTALL = /usr/bin/install | 
|---|
| 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 |  | 
|---|
| 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 | 
|---|
| 36 | PKG_LEAF = dnsdb | 
|---|
| 37 | CFG_LEAF = dnsdb | 
|---|
| 38 |  | 
|---|
| 39 | # tweak the final leaf directories we install to if PARA_VERSIONS is set | 
|---|
| 40 | ifeq "$(PARA_VERSIONS)" "1" | 
|---|
| 41 | PKG_LEAF = dnsdb-$(VERSION) | 
|---|
| 42 | CFG_LEAF = dnsdb/$(VERSION) | 
|---|
| 43 | endif | 
|---|
| 44 |  | 
|---|
| 45 | MANIFEST = \ | 
|---|
| 46 | INSTALL COPYING TODO Makefile dnsadmin.spec \ | 
|---|
| 47 | \ | 
|---|
| 48 | new-dns.sql dns.sql dns.cgi dns-rpc.cgi textrecs.cgi DNSDB.pm vega-import.pl export.pl \ | 
|---|
| 49 | \ | 
|---|
| 50 | index.shtml \ | 
|---|
| 51 | \ | 
|---|
| 52 | images/trash2.png images/fwd.png images/ffwd.png images/frev.png \ | 
|---|
| 53 | images/rev.png images/DESC.png images/ASC.png images/tree_open.png images/tree_closed.png \ | 
|---|
| 54 | \ | 
|---|
| 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/delloc.tmpl templates/delrec.tmpl \ | 
|---|
| 58 | templates/delrevzone.tmpl templates/deluser.tmpl \ | 
|---|
| 59 | templates/dns.css templates/dnsq.tmpl templates/domlist.tmpl templates/edgroup.tmpl \ | 
|---|
| 60 | templates/editsoa.tmpl templates/footer.tmpl templates/fpnla.tmpl templates/grouptree.css \ | 
|---|
| 61 | templates/grouptree-ie.css templates/grpman.tmpl templates/grptree.tmpl templates/header.tmpl \ | 
|---|
| 62 | templates/lettsearch.tmpl templates/login.tmpl templates/log.tmpl templates/menu.tmpl \ | 
|---|
| 63 | templates/newdomain.tmpl templates/newgrp.tmpl templates/permlist_enabled.tmpl templates/permlist.tmpl \ | 
|---|
| 64 | templates/pgcount.tmpl templates/reclist.tmpl templates/record.tmpl templates/sbox.tmpl \ | 
|---|
| 65 | templates/soadata.tmpl templates/template.tmpl templates/textrecs.tmpl templates/updatesoa.tmpl \ | 
|---|
| 66 | templates/useradmin.tmpl templates/user.tmpl templates/whoisq.tmpl \ | 
|---|
| 67 | \ | 
|---|
| 68 | dnsdb.conf | 
|---|
| 69 |  | 
|---|
| 70 | DIRS = \ | 
|---|
| 71 | images templates | 
|---|
| 72 |  | 
|---|
| 73 | IMAGES = \ | 
|---|
| 74 | images/trash2.png images/fwd.png images/ffwd.png images/frev.png \ | 
|---|
| 75 | images/rev.png images/DESC.png images/ASC.png | 
|---|
| 76 |  | 
|---|
| 77 | SCRIPTS = \ | 
|---|
| 78 | dns.cgi dns-rpc.cgi textrecs.cgi vega-import.pl export.pl | 
|---|
| 79 |  | 
|---|
| 80 | MODULES = DNSDB.pm | 
|---|
| 81 |  | 
|---|
| 82 | TEMPLATES = \ | 
|---|
| 83 | templates/adddomain.tmpl templates/addgroup.tmpl templates/addrec.tmpl templates/adduser.tmpl \ | 
|---|
| 84 | templates/axfr.tmpl templates/bulkchange.tmpl templates/bulkdomain.tmpl templates/dberr.tmpl \ | 
|---|
| 85 | templates/deldom.tmpl templates/delgrp.tmpl templates/delloc.tmpl templates/delrec.tmpl \ | 
|---|
| 86 | templates/delrevzone.tmpl templates/deluser.tmpl \ | 
|---|
| 87 | templates/dns.css templates/dnsq.tmpl templates/domlist.tmpl templates/edgroup.tmpl \ | 
|---|
| 88 | templates/editsoa.tmpl templates/footer.tmpl templates/fpnla.tmpl templates/grouptree.css \ | 
|---|
| 89 | templates/grouptree-ie.css templates/grpman.tmpl templates/grptree.tmpl templates/header.tmpl \ | 
|---|
| 90 | templates/lettsearch.tmpl templates/login.tmpl templates/log.tmpl templates/menu.tmpl \ | 
|---|
| 91 | templates/newdomain.tmpl templates/newgrp.tmpl templates/permlist_enabled.tmpl templates/permlist.tmpl \ | 
|---|
| 92 | templates/pgcount.tmpl templates/reclist.tmpl templates/record.tmpl templates/sbox.tmpl \ | 
|---|
| 93 | templates/soadata.tmpl templates/template.tmpl templates/textrecs.tmpl templates/updatesoa.tmpl \ | 
|---|
| 94 | templates/useradmin.tmpl templates/user.tmpl templates/whoisq.tmpl | 
|---|
| 95 |  | 
|---|
| 96 | CONFIGFILES = dnsdb.conf | 
|---|
| 97 |  | 
|---|
| 98 | all: | 
|---|
| 99 | # nullop | 
|---|
| 100 |  | 
|---|
| 101 | install: | 
|---|
| 102 | @mkdir -p $(DESTDIR)${datadir}/$(PKG_LEAF)/images | 
|---|
| 103 | @$(INSTALL_DATA) $(IMAGES) $(DESTDIR)${datadir}/$(PKG_LEAF)/images | 
|---|
| 104 | @mkdir -p $(DESTDIR)${datadir}/$(PKG_LEAF)/templates | 
|---|
| 105 | @$(INSTALL_DATA) $(TEMPLATES) $(DESTDIR)${datadir}/$(PKG_LEAF)/templates | 
|---|
| 106 | @# munge in necessary 'use lib ...' bits so scripts can find libs and config... | 
|---|
| 107 | @# datadir is correct;  no arch-specific files | 
|---|
| 108 | @for i in $(SCRIPTS) $(MODULES); do \ | 
|---|
| 109 | $(INSTALL_SCRIPT) -D $$i $(DESTDIR)${datadir}/$(PKG_LEAF)/$$i ; \ | 
|---|
| 110 | perl -pi -e 's|use lib '.';     ##uselib##|use lib "${datadir}/$(PKG_LEAF)/";|;' $(DESTDIR)${datadir}/$(PKG_LEAF)/$$i ; \ | 
|---|
| 111 | perl -pi -e 's|use lib '.';     ##uselib##|use lib "${datadir}/$(PKG_LEAF)/";|;' $(DESTDIR)${datadir}/$(PKG_LEAF)/$$i ; \ | 
|---|
| 112 | done | 
|---|
| 113 | @$(INSTALL) -d $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/ | 
|---|
| 114 | @# install an example config file with all known settings | 
|---|
| 115 | @for i in $(CONFIGFILES) ; do \ | 
|---|
| 116 | if [ -e $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/$$i ]; then \ | 
|---|
| 117 | echo "refusing to overwrite existing config file, created as $$i.new" ; \ | 
|---|
| 118 | $(INSTALL_DATA) $$i $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/$$i.new ; \ | 
|---|
| 119 | else \ | 
|---|
| 120 | $(INSTALL_DATA) $$i $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/ ; \ | 
|---|
| 121 | fi ; \ | 
|---|
| 122 | perl -pi -e 's|"/etc/dnsdb";    ##CFG_LEAF##|"${sysconfdir}/$(CFG_LEAF)";|;' $(DESTDIR)${datadir}/$(PKG_LEAF)/DNSDB.pm ; \ | 
|---|
| 123 | done | 
|---|
| 124 | #       # and now munge MyDNSDB.pm so it can find the core library | 
|---|
| 125 | #       perl -pi -e 's|##uselib##|use lib "${libdir}/dnsdb";|;' $(DESTDIR)${sysconfdir}/dnsdb/MyDNSDB.pm | 
|---|
| 126 |  | 
|---|
| 127 | #clean: | 
|---|
| 128 | #       @for i in $(DIRS) ; do \ | 
|---|
| 129 | #               $(MAKE) -C $$i clean ; \ | 
|---|
| 130 | #       done | 
|---|
| 131 |  | 
|---|
| 132 | dist: | 
|---|
| 133 | mkdir $(PKGNAME)-$(VERSION) | 
|---|
| 134 | tar cf - $(MANIFEST) | (cd $(PKGNAME)-$(VERSION); tar xf -) | 
|---|
| 135 | /usr/bin/perl -p -e 's/#VERSION#/$(VERSION)/;s/#RELEASE#/$(RELEASE)/;s/#BETA#//g' < $(PKGNAME).spec > $(PKGNAME)-$(VERSION)/$(PKGNAME).spec | 
|---|
| 136 | /usr/bin/perl -p -e 's/#VERSION#/$(VERSION)/;s/#RELEASE#/$(RELEASE)/;s/#BETA#//g' < INSTALL > $(PKGNAME)-$(VERSION)/INSTALL | 
|---|
| 137 | perl -pi -e 's/["\d.]+;\s*##VERSION##/"$(VERSION)";/;' $(PKGNAME)-$(VERSION)/DNSDB.pm | 
|---|
| 138 | tar cf $(PKGNAME)-$(VERSION).tar $(PKGNAME)-$(VERSION) | 
|---|
| 139 | gzip -v -f -9 $(PKGNAME)-$(VERSION).tar | 
|---|
| 140 | rm -rf $(PKGNAME)-$(VERSION) | 
|---|
| 141 | gpg -a --detach-sign $(PKGNAME)-$(VERSION).tar.gz | 
|---|