Description: Debian source patch
Author: Marc Haber <mh+debian-packages@zugschlus.de>
Forwarded: no

Upstream's Makefiles are kind of broken in a way that debian/rules
clean cannot be repeatedly called. We cannot patch this via a quilt
patch because the build process calls debian/rules clean even on a
clean package tree.

While the package is mainly patched via quilt, the Makefile patches
had to be directly applied in the source tree. If you know of any way
to do things more cleanly, please file a bug in the Debian BTS.
--- dsc-statistics-201106061022.orig/presenter/Makefile
+++ dsc-statistics-201106061022/presenter/Makefile
@@ -1,11 +1,13 @@
+#!/usr/bin/make
+
 INSTALLDIR=/usr/local/dsc
 MKDIRS=data cache etc var var/log
 
-all clean:
+all:
 	(cd cron; $(MAKE) $@)
 	(cd extractor; $(MAKE) $@)
 	(cd grapher; $(MAKE) $@)
-	(cd perllib; test -f Makefile || perl Makefile.PL ; $(MAKE) $@)
+	(cd perllib; test -f Makefile || perl Makefile.PL INSTALLDIRS=vendor; $(MAKE) $@ PREFIX=$(CURDIR)/../debian/dsc-statistics-presenter/usr)
 
 install:
 	@for f in ${MKDIRS} ; do \
@@ -14,8 +16,15 @@ install:
 		install -d -m 755 $(INSTALLDIR)/$$f/ ; \
 	fi \
 	done
-	(cd perllib; test -f Makefile || perl Makefile.PL ; $(MAKE) $@)
+	(cd perllib; test -f Makefile || perl Makefile.PL INSTALLDIRS=vendor ; $(MAKE) $@ PREFIX=$(CURDIR)/../debian/dsc-statistics-presenter/usr)
 	(cd cron; $(MAKE) $@)
 	(cd extractor; $(MAKE) $@)
 	(cd grapher; $(MAKE) $@)
 
+clean:
+	(cd cron; $(MAKE) $@)
+	(cd extractor; $(MAKE) $@)
+	(cd grapher; $(MAKE) $@)
+	(cd perllib; test -f Makefile || perl Makefile.PL ; $(MAKE) $@)
+	rm -f perllib/Makefile.old
+	
\ No newline at end of file
--- dsc-statistics-201106061022.orig/collector/Makefile
+++ dsc-statistics-201106061022/collector/Makefile
@@ -1,3 +1,19 @@
-all clean install:
+# this could be written with make -C
+all:
 	(cd dsc; test -s Makefile || ./configure ; $(MAKE) $@)
 	(cd cron; $(MAKE) $@)
+
+install: all
+	(cd dsc; $(MAKE) $@)
+	(cd cron; $(MAKE) $@)
+
+clean:
+	(cd dsc; test -s Makefile && $(MAKE) clean || true)
+	(cd TmfBase/Hapy; test -s Makefile && $(MAKE) distclean || true)
+	rm -f dsc/config.h dsc/config.log dsc/config.status dsc/Makefile
+	#      TmfBase/Hapy/config.log TmfBase/Hapy/_configs.sed \
+	#      TmfBase/Hapy/config.status
+	#rm -rf TmfBase/Hapy/doc/.deps
+	(cd cron; $(MAKE) $@)
+
+.PHONY: all install clean
