Update CHANGES.
[clive.git] / Makefile
blob3f3d2f13cdb6eda7fa198eed20c7fbdcae73147f
1 # GNU Makefile
3 SHELL = /bin/sh
5 prefix = $(HOME)
6 bindir = $(prefix)/bin
7 datarootdir = $(prefix)/share
8 datadir = $(datarootdir)
9 mandir = $(datarootdir)/man
10 man1dir = $(mandir)/man1
12 INSTALL = install -c
13 INSTALL_D = install -d
14 INSTALL_M = install -c -m 444
15 RM = rm -f
16 PERL = perl
17 POD2MAN = pod2man
18 AWK = awk
19 TR = tr
21 WITH_MAN = yes
22 WITH_CHECK = yes
24 ifndef V
25 QUIET_POD2MAN = @echo POD2MAN clive.1;
26 endif
28 RELEASE := \
29 $(shell sh -c "$(AWK) '/constant VERSION/ {print \$$5}' clive | \
30 $(TR) -d '[\";]'")
32 .PHONY: all checks
33 all: checks
35 MODULES = \
36 Config::Tiny WWW::Curl HTML::TokeParser BerkeleyDB \
37 URI::Escape Digest::SHA \
39 MODULES_OPTIONAL = \
40 Clipboard IO::Pager Expect Term::ReadKey
42 checks:
43 ifeq ($(WITH_CHECK),yes)
44 @echo == Required Perl modules:
45 @for m in $(MODULES); \
46 do \
47 result=`$(PERL) -M$$m -e "print 'yes'" 2>/dev/null || echo no`;\
48 echo "$$m ...$$result"; \
49 done
50 @echo == Optional Perl modules:
51 @for m in $(MODULES_OPTIONAL); \
52 do \
53 result=`$(PERL) -M$$m -e "print 'yes'" 2>/dev/null || echo no`;\
54 echo "$$m ...$$result"; \
55 done
56 else
57 @echo Disable module checks.
58 endif
60 .PHONY: install uninstall
61 install:
62 $(INSTALL_D) $(DESTDIR)$(bindir)
63 $(INSTALL) clive $(DESTDIR)$(bindir)/clive
64 ifeq ($(WITH_MAN),yes)
65 $(INSTALL_D) $(DESTDIR)$(man1dir)
66 $(INSTALL_M) clive.1 $(DESTDIR)$(man1dir)/clive.1
67 endif
69 uninstall:
70 $(RM) $(DESTDIR)$(bindir)/clive
71 ifeq ($(WITH_MAN),yes)
72 $(RM) $(DESTDIR)$(man1dir)/clive.1
73 endif
75 .PHONY: man
76 man:
77 $(QUIET_POD2MAN)$(POD2MAN) -c "clive manual" -n clive \
78 -s 1 -r $(RELEASE) clive.pod clive.1