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