1 # top-level Makefile for debbugs
2 # probably requires GNU make to run properly
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
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)
18 install_exec := install -m755 -p
19 install_data := install -m644 -p
22 # Some tests need to run under an UTF-8 locale.
23 UTF8_LOCALE ?= C.UTF-8
29 $(MAKE) -f Makefile.perl
33 LC_ALL=$(UTF8_LOCALE) $(PERL) -MTest::Harness -I. -e 'runtests(glob(q(t/*.t)))'
36 LC_ALL=$(UTF8_LOCALE) $(PERL) -MTest::Harness -I. -e 'runtests(q($<))'
39 LC_ALL=$(UTF8_LOCALE) PERL5LIB=t/cover_lib/:. cover -test
42 if [ -e Makefile.perl ]; then \
43 $(MAKE) -f Makefile.perl clean; \
46 install: install_mostfiles
47 # install basic debbugs documentation
48 $(install_data) COPYING UPGRADE.md README.md debian/README.mail $(doc_dir)
49 $(MAKE) -f Makefile.perl install DESTDIR=$(DESTDIR)
52 # create the directories if they aren't there
53 for dir in $(sbin_dir) $(etc_dir)/html $(etc_dir)/indices \
54 $(var_dir)/indices $(var_dir)/www/cgi $(var_dir)/www/db $(var_dir)/www/txt \
56 $(var_dir)/spool/lock $(var_dir)/spool/archive $(var_dir)/spool/incoming \
57 $(var_dir)/spool/db-h $(scripts_dir) $(examples_dir) $(man8_dir); \
58 do test -d $$dir || $(install_exec) -d $$dir; done
61 $(foreach script,$(scripts_in), $(install_exec) scripts/$(script) $(scripts_dir);)
62 $(install_data) scripts/errorlib $(scripts_dir)/errorlib
65 $(install_data) examples/config $(examples_dir)/config
66 $(install_data) examples/config.debian $(examples_dir)/config.debian
67 $(install_data) scripts/text $(examples_dir)/text
68 $(install_data) debian/crontab misc/nextnumber misc/Maintainers \
69 misc/Maintainers.override misc/pseudo-packages.description \
70 misc/sources $(examples_dir)
71 $(install_data) examples/apache.conf $(examples_dir)
73 # install the HTML pages etc
74 $(foreach html, $(htmls_in), $(install_data) $(html) $(etc_dir)/html;)
75 $(install_data) html/htaccess $(var_dir)/www/db/.htaccess
76 $(install_data) html/bugs.css $(var_dir)/www/css/bugs.css
77 $(install_data) html/logo/debbugs_logo_icon.png $(var_dir)/www/favicon.png
80 for cgi in $(cgis); do $(install_exec) $$cgi $(var_dir)/www/cgi; done
82 # install debbugsconfig
83 $(install_exec) debian/debbugsconfig $(sbin_dir)
84 $(install_data) debian/debbugsconfig.8 $(man8_dir)
85 # install migration tools
86 $(install_exec) migrate/debbugs-dbhash $(sbin_dir)
87 $(install_data) migrate/debbugs-dbhash.8 $(man8_dir)
88 $(install_exec) migrate/debbugs-upgradestatus $(sbin_dir)
90 # install the updateseqs file
91 $(install_data) misc/updateseqs $(var_dir)/spool
93 # install the templates
94 $(foreach dir, $(wildcard templates/*/*), $(install_exec) -d $(templates_dir)/$(patsubst templates/%,%,$(dir));)
95 $(foreach tmpl, $(wildcard templates/*/*/*.tmpl), $(install_data) $(tmpl) $(templates_dir)/$(patsubst templates/%,%,$(tmpl));)