source: trunk/Makefile@ 249

Last change on this file since 249 was 220, checked in by Kris Deugau, 13 years ago

/trunk

Fix s.l.o.w "make install" - apparently there's a ~0.1s startup cost for
/usr/bin/install, so "for i in <list>; install $i <destdir>/path/$i" can
be significantly slower than "mkdir -p <path>; install <list> <destdir>/path"
for more than a handful of files.

Also make some mostly cosmetic fixes in Makefile variable expansion so we
don't accidentally end up with quotes embedded in some of the pathnames.

  • Property svn:keywords set to Id
File size: 5.6 KB
Line 
1# $Id: Makefile 220 2012-01-16 21:45:53Z kdeugau $
2# DNS Admin makefile
3
4PKGNAME=dnsadmin
5VERSION=1.0
6RELEASE=1
7
8# Include some boilerplate Gnu makefile definitions.
9prefix = /usr/local
10
11exec_prefix = ${prefix}
12bindir = ${exec_prefix}/bin
13libdir = ${exec_prefix}/lib
14infodir = ${prefix}/info
15includedir = ${prefix}/include
16datadir = ${prefix}/share
17localedir = $(datadir)/locale
18sysconfdir = ${prefix}/etc
19mandir = ${prefix}/man
20
21INSTALL = /usr/bin/install
22INSTALL_PROGRAM = ${INSTALL}
23INSTALL_SCRIPT = ${INSTALL}
24INSTALL_DATA = ${INSTALL} -m 644
25INSTALLMODE= -m 0755
26INSTALLMODE2 = -m 0555
27
28DESTDIR =
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)
33PARA_VERSIONS = 0
34
35# also set the leaf directories we'll be putting things in
36PKG_LEAF = dnsdb
37CFG_LEAF = dnsdb
38
39# tweak the final leaf directories we install to if PARA_VERSIONS is set
40ifeq "$(PARA_VERSIONS)" "1"
41PKG_LEAF = dnsdb-$(VERSION)
42CFG_LEAF = dnsdb/$(VERSION)
43endif
44
45MANIFEST = \
46 INSTALL COPYING TODO Makefile dnsadmin.spec \
47 \
48 new-dns.sql dns.sql dns.cgi dns-rpc.cgi DNSDB.pm vega-import.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
69DIRS = \
70 images templates
71
72IMAGES = \
73 images/trash2.png images/fwd.png images/ffwd.png images/frev.png \
74 images/rev.png images/DESC.png images/ASC.png
75
76SCRIPTS = \
77 dns.cgi dns-rpc.cgi vega-import.pl
78
79MODULES = DNSDB.pm
80
81TEMPLATES = \
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
94CONFIGFILES = dnsdb.conf
95
96all:
97 # nullop
98
99install:
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
130dist:
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 --detach-sign $(PKGNAME)-$(VERSION).tar.gz
Note: See TracBrowser for help on using the repository browser.