[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master] Include the *_sha1.i files in their own *_codedigest.c files.



Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Fri, 8 May 2009 12:35:36 -0400
Subject: Include the *_sha1.i files in their own *_codedigest.c files.
Commit: fdbdb4dc15004fdb74c57b9bc67cbfca24c6e7ea

This way we do not need to rebuild util.c and/or config.c whenever
any unrelated source file in src/common or src/or has changed.
---
 src/common/Makefile.am       |    4 ++--
 src/common/util.c            |    8 --------
 src/common/util_codedigest.c |   11 +++++++++++
 src/or/Makefile.am           |    6 +++---
 src/or/config.c              |    4 +---
 src/or/config_codedigest.c   |   10 ++++++++++
 src/or/or.h                  |    2 ++
 7 files changed, 29 insertions(+), 16 deletions(-)
 create mode 100644 src/common/util_codedigest.c
 create mode 100644 src/or/config_codedigest.c

diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 78c8ab5..ad54e1a 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -12,7 +12,7 @@ libor_extra_source=
 endif
 
 libor_a_SOURCES = address.c log.c util.c compat.c container.c mempool.c \
-	memarea.c $(libor_extra_source)
+	memarea.c util_codedigest.c $(libor_extra_source)
 libor_crypto_a_SOURCES = crypto.c aes.c tortls.c torgzip.c
 
 noinst_HEADERS = address.h log.h crypto.h test.h util.h compat.h aes.h torint.h tortls.h strlcpy.c strlcat.c torgzip.h container.h ht.h mempool.h memarea.h ciphers.inc
@@ -27,4 +27,4 @@ common_sha1.i: $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(noinst_HEADERS)
 	  touch common_sha1.i; \
 	fi
 
-util.o: common_sha1.i
+util_codedigest.o: common_sha1.i
diff --git a/src/common/util.c b/src/common/util.c
index c1b3ea5..d153df8 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -2562,11 +2562,3 @@ write_pidfile(char *filename)
   }
 }
 
-const char *
-libor_get_digests(void)
-{
-  return ""
-#include "common_sha1.i"
-    ;
-}
-
diff --git a/src/common/util_codedigest.c b/src/common/util_codedigest.c
new file mode 100644
index 0000000..88fe508
--- /dev/null
+++ b/src/common/util_codedigest.c
@@ -0,0 +1,11 @@
+
+#include "util.h"
+
+const char *
+libor_get_digests(void)
+{
+  return ""
+#include "common_sha1.i"
+    ;
+}
+
diff --git a/src/or/Makefile.am b/src/or/Makefile.am
index 03e7900..11923fb 100644
--- a/src/or/Makefile.am
+++ b/src/or/Makefile.am
@@ -20,7 +20,7 @@ tor_SOURCES = buffers.c circuitbuild.c circuitlist.c \
 	networkstatus.c onion.c policies.c \
 	reasons.c relay.c rendcommon.c rendclient.c rendmid.c \
 	rendservice.c rephist.c router.c routerlist.c routerparse.c \
-	eventdns.c \
+	eventdns.c config_codedigest.c \
 	tor_main.c
 
 AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \
@@ -42,7 +42,7 @@ test_SOURCES = buffers.c circuitbuild.c circuitlist.c \
 	networkstatus.c onion.c policies.c \
 	reasons.c relay.c rendcommon.c rendclient.c rendmid.c \
 	rendservice.c rephist.c router.c routerlist.c routerparse.c \
-	eventdns.c \
+	eventdns.c config_codedigest.c \
 	test_data.c test.c
 
 test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
@@ -52,7 +52,7 @@ test_LDADD = ../common/libor.a ../common/libor-crypto.a \
 
 noinst_HEADERS = or.h eventdns.h eventdns_tor.h micro-revision.i
 
-config.o: or_sha1.i
+config_codedigest.o: or_sha1.i
 
 tor_main.o: micro-revision.i
 
diff --git a/src/or/config.c b/src/or/config.c
index 76de527..93177a1 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3930,9 +3930,7 @@ options_init_from_torrc(int argc, char **argv)
   if (argc > 1 && (!strcmp(argv[1],"--digests"))) {
     printf("Tor version %s.\n",get_version());
     printf("%s", libor_get_digests());
-    printf("%s", ""
-#include "or_sha1.i"
-           );
+    printf("%s", tor_get_digests());
     exit(0);
   }
 
diff --git a/src/or/config_codedigest.c b/src/or/config_codedigest.c
new file mode 100644
index 0000000..67fd984
--- /dev/null
+++ b/src/or/config_codedigest.c
@@ -0,0 +1,10 @@
+
+const char *tor_get_digests(void);
+
+const char *
+tor_get_digests(void)
+{
+  return ""
+#include "or_sha1.i"
+    ;
+}
diff --git a/src/or/or.h b/src/or/or.h
index 854b541..fd75229 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2911,6 +2911,8 @@ int options_need_geoip_info(or_options_t *options, const char **reason_out);
 int getinfo_helper_config(control_connection_t *conn,
                           const char *question, char **answer);
 
+const char *tor_get_digests(void);
+
 #ifdef CONFIG_PRIVATE
 /* Used only by config.c and test.c */
 or_options_t *options_new(void);
-- 
1.5.6.5