| 1 | # $Id: Makefile 262 2012-03-04 22:53:54Z kdeugau $
 | 
|---|
| 2 | # DNS Admin makefile
 | 
|---|
| 3 | 
 | 
|---|
| 4 | PKGNAME=dnsadmin
 | 
|---|
| 5 | VERSION=1.0
 | 
|---|
| 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 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/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 \
 | 
|---|
| 65 |         templates/user.tmpl templates/whoisq.tmpl \
 | 
|---|
| 66 |         \
 | 
|---|
| 67 |         dnsdb.conf
 | 
|---|
| 68 | 
 | 
|---|
| 69 | DIRS = \
 | 
|---|
| 70 |         images templates
 | 
|---|
| 71 | 
 | 
|---|
| 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
 | 
|---|
| 75 | 
 | 
|---|
| 76 | SCRIPTS = \
 | 
|---|
| 77 |         dns.cgi dns-rpc.cgi vega-import.pl export.pl
 | 
|---|
| 78 | 
 | 
|---|
| 79 | MODULES = DNSDB.pm
 | 
|---|
| 80 | 
 | 
|---|
| 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
 | 
|---|
| 93 | 
 | 
|---|
| 94 | CONFIGFILES = dnsdb.conf
 | 
|---|
| 95 | 
 | 
|---|
| 96 | all:
 | 
|---|
| 97 |         # nullop
 | 
|---|
| 98 | 
 | 
|---|
| 99 | install:
 | 
|---|
| 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
 | 
|---|
| 104 |         @# munge in necessary 'use lib ...' bits so scripts can find libs and config...
 | 
|---|
| 105 |         @# datadir is correct;  no arch-specific files
 | 
|---|
| 106 |         @for i in $(SCRIPTS) $(MODULES); do \
 | 
|---|
| 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 ; \
 | 
|---|
| 110 |         done
 | 
|---|
| 111 |         @$(INSTALL) -d $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/
 | 
|---|
| 112 |         @# install an example config file with all known settings
 | 
|---|
| 113 |         @for i in $(CONFIGFILES) ; do \
 | 
|---|
| 114 |                 if [ -e $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/$$i ]; then \
 | 
|---|
| 115 |                         echo "refusing to overwrite existing config file, created as $$i.new" ; \
 | 
|---|
| 116 |                         $(INSTALL_DATA) $$i $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/$$i.new ; \
 | 
|---|
| 117 |                 else \
 | 
|---|
| 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 ; \
 | 
|---|
| 121 |         done
 | 
|---|
| 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
 | 
|---|
| 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 -)
 | 
|---|
| 133 |         /usr/bin/perl -p -e 's/#VERSION#/$(VERSION)/;s/#RELEASE#/$(RELEASE)/;s/#BETA#//g' < $(PKGNAME).spec > $(PKGNAME)-$(VERSION)/$(PKGNAME).spec
 | 
|---|
| 134 |         /usr/bin/perl -p -e 's/#VERSION#/$(VERSION)/;s/#RELEASE#/$(RELEASE)/;s/#BETA#//g' < INSTALL > $(PKGNAME)-$(VERSION)/INSTALL
 | 
|---|
| 135 |         perl -pi -e 's/[\d.]+;\s*##VERSION##/$(VERSION);/;' $(PKGNAME)-$(VERSION)/DNSDB.pm
 | 
|---|
| 136 |         tar cf $(PKGNAME)-$(VERSION).tar $(PKGNAME)-$(VERSION)
 | 
|---|
| 137 |         gzip -v -f -9 $(PKGNAME)-$(VERSION).tar
 | 
|---|
| 138 |         rm -rf $(PKGNAME)-$(VERSION)
 | 
|---|
| 139 |         gpg -a --detach-sign $(PKGNAME)-$(VERSION).tar.gz
 | 
|---|