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.md debian/README.mail $(doc_dir)
53 $(MAKE) -f Makefile.perl install DESTDIR=$(DESTDIR)
56 # create the directories if they aren't there
57 for dir in $(sbin_dir) $(etc_dir)/html $(etc_dir)/indices \
58 $(var_dir)/indices $(var_dir)/www/cgi $(var_dir)/www/db $(var_dir)/www/txt \
60 $(var_dir)/spool/lock $(var_dir)/spool/archive $(var_dir)/spool/incoming \
61 $(var_dir)/spool/db-h $(scripts_dir) $(examples_dir) $(man8_dir); \
62 do test -d $$dir || $(install_exec) -d $$dir; done
63 # we shouldn't ship db-h spool directories
64 # make db-h spool dirs if they don't exist
65 # cd $(var_dir)/spool/db-h; \
66 # for dir in $(shell seq -w 00 99); \
67 # do test -d $$dir || $(install_exec) -d $$dir; done
71 $(foreach script,$(scripts_in), $(install_exec) scripts/$(script) $(scripts_dir);)
72 $(install_data) scripts/errorlib $(scripts_dir)/errorlib
75 $(install_data) examples/config $(examples_dir)/config
76 $(install_data) examples/config.debian $(examples_dir)/config.debian
77 $(install_data) scripts/text $(examples_dir)/text
78 $(install_data) debian/crontab misc/nextnumber misc/Maintainers \
79 misc/Maintainers.override misc/pseudo-packages.description \
80 misc/sources $(examples_dir)
81 $(install_data) examples/apache.conf $(examples_dir)
83 # install the HTML pages etc
84 $(foreach html, $(htmls_in), $(install_data) $(html) $(etc_dir)/html;)
85 $(install_data) html/htaccess $(var_dir)/www/db/.htaccess
86 $(install_data) html/bugs.css $(var_dir)/www/css/bugs.css
89 for cgi in $(cgis); do $(install_exec) $$cgi $(var_dir)/www/cgi; done
90 $(install_exec) cgi/bugs-fetch2.pl $(var_dir)/www/cgi/bugs-fetch2.pl
92 # # install Perl modules
93 # for perl in $(perls); do $(install_data) $$perl $(perl_dir); done
94 # Make documentation for the perl modules
97 # install debbugsconfig
98 $(install_exec) debian/debbugsconfig $(sbin_dir)
99 $(install_data) debian/debbugsconfig.8 $(man8_dir)
100 # install migration tools
101 $(install_exec) migrate/debbugs-dbhash $(sbin_dir)
102 $(install_data) migrate/debbugs-dbhash.8 $(man8_dir)
103 $(install_exec) migrate/debbugs-upgradestatus $(sbin_dir)
105 # install the updateseqs file
106 $(install_data) misc/updateseqs $(var_dir)/spool
108 # install the templates
109 $(foreach dir, $(wildcard templates/*/*), $(install_exec) -d $(templates_dir)/$(patsubst templates/%,%,$(dir));)
110 $(foreach tmpl, $(wildcard templates/*/*/*.tmpl), $(install_data) $(tmpl) $(templates_dir)/$(patsubst templates/%,%,$(tmpl));)