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
|
#!/usr/bin/make -f
#
# Copyright information
#
# Copyright (C) 2012 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 = cloc
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
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
BIN = $(PACKAGE)
PL_SCRIPT = $(BIN)
INSTALL_OBJS_BIN = $(PL_SCRIPT)
INSTALL_OBJS_MAN = *.1
INSTALL = /usr/bin/install
INSTALL_BIN = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644
all: man
@echo "Nothing to compile for a Perl script."
@echo "Try 'make help' or 'make -n DESTDIR= prefix=/usr/local install'"
# Rule: help - display Makefile rules
help:
@grep "^# Rule:" Makefile | sort
# Rule: clean - remove temporary files
clean:
# clean
rm -f *[#~] *.\#* *.x~~ pod*.tmp *.1
rm -rf tmp
distclean: clean
realclean: clean
# Rule: man - Generate or update manual page
man:
$(MAKE) -f pod2man.mk PACKAGE=$(PACKAGE) makeman
# Rule: doc - Generate or update all documentation
doc: man
# Rule: test-perl - Check program syntax
test-perl:
# perl-test - Check syntax
perl -cw $(PL_SCRIPT)
# Rule: test-pod - Check POD syntax
test-pod:
podchecker *.pod
# Rule: test-code - Check that the counter works
test-code:
t/00_C.t
t/02_git.t
t/01_opts.t
# Rule: test-unix - Check that the Unix version works
test-unix:
t/00_C.t -u
t/02_git.t -u
t/01_opts.t -u
# Rule: test - Run tests (exclude test-unix)
test: test-perl test-pod test-code
install-man: test-pod man
# install-man
$(INSTALL_BIN) -d $(MANDIR1)
$(INSTALL_DATA) $(INSTALL_OBJS_MAN) $(MANDIR1)
install-bin: test-perl
# install-bin - Install programs
$(INSTALL_BIN) -d $(BINDIR)
for f in $(INSTALL_OBJS_BIN); \
do \
dest=$${f%.pl}; \
$(INSTALL_BIN) $$f $(BINDIR)/$$dest; \
done
# Rule: install - Standard install
install: install-bin install-man
# Rule: install-test - for Maintainer only
install-test:
rm -rf tmp
$(MAKE) DESTDIR=$$(pwd)/tmp prefix=/usr install
find tmp | sort
# Rule: dist - for Maintainer only, make distribution
dist: clean
[ -f version ] || fail-version-file-is-missing
release=$(PACKAGE)-$$(cat version); \
rm -rf /tmp/$$release ; \
mkdir -vp /tmp/$$release ; \
cp -rav . /tmp/$$release/ ; \
find /tmp/$$release/ -type d \
\( -name .svn -o -name .git -o -name .hg \) | xargs -r rm -r; \
tar -C /tmp -zvcf /tmp/$$release.tar.gz $$release ; \
echo "DONE: /tmp/$$release.tag.gz"
.PHONY: clean distclean realclean install install-bin install-man
# End of file
|