* Don't ignore a make clean error (check for the existance of Makefile
[fmit.git] / debian / rules
index a44ec2a..6cb5132 100755 (executable)
@@ -57,7 +57,7 @@ clean: unpatch
        rm -f build-stamp 
 
        # Add here commands to clean up after the build process.
-       -$(MAKE) distclean
+       [ ! -f Makefile ] || $(MAKE) distclean
 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
        cp -f /usr/share/misc/config.sub config.sub
 endif
@@ -66,6 +66,13 @@ ifneq "$(wildcard /usr/share/misc/config.guess)" ""
 endif
 
        rm -f $(CURDIR)/config.sub $(CURDIR)/config.guess
+
+       # If we're not in a mercurial repository, make sure no hg metadata is
+       # lying around
+       if ! [ -d .hg ]; then \
+               rm -f .hg*; \
+       fi
+
        dh_clean
 
 install: build