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 perl_dir := $(DESTDIR)/usr/share/perl5/Debbugs
9 doc_dir := $(DESTDIR)/usr/share/doc/debbugs
10 templates_dir := $(DESTDIR)/usr/share/debbugs/templates
11 man_dir := $(DESTDIR)/usr/share/man
12 man8_dir := $(man_dir)/man8
13 examples_dir := $(doc_dir)/examples
15 scripts_in = $(foreach script, $(filter-out scripts/config% scripts/errorlib scripts/text, $(wildcard scripts/*)),$(patsubst scripts/%,%,$(script)))
16 htmls_in := $(wildcard html/*.html.in)
17 cgis := $(wildcard cgi/*.cgi cgi/*.pl)
19 # We use the Makefile.PL to install these; not totally decided if we
20 # should switch entirely to this model.
21 #perls := $(shell find Debbugs -type f -iname '*.pm')
23 install_exec := install -m755 -p
24 install_data := install -m644 -p
27 # Some tests need to run under an UTF-8 locale.
28 UTF8_LOCALE ?= C.UTF-8
34 $(MAKE) -f Makefile.perl
37 LC_ALL=$(UTF8_LOCALE) $(PERL) -MTest::Harness -I. -e 'runtests(glob(q(t/*.t)))'
40 LC_ALL=$(UTF8_LOCALE) $(PERL) -MTest::Harness -I. -e 'runtests(q($<))'
43 LC_ALL=$(UTF8_LOCALE) PERL5LIB=t/cover_lib/:. cover -test
46 if [ -e Makefile.perl ]; then \
47 $(MAKE) -f Makefile.perl clean; \
50 install: install_mostfiles
51 # install basic debbugs documentation
52 $(install_data) COPYING UPGRADE README debian/README.mail $(doc_dir)
55 $(sbin_dir)/debbugsconfig
58 # create the directories if they aren't there
59 for dir in $(sbin_dir) $(etc_dir)/html $(etc_dir)/indices \
60 $(var_dir)/indices $(var_dir)/www/cgi $(var_dir)/www/db $(var_dir)/www/txt \
62 $(var_dir)/spool/lock $(var_dir)/spool/archive $(var_dir)/spool/incoming \
63 $(var_dir)/spool/db-h $(scripts_dir) $(examples_dir) $(man8_dir); \
64 do test -d $$dir || $(install_exec) -d $$dir; done
65 # we shouldn't ship db-h spool directories
66 # make db-h spool dirs if they don't exist
67 # cd $(var_dir)/spool/db-h; \
68 # for dir in $(shell seq -w 00 99); \
69 # do test -d $$dir || $(install_exec) -d $$dir; done
73 $(foreach script,$(scripts_in), $(install_exec) scripts/$(script) $(scripts_dir);)
74 $(install_data) scripts/errorlib $(scripts_dir)/errorlib
77 $(install_data) examples/config $(examples_dir)/config
78 $(install_data) examples/config.debian $(examples_dir)/config.debian
79 $(install_data) scripts/text $(examples_dir)/text
80 $(install_data) debian/crontab misc/nextnumber misc/Maintainers \
81 misc/Maintainers.override misc/pseudo-packages.description \
82 misc/sources $(examples_dir)
83 $(install_data) examples/apache.conf $(examples_dir)
85 # install the HTML pages etc
86 $(foreach html, $(htmls_in), $(install_data) $(html) $(etc_dir)/html;)
87 $(install_data) html/htaccess $(var_dir)/www/db/.htaccess
88 $(install_data) html/bugs.css $(var_dir)/www/css/bugs.css
91 for cgi in $(cgis); do $(install_exec) $$cgi $(var_dir)/www/cgi; done
92 $(install_exec) cgi/bugs-fetch2.pl $(var_dir)/www/cgi/bugs-fetch2.pl
94 # # install Perl modules
95 # for perl in $(perls); do $(install_data) $$perl $(perl_dir); done
96 # Make documentation for the perl modules
99 # install debbugsconfig
100 $(install_exec) debian/debbugsconfig $(sbin_dir)
101 $(install_data) debian/debbugsconfig.8 $(man8_dir)
102 # install migration tools
103 $(install_exec) migrate/debbugs-dbhash $(sbin_dir)
104 $(install_data) migrate/debbugs-dbhash.8 $(man8_dir)
105 $(install_exec) migrate/debbugs-upgradestatus $(sbin_dir)
107 # install the updateseqs file
108 $(install_data) misc/updateseqs $(var_dir)/spool
110 # install the templates
111 $(foreach dir, $(wildcard templates/*/*), $(install_exec) -d $(templates_dir)/$(patsubst templates/%,%,$(dir));)
112 $(foreach tmpl, $(wildcard templates/*/*/*.tmpl), $(install_data) $(tmpl) $(templates_dir)/$(patsubst templates/%,%,$(tmpl));)