release 8.07.30
[iserv-mod-room-reservation.git] / Makefile
old mode 100755 (executable)
new mode 100644 (file)
index 9796850..a004aff
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@
 # THE SOFTWARE.\r
 #\r
 \r
+DESTDIR?=\r
 SOURCEFILES=src/*.php includes/*.inc\r
 MODULE_DOC_FILES=doc/source/html/* doc/source/latex/*\r
 LN=ln -f\r
@@ -32,68 +33,98 @@ MKDIR=mkdir -p
 \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
+       $(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 $(DESTDIR)/usr/share/doc/iserv-mod-room-reservation $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation\r
+\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
-       $(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
+       # includes\r
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation\r
+       $(LN) includes/*.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 ($(shell id -u),0)\r
+       chmod g+w $(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
-       $(MKDIR) /usr/share/iserv/www/inc/mod_room-reservation\r
-       $(LN) includes/*.inc /usr/share/iserv/www/inc/mod_room-reservation/\r
-       touch /usr/share/iserv/www/inc/mod_room-reservation/config.inc\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
+       # 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) lang/*.po /usr/share/iserv/locale/de/\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) 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
+       # 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
-       $(LN) sql/*.sql /usr/share/iserv/db/\r
-       $(LN) sql/log_module/* /usr/share/iserv/db/log_module\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
-       $(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
+       # 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 ($(shell echo $USER),root)\r
        chkdb -r\r
        chkpriv\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/db/log_module/mod_room-reservation\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/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\r
This page took 0.023949 seconds and 4 git commands to generate.