-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
104 lines (81 loc) · 3.04 KB
/
Makefile
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
NAME = lltag
ifeq ($(shell [ -d .git ] && echo 1),1)
VERSION = $(shell cat VERSION)+git$(shell date +%Y%m%d).$(shell git show -s --pretty=format:%h)
else
VERSION = $(shell cat VERSION)
endif
LIB_SUBDIR = lib
DOC_SUBDIR = doc
DESTDIR =
PREFIX = /usr/local
EXEC_PREFIX = $(PREFIX)
BINDIR = $(EXEC_PREFIX)/bin
DATADIR = $(PREFIX)/share
SYSCONFDIR = $(PREFIX)/etc
MANDIR = $(PREFIX)/man
DOCDIR = $(DATADIR)/doc
PERL_INSTALLDIRS =
TARBALL = $(NAME)-$(VERSION)
DEBIAN_TARBALL = $(NAME)_$(VERSION).orig
.PHONY: lltag clean install uninstall tarball
lltag:: lltag.in VERSION build-lib
sed -e 's!@SYSCONFDIR@!$(DESTDIR)$(SYSCONFDIR)!g' -e 's!@VERSION@!$(DESTDIR)$(VERSION)!g' \
< lltag.in > lltag
chmod 755 lltag
clean:: clean-lib
rm -f lltag
install:: install-lib lltag
install -d -m 0755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(SYSCONFDIR)/lltag/
install -m 0755 lltag $(DESTDIR)$(BINDIR)/lltag
install -m 0644 formats $(DESTDIR)$(SYSCONFDIR)/lltag/
uninstall:: uninstall-lib
rm $(DESTDIR)$(BINDIR)/lltag
rm $(DESTDIR)$(SYSCONFDIR)/lltag/formats
rmdir $(DESTDIR)$(SYSCONFDIR)/lltag/
tarball::
mkdir /tmp/$(TARBALL)
cp lltag.in /tmp/$(TARBALL)
cp formats /tmp/$(TARBALL)
cp lltag.1 lltag_config.5 lltag_formats.5 /tmp/$(TARBALL)
cp Makefile /tmp/$(TARBALL)
cp COPYING README VERSION /tmp/$(TARBALL)
cp Changes /tmp/$(TARBALL)
cp -a $(DOC_SUBDIR)/ /tmp/$(TARBALL)
cp -a $(LIB_SUBDIR) /tmp/$(TARBALL)
cd /tmp && tar cfz $(DEBIAN_TARBALL).tar.gz $(TARBALL)
cd /tmp && tar cfj $(TARBALL).tar.bz2 $(TARBALL)
mv /tmp/$(DEBIAN_TARBALL).tar.gz /tmp/$(TARBALL).tar.bz2 ..
rm -rf /tmp/$(TARBALL)
# Perl modules
.PHONY: build-lib clean-lib install-lib uninstall-lib prepare-lib
$(LIB_SUBDIR)/Makefile.PL: $(LIB_SUBDIR)/Makefile.PL.in VERSION
sed -e 's!@VERSION@!$(VERSION)!g' < $(LIB_SUBDIR)/Makefile.PL.in > $(LIB_SUBDIR)/Makefile.PL
$(LIB_SUBDIR)/Makefile: $(LIB_SUBDIR)/Makefile.PL
cd $(LIB_SUBDIR) && perl Makefile.PL INSTALLDIRS=$(PERL_INSTALLDIRS)
prepare-lib: $(LIB_SUBDIR)/Makefile
build-lib: prepare-lib
$(MAKE) -C $(LIB_SUBDIR)
install-lib: prepare-lib
$(MAKE) -C $(LIB_SUBDIR) install PREFIX= SITEPREFIX=$(PREFIX) PERLPREFIX=$(PREFIX) VENDORPREFIX=$(PREFIX)
clean-lib: prepare-lib
$(MAKE) -C $(LIB_SUBDIR) distclean
rm $(LIB_SUBDIR)/Makefile.PL
uninstall-lib: prepare-lib
$(MAKE) -C $(LIB_SUBDIR) uninstall
# Install the doc, only called on-demand by distrib-specific Makefile
.PHONY: install-doc uninstall-doc
install-doc:
$(MAKE) -C $(DOC_SUBDIR) install DOCDIR=$(DESTDIR)$(DOCDIR)
uninstall-doc:
$(MAKE) -C $(DOC_SUBDIR) uninstall DOCDIR=$(DESTDIR)$(DOCDIR)
# Install the manpages, only called on-demand by distrib-specific Makefile
.PHONY: install-man uninstall-man
install-man::
install -d -m 0755 $(DESTDIR)$(MANDIR)/man1/ $(DESTDIR)$(MANDIR)/man5/
install -m 0644 lltag.1 $(DESTDIR)$(MANDIR)/man1/
install -m 0644 lltag_config.5 $(DESTDIR)$(MANDIR)/man5/
install -m 0644 lltag_formats.5 $(DESTDIR)$(MANDIR)/man5/
uninstall-man::
rm $(DESTDIR)$(MANDIR)/man1/lltag.1
rm $(DESTDIR)$(MANDIR)/man5/lltag_config.5
rm $(DESTDIR)$(MANDIR)/man5/lltag_formats.5