Makefile: chkdb etc. was only run if DESTDIR was not set, but it should have been...
[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 DESTDIR?=
28 SOURCEFILES=src/*.php includes/*.inc
29 MODULE_DOC_FILES=doc/source/html/* doc/source/latex/*
30 LN=ln -f
31 RM=rm -rf
32 MKDIR=mkdir -p
33
34 # hardlink the files to their destinations
35 # TODO move documentation where Jörg wants it ;)
36 links:
37 # documentation
38 $(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation/source/
39 $(LN) doc/{TODO,changelog.html} $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation/
40 $(LN) doc/source/html/* $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation/source/
41
42 # images
43 if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/16/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/16/; fi
44 $(LN) img/16/*.png $(DESTDIR)/usr/share/iserv/www/img/default/16/
45 if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/24/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/24/; fi
46 $(LN) img/24/*.png $(DESTDIR)/usr/share/iserv/www/img/default/24/
47 if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/32/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/32/; fi
48 $(LN) img/32/*.png $(DESTDIR)/usr/share/iserv/www/img/default/32/
49
50 # includes
51 $(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation
52 $(LN) includes/*.inc $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/
53 touch $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc
54
55 # i18n
56 if [ ! -d $(DESTDIR)/usr/share/iserv/locale/de/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/locale/de/; fi
57 $(LN) lang/*.po $(DESTDIR)/usr/share/iserv/locale/de/
58
59 # navigation
60 if [ ! -d $(DESTDIR)/usr/share/iserv/www/nav/admin ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/nav/admin; fi
61 $(LN) nav/*.mod $(DESTDIR)/usr/share/iserv/www/nav/
62 $(LN) nav/admin/*.mod $(DESTDIR)/usr/share/iserv/www/nav/admin/
63
64 # privileges
65 if [ ! -d $(DESTDIR)/usr/share/iserv/priv/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/priv/; fi
66 $(LN) priv/* $(DESTDIR)/usr/share/iserv/priv/
67
68 # SQL tables
69 if [ ! -d $(DESTDIR)/usr/share/iserv/db/log_module ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/db/log_module; fi
70 $(LN) sql/*.sql $(DESTDIR)/usr/share/iserv/db/
71 $(LN) sql/log_module/* $(DESTDIR)/usr/share/iserv/db/log_module
72
73 # web pages
74 $(MKDIR) $(DESTDIR)/usr/share/iserv/www/mod_room-reservation/admin
75 $(LN) src/index.php $(DESTDIR)/usr/share/iserv/www/mod_room-reservation/
76 $(LN) src/admin/config.php $(DESTDIR)/usr/share/iserv/www/mod_room-reservation/admin/
77
78 # additional files
79 $(MKDIR) $(DESTDIR)/usr/share/iserv/modules/room-reservation
80 $(LN) update-iserv1-iserv2.pl $(DESTDIR)/usr/share/iserv/modules/room-reservation
81 chmod +x $(DESTDIR)/usr/share/iserv/modules/room-reservation/update-iserv1-iserv2.pl
82
83 # build doxygen documentation from source
84 sourcedoc:
85 doxygen
86
87 # install everything
88 install: sourcedoc links
89 ifndef $(DESTDIR)
90 # only useful if sql data is in the right place
91 chmod g+w $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc
92 chgrp www-data $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc
93 chkdb -r
94 chkpriv
95 chklocale
96 endif
97
98 # uninstalling
99 uninstall:
100 $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/mod_room-reservation
101 $(RM) $(DESTDIR)/usr/share/iserv/locale/de/mod_room-reservation.po
102 $(RM) $(DESTDIR)/usr/share/iserv/db/mod_room-reservation.sql
103 $(RM) $(DESTDIR)/usr/share/iserv/db/log_module/mod_room-reservation
104 $(RM) $(DESTDIR)/usr/share/iserv/www/nav/79mod_room-reservation.mod
105 $(RM) $(DESTDIR)/usr/share/iserv/priv/mod_room-reservation
106 $(RM) $(DESTDIR)/usr/share/iserv/www/nav/admin/99mod_room-reservation.mod
107 $(RM) $(DESTDIR)/usr/share/iserv/www/img/default/{16,24,32}/mod_room-reservation_{timeslice,index,config}.png
108 $(RM) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation
109 $(RM) $(DESTDIR)/usr/share/iserv/www/mod_room-reservation
110 $(RM) $(DESTDIR)/usr/share/iserv/modules/room-reservation
111
112 psql -c "DELETE FROM log_module WHERE module='Room Reservation Schedule';"
113 chklocale
114
115 @echo
116 @echo If you do not need the SQL tables anymore, remove them by running
117 @echo ' psql -c "DROP TABLE mod_roomreservation_bookings;"'
118 @echo After that, all bookings are unrecoverably deleted!
119 @echo
120
121 # clean up
122 clean: distclean
123
124 distclean:
125 $(RM) doc/source
126
127 .PHONY: clean
This page took 0.054783 seconds and 5 git commands to generate.