merged heads
[iserv-mod-error-reporter.git] / Makefile
1 #
2 # @file Makefile
3 # Makefile for installing, creating documentation etc.
4 # @author Roland Hieber (roland.hieber@wilhelm-gym.net)
5 # @date 06.10.2007
6 # @package iserv_errorreporter
7 #
8 # Copyright © 2007 Roland Hieber
9 #
10 # Permission is hereby granted, free of charge, to any person obtaining
11 # copy of this software and associated documentation files (the "Software"),
12 # to deal in the Software without restriction, including without limitation
13 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 # and/or sell copies of the Software, and to permit persons to whom the
15 # Software is furnished to do so, subject to the following conditions:
16 #
17 # The above copyright notice and this permission notice shall be included in
18 # all copies or substantial portions of the Software.
19 #
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 # THE SOFTWARE.
27 #
28
29 PACKAGENAME=iserv-mod-error-reporter
30 VERSION:=$(shell grep "^$(PACKAGENAME)" debian/changelog | head -1 | sed -e "s/$(PACKAGENAME) (\([0-9.]\+\).*).*/\1/ ")
31
32 SHELL=/bin/bash
33 INSTALLDIR=/opt/iserv
34 LN=ln -f
35 RM=rm -rf
36 CHOWN=chown -f
37 MKDIR=mkdir -p
38
39 # hardlink the files to their destinations
40 links: sourcedoc
41 # documentation
42 $(MKDIR) $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter/source/
43 if [ ! -d $(DESTDIR)/usr/share/doc/iserv/mod/ ]; then $(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/; fi
44 $(LN) doc/{TODO,changelog.old.html} debian/copyright $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter
45 $(LN) doc/source/* $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter/source/
46 $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter # remove old link
47 $(LN) -s ../../iserv-mod-error-reporter $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter
48
49 # images
50 if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/16 ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/16; fi
51 if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/32 ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/32; fi
52 $(LN) img/16/*.png $(DESTDIR)/usr/share/iserv/www/img/default/16
53 $(LN) img/32/*.png $(DESTDIR)/usr/share/iserv/www/img/default/32
54
55 # localization
56 if [ ! -d $(DESTDIR)/usr/share/iserv/locale/de ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/locale/de; fi
57 $(LN) lang/mod_error-reporter.po $(DESTDIR)/usr/share/iserv/locale/de
58
59 # SQL data
60 if [ ! -d $(DESTDIR)/usr/share/iserv/db/log_module ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/db/log_module; fi
61 $(LN) sql/mod_error-reporter.sql $(DESTDIR)/usr/share/iserv/db/
62 $(LN) sql/log_module/mod_error-reporter $(DESTDIR)/usr/share/iserv/db/log_module
63
64 # privileges
65 if [ ! -d $(DESTDIR)/usr/share/iserv/priv ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/priv; fi
66 $(LN) priv/mod_error-reporter $(DESTDIR)/usr/share/iserv/priv
67
68 # includes
69 $(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter
70 $(LN) inc/{class*,init,functions}.inc $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter
71 if [ ! -e $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc ] ; then touch $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc; fi
72 ifeq ($(USER),root)
73 chmod u+rw $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc
74 chown www-data $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc
75 endif
76
77 # navigation
78 if [ ! -d $(DESTDIR)/usr/share/iserv/www/nav/admin ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/nav/admin; fi
79 $(LN) nav/*.mod $(DESTDIR)/usr/share/iserv/www/nav
80 $(LN) nav/admin/*.mod $(DESTDIR)/usr/share/iserv/www/nav/admin
81
82 # web pages
83 $(MKDIR) $(DESTDIR)/usr/share/iserv/www/mod_error-reporter
84 $(LN) src/{config,detail,index}.php $(DESTDIR)/usr/share/iserv/www/mod_error-reporter
85
86 # maintenance files
87 $(MKDIR) $(DESTDIR)/usr/share/iserv/modules/error-reporter
88 $(LN) maint/* $(DESTDIR)/usr/share/iserv/modules/error-reporter
89
90 # build doxygen documentation from source
91 sourcedoc:
92 cat Doxyfile.in | sed -e "s/{{{VERSION}}}/$(VERSION)/" \
93 -e "s/{{{PACKAGENAME}}}/$(PACKAGENAME)/" > Doxyfile
94 doxygen
95 mv doc/source/html/* doc/source/ && rm -rf doc/source/html
96
97 install: links
98 ifeq ($(USER),root)
99 chklocale
100 chkpriv
101 chkdb -r
102 endif
103
104 # uninstalling
105 uninstall:
106 $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter
107 $(RM) $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter
108 $(RM) $(DESTDIR)/usr/share/iserv/www/img/{16,32}/mod_error-reporter.png
109 $(RM) $(DESTDIR)/usr/share/iserv/sql/mod_error-reporter.sql
110 $(RM) $(DESTDIR)/usr/share/iserv/sql/log_module/mod_error-reporter
111 $(RM) $(DESTDIR)/usr/share/iserv/priv/mod_error-reporter
112 $(RM) $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter
113 $(RM) $(DESTDIR)/usr/share/iserv/www/nav/79mod_error-reporter.mod
114 $(RM) $(DESTDIR)/usr/share/iserv/www/nav/admin/99mod_error-reporter.mod
115 $(RM) $(DESTDIR)/usr/share/iserv/www/mod_error-reporter
116
117 ifeq ($(USER),root)
118 chklocale
119 chkpriv
120 psql -c "DELETE FROM log_module WHERE module='Error Report Wizard';"
121 endif
122
123 @echo
124 @echo If you do not need the SQL tables anymore, remove them by running
125 @echo ' psql -c "DROP TABLE mod_errorreports;"'
126 @echo After that, all reported errors are unrecoverably deleted!
127 @echo
128
129 # clean up
130 clean: distclean
131 if [ -e Doxyfile ]; then rm Doxyfile; fi;
132
133 distclean:
134 $(RM) doc/source
135
136 .PHONY: clean distclean install
This page took 0.056242 seconds and 5 git commands to generate.