Added tag REL_8.09.13 for changeset fe11a11ed255f4a4080a5d868da39de9c751e954
[iserv-mod-room-reservation.git] / Makefile
index 1cd33c8..b847b0d 100644 (file)
--- a/Makefile
+++ b/Makefile
 # THE SOFTWARE.\r
 #\r
 \r
-SOURCEFILES=src/*.php includes/*.inc\r
-MODULE_DOC_FILES=doc/source/html/* doc/source/latex/*\r
+DESTDIR?=\r
 LN=ln -f\r
 RM=rm -rf\r
 MKDIR=mkdir -p\r
 \r
 # hardlink the files to their destinations\r
-# TODO move documentation where Jörg wants it ;)\r
-links:\r
-       $(MKDIR) /usr/share/doc/iserv/mod/room-reservation/source/\r
-       $(LN) doc/{LICENSE*,TODO,changelog*} /usr/share/doc/iserv/mod/room-reservation/\r
-       $(LN) doc/source/html/* /usr/share/doc/iserv/mod/room-reservation/source/\r
+links: sourcedoc\r
+       # documentation\r
+       $(MKDIR) $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/source/\r
+       if [ ! -d $(DESTDIR)/usr/share/doc/iserv/mod/ ]; then $(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/; fi\r
+       $(LN) doc/{TODO,changelog.old.html} $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/\r
+       $(LN) doc/source/* $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation/source/\r
+       $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation\r
+       $(LN) -s ../../iserv-mod-room-reservation $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation\r
        \r
-       $(LN) img/16/*.png /usr/share/iserv/www/img/default/16/\r
-       $(LN) img/24/*.png /usr/share/iserv/www/img/default/24/\r
-       $(LN) img/32/*.png /usr/share/iserv/www/img/default/32/\r
+       # images\r
+       if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/16/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/16/; fi\r
+       $(LN) img/16/*.png $(DESTDIR)/usr/share/iserv/www/img/default/16/\r
+       if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/24/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/24/; fi\r
+       $(LN) img/24/*.png $(DESTDIR)/usr/share/iserv/www/img/default/24/\r
+       if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/32/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/32/; fi\r
+       $(LN) img/32/*.png $(DESTDIR)/usr/share/iserv/www/img/default/32/\r
        \r
-       $(MKDIR) /usr/share/iserv/www/inc/mod_room-reservation\r
-       $(LN) includes/*.inc /usr/share/iserv/www/inc/mod_room-reservation/\r
-       chmod 664 /usr/share/iserv/www/inc/mod_room-reservation/config.inc\r
-       chown www-data /usr/share/iserv/www/inc/mod_room-reservation/config.inc\r
+       # includes\r
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation\r
+       $(LN) inc/*.inc $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/\r
+       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\r
+ifeq ($(USER),root)\r
+       chmod u+rw $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc\r
+       chown www-data $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc\r
+endif\r
        \r
-       $(LN) lang/*.po /usr/share/iserv/locale/de/\r
+       # i18n\r
+       if [ ! -d $(DESTDIR)/usr/share/iserv/locale/de/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/locale/de/; fi\r
+       $(LN) lang/*.po $(DESTDIR)/usr/share/iserv/locale/de/\r
        \r
-       $(LN) nav/*.mod /usr/share/iserv/www/nav/\r
-       $(LN) nav/admin/*.mod /usr/share/iserv/www/nav/admin\r
-\r
-       $(LN) priv/* /usr/share/iserv/priv/\r
+       # navigation\r
+       if [ ! -d $(DESTDIR)/usr/share/iserv/www/nav/admin ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/nav/admin; fi\r
+       $(LN) nav/*.mod $(DESTDIR)/usr/share/iserv/www/nav/\r
+       $(LN) nav/admin/*.mod $(DESTDIR)/usr/share/iserv/www/nav/admin/\r
        \r
-       $(LN) sql/*.sql /usr/share/iserv/db/\r
+       # privileges\r
+       if [ ! -d $(DESTDIR)/usr/share/iserv/priv/ ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/priv/; fi\r
+       $(LN) priv/* $(DESTDIR)/usr/share/iserv/priv/\r
        \r
-       $(MKDIR) /usr/share/iserv/www/mod_room-reservation/admin\r
-       $(LN) src/index.php /usr/share/iserv/www/mod_room-reservation/\r
-       $(LN) src/admin/config.php /usr/share/iserv/www/mod_room-reservation/admin/\r
-\r
-       $(MKDIR) /usr/share/iserv/modules/room-reservation\r
-       $(LN) update-iserv1-iserv2.pl /usr/share/iserv/modules/room-reservation\r
-       chmod 755 /usr/share/iserv/modules/room-reservation/update-iserv1-iserv2.pl\r
+       # SQL tables\r
+       if [ ! -d $(DESTDIR)/usr/share/iserv/db/log_module ]; then $(MKDIR) $(DESTDIR)/usr/share/iserv/db/log_module; fi\r
+       $(LN) sql/*.sql $(DESTDIR)/usr/share/iserv/db/\r
+       $(LN) sql/log_module/* $(DESTDIR)/usr/share/iserv/db/log_module\r
+       \r
+       # web pages\r
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/www/mod_room-reservation\r
+       $(LN) src/{config,index}.php $(DESTDIR)/usr/share/iserv/www/mod_room-reservation/\r
+       \r
+       # additional files\r
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/modules/room-reservation\r
+       $(LN) maint/update-iserv1-iserv2.pl $(DESTDIR)/usr/share/iserv/modules/room-reservation\r
+       chmod +x $(DESTDIR)/usr/share/iserv/modules/room-reservation/update-iserv1-iserv2.pl\r
 \r
 # build doxygen documentation from source\r
 sourcedoc:\r
        doxygen\r
+       mv doc/source/html/* doc/source/ && rm -rf doc/source/html\r
 \r
 # install everything\r
-install: sourcedoc links\r
+install: links\r
+ifeq ($(USER),root)\r
        chkdb -r\r
        chkpriv\r
-       \r
-       @if [ -z "`psql -qc "SELECT * FROM log_module;" 2>&1 |grep ERROR`" -a -z \\r
-         "`psql -qc \"SELECT COUNT(*) FROM log_module WHERE module = 'Room Reservation Schedule';\" 2>&1 |grep ' 1'`" ]; then \\r
-         echo psql -c "INSERT INTO log_module VALUES('Room Reservation Schedule');"; \\r
-         psql -c "INSERT INTO log_module VALUES('Room Reservation Schedule');"; \\r
-       fi;\r
        chklocale\r
+endif\r
 \r
 # uninstalling\r
 uninstall:\r
-       $(RM) /usr/share/doc/iserv/mod/mod_room-reservation\r
-       $(RM) /usr/share/iserv/locale/de/mod_room-reservation.po\r
-       $(RM) /usr/share/iserv/db/mod_room-reservation.sql\r
-       $(RM) /usr/share/iserv/www/nav/79mod_room-reservation.mod\r
-       $(RM) /usr/share/iserv/priv/mod_room-reservation\r
-       $(RM) /usr/share/iserv/www/nav/admin/99mod_room-reservation.mod\r
-       $(RM) /usr/share/iserv/www/img/default/{16,24,32}/mod_room-reservation_{timeslice,index,config}.png\r
-       $(RM) /usr/share/iserv/www/inc/mod_room-reservation\r
-       $(RM) /usr/share/iserv/www/mod_room-reservation\r
-       $(RM) /usr/share/iserv/modules/room-reservation\r
+       $(RM) $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation\r
+       $(RM) $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation\r
+       $(RM) $(DESTDIR)/usr/share/iserv/locale/de/mod_room-reservation.po\r
+       $(RM) $(DESTDIR)/usr/share/iserv/db/mod_room-reservation.sql\r
+       $(RM) $(DESTDIR)/usr/share/iserv/db/log_module/mod_room-reservation\r
+       $(RM) $(DESTDIR)/usr/share/iserv/www/nav/79mod_room-reservation.mod\r
+       $(RM) $(DESTDIR)/usr/share/iserv/priv/mod_room-reservation\r
+       $(RM) $(DESTDIR)/usr/share/iserv/www/nav/admin/99mod_room-reservation.mod\r
+       $(RM) $(DESTDIR)/usr/share/iserv/www/img/default/{16,24,32}/mod_room-reservation_{timeslice,index,config}.png\r
+       $(RM) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation\r
+       $(RM) $(DESTDIR)/usr/share/iserv/www/mod_room-reservation\r
+       $(RM) $(DESTDIR)/usr/share/iserv/modules/room-reservation\r
        \r
+       psql -c "DELETE FROM log_module WHERE module='Room Reservation Schedule';"\r
        chklocale\r
        \r
-       @echo ----------------------------------------------------------------------\r
+       @echo\r
        @echo If you do not need the SQL tables anymore, remove them by running\r
        @echo '  psql -c "DROP TABLE mod_roomreservation_bookings;"'\r
        @echo After that, all bookings are unrecoverably deleted!\r
-       @echo ----------------------------------------------------------------------\r
+       @echo\r
+\r
+# clean up\r
+clean: distclean\r
+\r
+distclean:\r
+       $(RM) doc/source\r
+\r
+.PHONY: clean distclean install\r
This page took 0.030826 seconds and 4 git commands to generate.