X-Git-Url: https://git.rohieb.name/iserv-mod-error-reporter.git/blobdiff_plain/ae87133905d183987eb75369fe94bb739a2b1cb9..HEAD:/Makefile?ds=sidebyside

diff --git a/Makefile b/Makefile
index a4bf949..c2c2be7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #
 # @file Makefile
-# Makefile for installing, creating documentation etc.
+# Makefile for creating documentation and hardlinks for better development
 # @author Roland Hieber (roland.hieber@wilhelm-gym.net)
 # @date 06.10.2007
 # @package iserv_errorreporter
@@ -26,6 +26,10 @@
 # THE SOFTWARE.
 #
 
+PACKAGENAME=iserv-mod-error-reporter
+VERSION:=$(shell grep "^$(PACKAGENAME)" debian/changelog | head -1 | sed -e "s/$(PACKAGENAME) (\([0-9.]\+\).*).*/\1/ ")
+
+SHELL=/bin/bash
 INSTALLDIR=/opt/iserv
 LN=ln -f
 RM=rm -rf
@@ -36,94 +40,68 @@ MKDIR=mkdir -p
 links: sourcedoc
 	# documentation
 	$(MKDIR) $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter/source/
-	if [ ! -d $(DESTDIR)/usr/share/doc/iserv/mod/ ]; then $(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/; fi
-	$(LN) doc/{TODO,changelog.old.html} debian/copyright $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter
+	$(MKDIR) $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter/
+	$(LN) doc/TODO $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter/
+	$(LN) doc/changelog.old.html $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter/
 	$(LN) doc/source/* $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter/source/
-	$(RM) $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter # remove old link 
 	$(LN) -s ../../iserv-mod-error-reporter $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter
 	
 	# images
-	if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/16 ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/16; fi
-	if [ ! -d $(DESTDIR)/usr/share/iserv/www/img/default/32 ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/32; fi
-	$(LN) img/16/*.png $(DESTDIR)/usr/share/iserv/www/img/default/16
-	$(LN) img/32/*.png $(DESTDIR)/usr/share/iserv/www/img/default/32
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/16/
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/www/img/default/32/
+	$(LN) img/16/*.png $(DESTDIR)/usr/share/iserv/www/img/default/16/
+	$(LN) img/32/*.png $(DESTDIR)/usr/share/iserv/www/img/default/32/
 	
 	# localization
-	if [ ! -d $(DESTDIR)/usr/share/iserv/locale/de ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/locale/de; fi
-	$(LN) lang/mod_error-reporter.po $(DESTDIR)/usr/share/iserv/locale/de
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/locale/de/
+	$(LN) lang/mod_error-reporter.po $(DESTDIR)/usr/share/iserv/locale/de/
 	
 	# SQL data
-	if [ ! -d $(DESTDIR)/usr/share/iserv/db/log_module ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/db/log_module; fi
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/db/log_module/
 	$(LN) sql/mod_error-reporter.sql $(DESTDIR)/usr/share/iserv/db/
-	$(LN) sql/log_module/mod_error-reporter $(DESTDIR)/usr/share/iserv/db/log_module
+	$(LN) sql/log_module/mod_error-reporter $(DESTDIR)/usr/share/iserv/db/log_module/
 	
 	# privileges
-	if [ ! -d $(DESTDIR)/usr/share/iserv/priv ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/priv; fi
-	$(LN) priv/mod_error-reporter $(DESTDIR)/usr/share/iserv/priv
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/priv/
+	$(LN) priv/mod_error-reporter $(DESTDIR)/usr/share/iserv/priv/
 	
 	# includes
-	$(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter
-	$(LN) inc/{class*,init,functions}.inc $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter
-	if [ ! -e $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc ] ; then touch $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc; fi
-ifeq ($(USER),root)
-	chmod u+rw $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc
-	chown www-data $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/config.inc
-endif
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/
+	$(LN) inc/{class*,init,functions}.inc $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter/
 	
 	# navigation
-	if [ ! -d $(DESTDIR)/usr/share/iserv/www/nav/admin ] ; then $(MKDIR) $(DESTDIR)/usr/share/iserv/www/nav/admin; fi
-	$(LN) nav/*.mod $(DESTDIR)/usr/share/iserv/www/nav
-	$(LN) nav/admin/*.mod $(DESTDIR)/usr/share/iserv/www/nav/admin
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/www/nav/
+	$(LN) nav/*.mod $(DESTDIR)/usr/share/iserv/www/nav/
 	
 	# web pages
-	$(MKDIR) $(DESTDIR)/usr/share/iserv/www/mod_error-reporter
-	$(LN) src/{config,detail,index}.php $(DESTDIR)/usr/share/iserv/www/mod_error-reporter
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/www/mod_error-reporter/
+	$(LN) src/{detail,index}.php $(DESTDIR)/usr/share/iserv/www/mod_error-reporter/
+	
+	# config
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/iconf/etc/iserv/config.template/
+	$(LN) config/82error-reporter $(DESTDIR)/usr/share/iserv/iconf/etc/iserv/config.template/
+	
+	# iservchk
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/iconf/etc/iserv/chk.d/99errorreporter/
+	$(LN) iservchk/* $(DESTDIR)/usr/share/iserv/iconf/etc/iserv/chk.d/99errorreporter/
 	
 	# maintenance files
-	$(MKDIR) $(DESTDIR)/usr/share/iserv/modules/error-reporter
-	$(LN) maint/update.php $(DESTDIR)/usr/share/iserv/modules/error-reporter
+	$(MKDIR) $(DESTDIR)/usr/share/iserv/modules/error-reporter/
+	$(LN) maint/* $(DESTDIR)/usr/share/iserv/modules/error-reporter
 
 # build doxygen documentation from source
 sourcedoc:
+	cat Doxyfile.in | sed -e "s/{{{VERSION}}}/$(VERSION)/" \
+		-e "s/{{{PACKAGENAME}}}/$(PACKAGENAME)/" > Doxyfile
 	doxygen
 	mv doc/source/html/* doc/source/ && rm -rf doc/source/html
 
-install: links
-ifeq ($(USER),root)
-	chklocale
-	chkpriv
-	chkdb -r
-endif
-
-# uninstalling
-uninstall:
-	$(RM) $(DESTDIR)/usr/share/doc/iserv/mod/error-reporter
-	$(RM) $(DESTDIR)/usr/share/doc/iserv-mod-error-reporter
-	$(RM) $(DESTDIR)/usr/share/iserv/www/img/{16,32}/mod_error-reporter.png
-	$(RM) $(DESTDIR)/usr/share/iserv/sql/mod_error-reporter.sql
-	$(RM) $(DESTDIR)/usr/share/iserv/sql/log_module/mod_error-reporter
-	$(RM) $(DESTDIR)/usr/share/iserv/priv/mod_error-reporter
-	$(RM) $(DESTDIR)/usr/share/iserv/www/inc/mod_error-reporter
-	$(RM) $(DESTDIR)/usr/share/iserv/www/nav/79mod_error-reporter.mod
-	$(RM) $(DESTDIR)/usr/share/iserv/www/nav/admin/99mod_error-reporter.mod
-	$(RM) $(DESTDIR)/usr/share/iserv/www/mod_error-reporter
-	
-ifeq ($(USER),root)
-	chklocale
-	chkpriv
-	psql -c "DELETE FROM log_module WHERE module='Error Report Wizard';"
-endif
-	
-	@echo
-	@echo If you do not need the SQL tables anymore, remove them by running
-	@echo '  psql -c "DROP TABLE mod_errorreports;"'
-	@echo After that, all reported errors are unrecoverably deleted!
-	@echo
+install: sourcedoc links
 
 # clean up
-clean: distclean
-
-distclean:
+clean:
+	if [ -e Doxyfile ]; then rm Doxyfile; fi;
 	$(RM) doc/source
 
-.PHONY: clean distclean install
+.PHONY: clean install
+