1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
|
#!/usr/bin/make -f
#
# Copyright information
#
# Copyright (C) 2009-2016 Jari Aalto
#
# License
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
ifneq (,)
This makefile requires GNU Make.
endif
PACKAGE = perl-depends
DESTDIR =
prefix = /usr
exec_prefix = $(prefix)
man_prefix = $(prefix)/share
mandir = $(man_prefix)/man
bindir = $(exec_prefix)/bin
sharedir = $(prefix)/share
BINDIR = $(DESTDIR)$(bindir)
DOCDIR = $(DESTDIR)$(sharedir)/doc/$(PACKAGE)
LOCALEDIR = $(DESTDIR)$(sharedir)/locale
SHAREDIR = $(DESTDIR)$(sharedir)/$(PACKAGE)
LIBDIR = $(DESTDIR)$(prefix)/lib/$(PACKAGE)
SBINDIR = $(DESTDIR)$(exec_prefix)/sbin
ETCDIR = $(DESTDIR)/etc/$(PACKAGE)
# 1 = regular, 5 = conf, 6 = games, 8 = daemons
MANDIR = $(DESTDIR)$(mandir)
MANDIR1 = $(MANDIR)/man1
MANDIR5 = $(MANDIR)/man5
MANDIR6 = $(MANDIR)/man6
MANDIR8 = $(MANDIR)/man8
TAR = tar
TAR_OPT_NO = --exclude='.build' \
--exclude='.sinst' \
--exclude='.inst' \
--exclude='tmp' \
--exclude='*.bak' \
--exclude='*[~\#]' \
--exclude='.\#*' \
--exclude='CVS' \
--exclude='.svn' \
--exclude='.git' \
--exclude='.bzr' \
--exclude='*.tar*' \
--exclude='*.tgz'
INSTALL = /usr/bin/install
INSTALL_BIN = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_SUID = $(INSTALL) -m 4755
INSTALL_DIR = $(INSTALL) -m 755 -d
DIST_DIR = ../build-area
DATE = `date +"%Y.%m%d"`
VERSION = $(DATE)
RELEASE = $(PACKAGE)-$(VERSION)
BIN = $(PACKAGE)
PL_SCRIPT = bin/$(BIN).pl
INSTALL_OBJS_BIN = $(PL_SCRIPT)
INSTALL_OBJS_DOC = README COPYING
INSTALL_OBJS_MAN = bin/*.1
XARGS = xargs xargs --no-run-if-empty
PERL = perl
# Do not change these. This is the location of auto generated
# files. From there the fle are installed to $(DOCDIR)
docdir = doc/manual
manpage = bin/$(PACKAGE).1
# Rule: all - Make documentation
all: doc
@echo "For more information, see 'make help'"
# Rule: help - Display Makefile rules
help:
grep -E "^[[:space:]]*# Rule:" Makefile | sed 's/^[[:space:]]*//' | sort
# Rule: clean - Remove temporary files
clean:
# target: clean
find . -name "*[#~]" \
-o -name "*.\#*" \
-o -name "*.x~~" \
-o -name "pod*.tmp" | \
$(XARGS) rm -f
rm -rf tmp
distclean: clean
# target: distclean - Remove everything that can be generated
rm -f $(manpage)
rm -rf $(docdir)
realclean: clean
# Rule: dist-git - [maintainer] release from Git dir (raw)
dist-git: test doc
rm -f $(DIST_DIR)/$(RELEASE)*
git archive --format=tar --prefix=$(RELEASE)/ master | \
gzip --best > $(DIST_DIR)/$(RELEASE).tar.gz
chmod 644 $(DIST_DIR)/$(RELEASE).tar.gz
tar -tvf $(DIST_DIR)/$(RELEASE).tar.gz | sort -k 5
ls -la $(DIST_DIR)/$(RELEASE).tar.gz
# The "gt" is maintainer's program frontend to Git
# Rule: dist-snap - [maintainer] release snapshot from Git repository
dist-snap: test doc
@echo gt tar -q -z -p $(PACKAGE) -c -T master
# Rule: dist - [maintainer] make release archive
dist: dist-snap
dist-ls:
@ls -1tr $(DIST_DIR)/$(PACKAGE)*
# Rule: dist - [maintainer] list of release files
ls: dist-ls
docdir:
# target: docdir - create documentation output directory
$(INSTALL_DIR) $(docdir)
$(manpage): $(PL_SCRIPT)
# target: bin/$(PACKAGE).1
$(PERL) $< --help-man > $@
@-rm -f *.x~~ pod*.tmp
doc/manual/$(PACKAGE).html: $(PL_SCRIPT)
# target: doc/manual/$(PACKAGE).html
$(PERL) $< --help-html > $@
@-rm -f *.x~~ pod*.tmp
doc/manual/$(PACKAGE).txt: $(PL_SCRIPT)
# target: doc/manual/$(PACKAGE).txt
$(PERL) $< --help > $@
@-rm -f *.x~~ pod*.tmp
# Rule: man - Generate or update manual page
man: docdir $(manpage)
# Rule: html - Generate HTML pages
html: docdir test-pod doc/manual/$(PACKAGE).html
# Rule: txt - Generate TXT pages
txt: docdir test-pod doc/manual/$(PACKAGE).txt
# Rule: doc - Generate or update all documentation
doc: man html txt
# Rule: test-pod - Check POD manual page syntax
test-pod:
# target: pod-test - Check POD syntax
podchecker $(PL_SCRIPT)
# Rule: test-perl - Check program syntax
test-perl:
# target: perl-test - Check program syntax
$(PERL) -cw $(PL_SCRIPT)
# Rule: test - Run all tests
test: test-pod test-perl
install-doc:
# target: install-doc - Install documentation
$(INSTALL_BIN) -d $(DOCDIR)
[ ! "$(INSTALL_OBJS_DOC)" ] || \
$(INSTALL_DATA) $(INSTALL_OBJS_DOC) $(DOCDIR)
$(TAR) -C doc $(TAR_OPT_NO) --create --file=- . | \
$(TAR) -C $(DOCDIR) --extract --file=-
install-man: man
# target: install-man - Install manual pages
$(INSTALL_BIN) -d $(MANDIR1)
$(INSTALL_DATA) $(INSTALL_OBJS_MAN) $(MANDIR1)
install-bin:
# target: install-bin - Install programs
$(INSTALL_BIN) -d $(BINDIR)
for f in $(INSTALL_OBJS_BIN); \
do \
dest=$$(basename $$f | sed -e 's/\.pl$$//' -e 's/\.py$$//' ); \
$(INSTALL_BIN) $$f $(BINDIR)/$$dest; \
done
# Rule: install - Standard install. Use variables like: DESTDIR= prefix=/usr/local
install: install-bin install-man install-doc
# Rule: install-test - [maintainer] Dry-run install to tmp/ directory
install-test:
rm -rf tmp
make DESTDIR=`pwd`/tmp prefix=/usr install
find tmp | sort
.PHONY: clean distclean realclean
.PHONY: install install-bin install-man
.PHONY: all man doc test install-test perl-test
.PHONY: dist dist-git dist-ls ls
# End of file
|