f61f84049b5211bf8afff939a7736471bfa42c1a
[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 PACKAGENAME:=iserv-mod-room-reservation
28 VERSION:=$(shell grep "^$(PACKAGENAME)" debian/changelog | head -1 | sed -e "s/$(PACKAGENAME) (\([0-9.]\+\).*).*/\1/ ")
29
30 SHELL=/bin/bash
31 DESTDIR?=
32 LN=ln -f
33 RM=rm -rf
34 MKDIR=mkdir -p
35
36 # hardlink the files to their destinations
37 links: sourcedoc
38 # documentation
39 $(MKDIR) $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/source/
40 if [ ! -d $(DESTDIR)/usr/share/doc/iserv/mod/ ]; then $(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/; fi
41 $(LN) doc/{TODO,changelog.old.html} $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/
42 $(LN) doc/source/* $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/source/
43 $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation
44 $(LN) -s ../../iserv-mod-room-reservation $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation
45
46 # images
47 if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/16/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/16/; fi
48 $(LN) img/16/*.png $(DESTDIR)/usr/share/iserv/www/img/default/16/
49 if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/24/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/24/; fi
50 $(LN) img/24/*.png $(DESTDIR)/usr/share/iserv/www/img/default/24/
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/32/*.png $(DESTDIR)/usr/share/iserv/www/img/default/32/
53
54 # includes
55 $(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation
56 $(LN) inc/*.inc $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/
57 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
58 ifeq ($(USER),root)
59 chmod u+rw $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc
60 chown www-data $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc
61 endif
62
63 # i18n
64 if [ ! -d $(DESTDIR)/usr/share/iserv/locale/de/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/locale/de/; fi
65 $(LN) lang/*.po $(DESTDIR)/usr/share/iserv/locale/de/
66
67 # navigation
68 if [ ! -d $(DESTDIR)/usr/share/iserv/www/nav/admin ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/nav/admin; fi
69 $(LN) nav/*.mod $(DESTDIR)/usr/share/iserv/www/nav/
70 $(LN) nav/admin/*.mod $(DESTDIR)/usr/share/iserv/www/nav/admin/
71
72 # privileges
73 if [ ! -d $(DESTDIR)/usr/share/iserv/priv/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/priv/; fi
74 $(LN) priv/* $(DESTDIR)/usr/share/iserv/priv/
75
76 # SQL tables
77 if [ ! -d $(DESTDIR)/usr/share/iserv/db/log_module ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/db/log_module; fi
78 $(LN) sql/*.sql $(DESTDIR)/usr/share/iserv/db/
79 $(LN) sql/log_module/* $(DESTDIR)/usr/share/iserv/db/log_module
80
81 # web pages
82 $(MKDIR) $(DESTDIR)/usr/share/iserv/www/mod_room-reservation
83 $(LN) src/{config,index}.php $(DESTDIR)/usr/share/iserv/www/mod_room-reservation/
84
85 # additional files
86 $(MKDIR) $(DESTDIR)/usr/share/iserv/modules/room-reservation
87 $(LN) maint/update-iserv1-iserv2.pl $(DESTDIR)/usr/share/iserv/modules/room-reservation
88 chmod +x $(DESTDIR)/usr/share/iserv/modules/room-reservation/update-iserv1-iserv2.pl
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 everything
98 install: links
99 ifeq ($(USER),root)
100 chkdb -r
101 chkpriv
102 chklocale
103 endif
104
105 # uninstalling
106 uninstall:
107 $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation
108 $(RM) $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation
109 $(RM) $(DESTDIR)/usr/share/iserv/locale/de/mod_room-reservation.po
110 $(RM) $(DESTDIR)/usr/share/iserv/db/mod_room-reservation.sql
111 $(RM) $(DESTDIR)/usr/share/iserv/db/log_module/mod_room-reservation
112 $(RM) $(DESTDIR)/usr/share/iserv/www/nav/79mod_room-reservation.mod
113 $(RM) $(DESTDIR)/usr/share/iserv/priv/mod_room-reservation
114 $(RM) $(DESTDIR)/usr/share/iserv/www/nav/admin/99mod_room-reservation.mod
115 $(RM) $(DESTDIR)/usr/share/iserv/www/img/default/{16,24,32}/mod_room-reservation_{timeslice,index,config}.png
116 $(RM) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation
117 $(RM) $(DESTDIR)/usr/share/iserv/www/mod_room-reservation
118 $(RM) $(DESTDIR)/usr/share/iserv/modules/room-reservation
119
120 psql -c "DELETE FROM log_module WHERE module='Room Reservation Schedule';"
121 chklocale
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_roomreservation_bookings;"'
126 @echo After that, all bookings are unrecoverably deleted!
127 @echo
128
129 # clean up
130 clean: distclean
131 [ -e Doxyfile ] && rm Doxyfile
132
133 distclean:
134 $(RM) doc/source
135
136 .PHONY: clean distclean install
137
This page took 0.047208 seconds and 3 git commands to generate.