]> git.donarmstrong.com Git - debbugs.git/blob - Makefile
fix the rule to install UPGRADE.md
[debbugs.git] / Makefile
1 # top-level Makefile for debbugs
2 # probably requires GNU make to run properly
3
4 sbin_dir        := $(DESTDIR)/usr/sbin
5 etc_dir         := $(DESTDIR)/etc/debbugs
6 var_dir         := $(DESTDIR)/var/lib/debbugs
7 scripts_dir     := $(DESTDIR)/usr/lib/debbugs
8 doc_dir         := $(DESTDIR)/usr/share/doc/debbugs
9 templates_dir   := $(DESTDIR)/usr/share/debbugs/templates
10 man_dir         := $(DESTDIR)/usr/share/man
11 man8_dir        := $(man_dir)/man8
12 examples_dir    := $(doc_dir)/examples
13
14 scripts_in      = $(foreach script, $(filter-out scripts/config% scripts/errorlib scripts/text, $(wildcard scripts/*)),$(patsubst scripts/%,%,$(script)))
15 htmls_in        := $(wildcard html/*.html.in)
16 cgis            := $(wildcard cgi/*.cgi)
17
18 install_exec    := install -m755 -p
19 install_data    := install -m644 -p
20
21 PERL ?= /usr/bin/perl
22 # Some tests need to run under an UTF-8 locale.
23 UTF8_LOCALE ?= C.UTF-8
24
25 all: build
26
27 build:
28         $(PERL) Makefile.PL
29         $(MAKE) -f Makefile.perl
30
31 test:
32         LC_ALL=$(UTF8_LOCALE) $(PERL) -MTest::Harness -I. -e 'runtests(glob(q(t/*.t)))'
33
34 test_%: t/%.t
35         LC_ALL=$(UTF8_LOCALE) $(PERL) -MTest::Harness -I. -e 'runtests(q($<))'
36
37 testcover:
38         LC_ALL=$(UTF8_LOCALE) PERL5LIB=t/cover_lib/:. cover -test
39
40 clean:
41         if [ -e Makefile.perl ]; then \
42                 $(MAKE) -f Makefile.perl clean; \
43         fi;
44
45 install: install_mostfiles
46         # install basic debbugs documentation
47         $(install_data) COPYING UPGRADE.md README.md debian/README.mail $(doc_dir)
48         $(MAKE) -f Makefile.perl install DESTDIR=$(DESTDIR)
49
50 install_mostfiles:
51         # create the directories if they aren't there
52         for dir in $(sbin_dir) $(etc_dir)/html $(etc_dir)/indices \
53 $(var_dir)/indices $(var_dir)/www/cgi $(var_dir)/www/db $(var_dir)/www/txt \
54 $(var_dir)/www/css \
55 $(var_dir)/spool/lock $(var_dir)/spool/archive $(var_dir)/spool/incoming \
56 $(var_dir)/spool/db-h $(scripts_dir) $(examples_dir) $(man8_dir); \
57           do test -d $$dir || $(install_exec) -d $$dir; done
58
59         # install the scripts
60         $(foreach script,$(scripts_in), $(install_exec) scripts/$(script) $(scripts_dir);)
61         $(install_data) scripts/errorlib $(scripts_dir)/errorlib
62
63         # install examples
64         $(install_data) examples/config $(examples_dir)/config
65         $(install_data) examples/config.debian $(examples_dir)/config.debian
66         $(install_data) scripts/text $(examples_dir)/text
67         $(install_data) debian/crontab misc/nextnumber misc/Maintainers \
68           misc/Maintainers.override misc/pseudo-packages.description \
69           misc/sources $(examples_dir)
70         $(install_data) examples/apache.conf $(examples_dir)
71
72         # install the HTML pages etc
73         $(foreach html, $(htmls_in), $(install_data) $(html) $(etc_dir)/html;)
74         $(install_data) html/htaccess $(var_dir)/www/db/.htaccess
75         $(install_data) html/bugs.css $(var_dir)/www/css/bugs.css
76
77         # install the CGIs
78         for cgi in $(cgis); do $(install_exec) $$cgi $(var_dir)/www/cgi; done
79
80         # install debbugsconfig
81         $(install_exec) debian/debbugsconfig $(sbin_dir)
82         $(install_data) debian/debbugsconfig.8 $(man8_dir)
83         # install migration tools
84         $(install_exec) migrate/debbugs-dbhash $(sbin_dir)
85         $(install_data) migrate/debbugs-dbhash.8 $(man8_dir)
86         $(install_exec) migrate/debbugs-upgradestatus $(sbin_dir)
87
88         # install the updateseqs file
89         $(install_data) misc/updateseqs $(var_dir)/spool
90
91         # install the templates
92         $(foreach dir, $(wildcard templates/*/*), $(install_exec) -d $(templates_dir)/$(patsubst templates/%,%,$(dir));)
93         $(foreach tmpl, $(wildcard templates/*/*/*.tmpl), $(install_data) $(tmpl) $(templates_dir)/$(patsubst templates/%,%,$(tmpl));)
94
95
96 .PHONY: test build