have configure generate header dependencies automatically
Darren Tucker
dtucker at zip.com.au
Tue Jan 8 17:12:24 EST 2008
Hi all.
While working on something I got bitten by a mismatch between .o files
due to a changed struct. This is easily prevented.
Building proper dependency information into the Makefiles would be major
surgery and require ongoing maintenance (although some of that could be
automated by parsing the .depend files generated on OpenBSD).
This patch is basically the brute-force approach: it will cause a
recompile everything in a given directory if any header file changes.
It should have no effect on building the releases, only for folks who
modify stuff.
Can anyone see any possible downsides to this patch, other than
unnecessary recompiles for people hacking the headers?
Index: Makefile.in
===================================================================
RCS file: /usr/local/src/security/openssh/cvs/openssh/Makefile.in,v
retrieving revision 1.285
diff -u -p -r1.285 Makefile.in
--- Makefile.in 11 Jun 2007 04:01:42 -0000 1.285
+++ Makefile.in 8 Jan 2008 05:36:33 -0000
@@ -56,6 +56,7 @@ ENT=@ENT@
XAUTH_PATH=@XAUTH_PATH@
LDFLAGS=-L. -Lopenbsd-compat/ @LDFLAGS@
EXEEXT=@EXEEXT@
+INCLUDES=@INCLUDES@
INSTALL_SSH_PRNG_CMDS=@INSTALL_SSH_PRNG_CMDS@
INSTALL_SSH_RAND_HELPER=@INSTALL_SSH_RAND_HELPER@
@@ -120,7 +121,7 @@ $(LIBSSH_OBJS): Makefile.in config.h
$(SSHOBJS): Makefile.in config.h
$(SSHDOBJS): Makefile.in config.h
-.c.o:
+.c.o: $(INCLUDES)
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
LIBCOMPAT=openbsd-compat/libopenbsd-compat.a
Index: configure.ac
===================================================================
RCS file: /usr/local/src/security/openssh/cvs/openssh/configure.ac,v
retrieving revision 1.389
diff -u -p -r1.389 configure.ac
--- configure.ac 2 Jan 2008 07:08:45 -0000 1.389
+++ configure.ac 8 Jan 2008 05:41:21 -0000
@@ -88,6 +88,12 @@ AC_SUBST(LD)
AC_C_INLINE
+INCLUDES="`echo $srcdir/*.h`"
+AC_SUBST(INCLUDES, [$INCLUDES])
+
+COMPAT_INCLUDES="`cd openbsd-compat && echo $srcdir/../openbsd-compat/*.h`"
+AC_SUBST(COMPAT_INCLUDES, [$COMPAT_INCLUDES])
+
AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Index: openbsd-compat/Makefile.in
===================================================================
RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/openbsd-compat/Makefile.in,v
retrieving revision 1.41
diff -u -p -r1.41 Makefile.in
--- openbsd-compat/Makefile.in 25 Jun 2007 12:15:13 -0000 1.41
+++ openbsd-compat/Makefile.in 8 Jan 2008 05:45:45 -0000
@@ -15,6 +15,7 @@ AR=@AR@
RANLIB=@RANLIB@
INSTALL=@INSTALL@
LDFLAGS=-L. @LDFLAGS@
+COMPAT_INCLUDES=@COMPAT_INCLUDES@
OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o getcwd.o getgrouplist.o getopt.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o strtonum.o strtoll.o strtoul.o vis.o
@@ -22,14 +23,14 @@ COMPAT=bsd-arc4random.o bsd-asprintf.o b
PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-tun.o port-uw.o
-.c.o:
+.c.o: ../config.h $(COMPAT_INCLUDES)
$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
all: libopenbsd-compat.a
-$(COMPAT): ../config.h
-$(OPENBSD): ../config.h
-$(PORTS): ../config.h
+$(COMPAT): ../config.h $(COMPAT_INCLUDES)
+$(OPENBSD): ../config.h $(COMPAT_INCLUDES)
+$(PORTS): ../config.h $(COMPAT_INCLUDES)
libopenbsd-compat.a: $(COMPAT) $(OPENBSD) $(PORTS)
$(AR) rv $@ $(COMPAT) $(OPENBSD) $(PORTS)
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
More information about the openssh-unix-dev
mailing list