Source dependency tracking (was: Re: [sane-devel] saned array memory limit)

Julien BLACHE jb@jblache.org
Sun, 31 Oct 2004 19:00:35 +0100


--=-=-=

Henning Meier-Geinitz <henning@meier-geinitz.de> wrote:

Hi,

> I'm rather clueless about automake and/or depend files so if anyone
> has more experience with this topic please go ahead and tell us what
> the easiest solution is.

Here's a proposed solution... It uses makedepend (from XFree86, in the
xutils package for Debian users) to generate backend/.depend.

The depend rule could be made a noop if makedepend isn't found or by a
configure switch (could be disabled in releases by default, and
reenabled by a configure switch).

The makedepend run takes less than a second on my workstation.

JB.

-- 
Julien BLACHE                                   <http://www.jblache.org> 
<jb@jblache.org>                                  GPG KeyID 0xF5D65169


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
  filename=sane-backends_makedepend.patch
Content-Description: Add a working depend rule to backend/Makefile.in and use it

--- Makefile.in.orig	2004-10-31 18:51:24.155645568 +0100
+++ Makefile.in	2004-10-31 18:52:33.919039920 +0100
@@ -174,7 +174,7 @@
 # Don't delete any intermediate files.
 .PRECIOUS: %-s.c %-s.lo %.lo dll-preload.c
 
-all:	$(LIBS) libsane.la
+all:	depend $(LIBS) libsane.la
 
 install:
 	$(MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(libsanedir) $(DESTDIR)$(configdir)
@@ -461,10 +461,12 @@
 
 
 depend:
-	makedepend $(INCLUDES) *.c
+	@echo "Regenerating source tree dependencies ..."
+	@echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > .depend
+	@makedepend -f .depend -o.lo $(INCLUDES) -- $(CFLAGS) $(CPPFLAGS) $(DEFS) -- *.c 2> /dev/null
 
 clean:
-	rm -f *.lo *.o *.la libsane.la dll-preload.c
+	rm -f *.lo *.o *.la libsane.la dll-preload.c .depend
 	find . -type l -name \*-s.c | xargs rm -f
 	rm -rf .libs
 
@@ -477,3 +479,6 @@
 	  ln $$file $(distdir)/backend 2> /dev/null \
 	    || cp -p $$file $(distdir)/backend ; \
 	done
+
+# Include dependency information
+-include .depend

--=-=-=--