added debian/files to .hgignore
[iserv-mod-room-reservation.git] / Makefile
old mode 100755 (executable)
new mode 100644 (file)
index 0708760..b4a19c6
--- 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
@@ -33,36 +34,53 @@ MKDIR=mkdir -p
 # 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
+       # documentation\r
+       $(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation/source/\r
+       $(LN) doc/{TODO,changelog.html} $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation/\r
+       $(LN) doc/source/html/* $(DESTDIR)/usr/share/doc/iserv/mod/room-reservation/source/\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
-       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
+       # 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
+       touch $(DESTDIR)/usr/share/iserv/www/inc/mod_room-reservation/config.inc\r
+       chmod 664 $(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
        \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/admin\r
+       $(LN) src/index.php $(DESTDIR)/usr/share/iserv/www/mod_room-reservation/\r
+       $(LN) src/admin/config.php $(DESTDIR)/usr/share/iserv/www/mod_room-reservation/admin/\r
+       \r
+       # additional files\r
+       $(MKDIR) $(DESTDIR)/usr/share/iserv/modules/room-reservation\r
+       $(LN) update-iserv1-iserv2.pl $(DESTDIR)/usr/share/iserv/modules/room-reservation\r
+       chmod 755 $(DESTDIR)/usr/share/iserv/modules/room-reservation/update-iserv1-iserv2.pl\r
 \r
 # build doxygen documentation from source\r
 sourcedoc:\r
@@ -70,28 +88,36 @@ sourcedoc:
 \r
 # install everything\r
 install: sourcedoc links\r
+ifeq($(DESTDIR),) # only useful if sql data is in the right place\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/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
+distclean:\r
+       $(RM) doc/source\r
This page took 0.021724 seconds and 4 git commands to generate.