| [210] | 1 | # $Id: Makefile 587 2014-01-17 15:49:12Z kdeugau $
 | 
|---|
| [114] | 2 | # DNS Admin makefile
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 | PKGNAME=dnsadmin
 | 
|---|
| [587] | 5 | VERSION=1.2.3
 | 
|---|
| [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 |         \
 | 
|---|
| [548] | 48 |         dns.sql dns-1.0-1.2.sql \
 | 
|---|
| [219] | 49 |         \
 | 
|---|
| [548] | 50 |         $(SCRIPTS) $(MODULES) \
 | 
|---|
 | 51 |         \
 | 
|---|
| [166] | 52 |         index.shtml \
 | 
|---|
| [114] | 53 |         \
 | 
|---|
| [548] | 54 |         $(IMAGES) \
 | 
|---|
| [114] | 55 |         \
 | 
|---|
| [548] | 56 |         $(TEMPLATES) \
 | 
|---|
| [216] | 57 |         \
 | 
|---|
 | 58 |         dnsdb.conf
 | 
|---|
| [114] | 59 | 
 | 
|---|
 | 60 | DIRS = \
 | 
|---|
 | 61 |         images templates
 | 
|---|
 | 62 | 
 | 
|---|
| [199] | 63 | IMAGES = \
 | 
|---|
| [548] | 64 |         images/ASC.png images/DESC.png \
 | 
|---|
 | 65 |         images/ffwd.png images/frev.png images/fwd.png images/rev.png \
 | 
|---|
 | 66 |         images/trash2.png \
 | 
|---|
 | 67 |         images/tree_closed.png images/tree_open.png
 | 
|---|
| [114] | 68 | 
 | 
|---|
 | 69 | SCRIPTS = \
 | 
|---|
| [562] | 70 |         compact-recs.pl dns.cgi dns-rpc.cgi dns-rpc.fcgi export.pl textrecs.cgi tiny-import.pl vega-import.pl
 | 
|---|
| [114] | 71 | 
 | 
|---|
| [166] | 72 | MODULES = DNSDB.pm
 | 
|---|
| [114] | 73 | 
 | 
|---|
| [216] | 74 | TEMPLATES = \
 | 
|---|
| [548] | 75 |         templates/adddomain.tmpl templates/addgroup.tmpl templates/addrec.tmpl templates/addrevzone.tmpl \
 | 
|---|
 | 76 |         templates/adduser.tmpl templates/axfr.tmpl templates/badpage.tmpl templates/bulkchange.tmpl \
 | 
|---|
 | 77 |         templates/bulkdomain.tmpl templates/dberr.tmpl templates/deldom.tmpl templates/delgrp.tmpl \
 | 
|---|
 | 78 |         templates/delloc.tmpl templates/delrec.tmpl templates/delrevzone.tmpl templates/deluser.tmpl \
 | 
|---|
| [216] | 79 |         templates/dns.css templates/dnsq.tmpl templates/domlist.tmpl templates/edgroup.tmpl \
 | 
|---|
 | 80 |         templates/editsoa.tmpl templates/footer.tmpl templates/fpnla.tmpl templates/grouptree.css \
 | 
|---|
 | 81 |         templates/grouptree-ie.css templates/grpman.tmpl templates/grptree.tmpl templates/header.tmpl \
 | 
|---|
| [548] | 82 |         templates/lettsearch.tmpl templates/location.tmpl templates/loclist.tmpl templates/login.tmpl \
 | 
|---|
 | 83 |         templates/log.tmpl templates/menu.tmpl templates/msgblock.tmpl templates/newdomain.tmpl \
 | 
|---|
 | 84 |         templates/newgrp.tmpl templates/newrevzone.tmpl templates/permlist.tmpl \
 | 
|---|
 | 85 |         templates/pgcount.tmpl templates/reclist.tmpl templates/record.tmpl templates/revzones.tmpl \
 | 
|---|
 | 86 |         templates/sbox.tmpl templates/soadata.tmpl templates/template.tmpl templates/textrecs.tmpl \
 | 
|---|
 | 87 |         templates/updatesoa.tmpl templates/useradmin.tmpl templates/user.tmpl templates/whoisq.tmpl
 | 
|---|
| [114] | 88 | 
 | 
|---|
| [216] | 89 | CONFIGFILES = dnsdb.conf
 | 
|---|
 | 90 | 
 | 
|---|
| [114] | 91 | all:
 | 
|---|
 | 92 |         # nullop
 | 
|---|
 | 93 | 
 | 
|---|
 | 94 | install:
 | 
|---|
| [220] | 95 |         @mkdir -p $(DESTDIR)${datadir}/$(PKG_LEAF)/images
 | 
|---|
 | 96 |         @$(INSTALL_DATA) $(IMAGES) $(DESTDIR)${datadir}/$(PKG_LEAF)/images
 | 
|---|
 | 97 |         @mkdir -p $(DESTDIR)${datadir}/$(PKG_LEAF)/templates
 | 
|---|
 | 98 |         @$(INSTALL_DATA) $(TEMPLATES) $(DESTDIR)${datadir}/$(PKG_LEAF)/templates
 | 
|---|
| [216] | 99 |         @# munge in necessary 'use lib ...' bits so scripts can find libs and config...
 | 
|---|
 | 100 |         @# datadir is correct;  no arch-specific files
 | 
|---|
| [114] | 101 |         @for i in $(SCRIPTS) $(MODULES); do \
 | 
|---|
| [219] | 102 |                 $(INSTALL_SCRIPT) -D $$i $(DESTDIR)${datadir}/$(PKG_LEAF)/$$i ; \
 | 
|---|
| [548] | 103 |                 perl -pi -e "s|use lib '.';\s+##uselib##|use lib '${datadir}/$(PKG_LEAF)/';|;" $(DESTDIR)${datadir}/$(PKG_LEAF)/$$i ; \
 | 
|---|
| [114] | 104 |         done
 | 
|---|
| [219] | 105 |         @$(INSTALL) -d $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/
 | 
|---|
| [216] | 106 |         @# install an example config file with all known settings
 | 
|---|
 | 107 |         @for i in $(CONFIGFILES) ; do \
 | 
|---|
| [219] | 108 |                 if [ -e $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/$$i ]; then \
 | 
|---|
| [216] | 109 |                         echo "refusing to overwrite existing config file, created as $$i.new" ; \
 | 
|---|
| [219] | 110 |                         $(INSTALL_DATA) $$i $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/$$i.new ; \
 | 
|---|
| [216] | 111 |                 else \
 | 
|---|
| [219] | 112 |                         $(INSTALL_DATA) $$i $(DESTDIR)${sysconfdir}/$(CFG_LEAF)/ ; \
 | 
|---|
 | 113 |                 fi ; \
 | 
|---|
| [548] | 114 |                 perl -pi -e 's|"/etc/dnsdb/dnsdb.conf",\s+##CFG_LEAF##|"${sysconfdir}/$(CFG_LEAF)/dnsdb.conf",|;' $(DESTDIR)${datadir}/$(PKG_LEAF)/DNSDB.pm ; \
 | 
|---|
| [114] | 115 |         done
 | 
|---|
 | 116 | 
 | 
|---|
 | 117 | #clean:
 | 
|---|
 | 118 | #       @for i in $(DIRS) ; do \
 | 
|---|
 | 119 | #               $(MAKE) -C $$i clean ; \
 | 
|---|
 | 120 | #       done
 | 
|---|
 | 121 | 
 | 
|---|
 | 122 | dist:
 | 
|---|
 | 123 |         mkdir $(PKGNAME)-$(VERSION)
 | 
|---|
 | 124 |         tar cf - $(MANIFEST) | (cd $(PKGNAME)-$(VERSION); tar xf -)
 | 
|---|
| [219] | 125 |         /usr/bin/perl -p -e 's/#VERSION#/$(VERSION)/;s/#RELEASE#/$(RELEASE)/;s/#BETA#//g' < $(PKGNAME).spec > $(PKGNAME)-$(VERSION)/$(PKGNAME).spec
 | 
|---|
| [114] | 126 |         /usr/bin/perl -p -e 's/#VERSION#/$(VERSION)/;s/#RELEASE#/$(RELEASE)/;s/#BETA#//g' < INSTALL > $(PKGNAME)-$(VERSION)/INSTALL
 | 
|---|
| [433] | 127 |         perl -pi -e 's/["\d.]+;\s*##VERSION##/"$(VERSION)";/;' $(PKGNAME)-$(VERSION)/DNSDB.pm
 | 
|---|
| [114] | 128 |         tar cf $(PKGNAME)-$(VERSION).tar $(PKGNAME)-$(VERSION)
 | 
|---|
 | 129 |         gzip -v -f -9 $(PKGNAME)-$(VERSION).tar
 | 
|---|
 | 130 |         rm -rf $(PKGNAME)-$(VERSION)
 | 
|---|
| [263] | 131 |         gpg -a --detach-sign $(PKGNAME)-$(VERSION).tar.gz
 | 
|---|