Handle build-trees better.

Properly create git revision and source file sha1sums include files when
building tor not in its source tree but in a dedicated build tree.
This commit is contained in:
Peter Palfrader 2011-09-07 18:04:45 +02:00 committed by Nick Mathewson
parent 916aa8022d
commit 86be8fcf0a
2 changed files with 7 additions and 6 deletions

View File

@ -56,9 +56,9 @@ noinst_HEADERS = \
common_sha1.i: $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(noinst_HEADERS) common_sha1.i: $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(noinst_HEADERS)
if test "@SHA1SUM@" != none; then \ if test "@SHA1SUM@" != none; then \
@SHA1SUM@ $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(noinst_HEADERS) | @SED@ -n 's/^\(.*\)$$/"\1\\n"/p' > common_sha1.i; \ (cd "$(srcdir)" && @SHA1SUM@ $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(noinst_HEADERS)) | @SED@ -n 's/^\(.*\)$$/"\1\\n"/p' > common_sha1.i; \
elif test "@OPENSSL@" != none; then \ elif test "@OPENSSL@" != none; then \
@OPENSSL@ sha1 $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(noinst_HEADERS) | @SED@ -n 's/SHA1(\(.*\))= \(.*\)/"\2 \1\\n"/p' > common_sha1.i; \ (cd "$(srcdir)" && @OPENSSL@ sha1 $(libor_SOURCES) $(libor_crypto_a_SOURCES) $(noinst_HEADERS)) | @SED@ -n 's/SHA1(\(.*\))= \(.*\)/"\2 \1\\n"/p' > common_sha1.i; \
else \ else \
rm common_sha1.i; \ rm common_sha1.i; \
touch common_sha1.i; \ touch common_sha1.i; \

View File

@ -126,8 +126,9 @@ tor_main.o: micro-revision.i
micro-revision.i: FORCE micro-revision.i: FORCE
@rm -f micro-revision.tmp; \ @rm -f micro-revision.tmp; \
if test -d ../../.git && test -x "`which git 2>&1;true`"; then \ if test -d "$(top_srcdir)/.git" && \
HASH="`git rev-parse --short=16 HEAD`"; \ test -x "`which git 2>&1;true`"; then \
HASH="`cd "$(top_srcdir)" && git rev-parse --short=16 HEAD`"; \
echo \"$$HASH\" > micro-revision.tmp; \ echo \"$$HASH\" > micro-revision.tmp; \
fi; \ fi; \
if test ! -f micro-revision.tmp ; then \ if test ! -f micro-revision.tmp ; then \
@ -141,10 +142,10 @@ micro-revision.i: FORCE
or_sha1.i: $(tor_SOURCES) $(libtor_a_SOURCES) or_sha1.i: $(tor_SOURCES) $(libtor_a_SOURCES)
if test "@SHA1SUM@" != none; then \ if test "@SHA1SUM@" != none; then \
@SHA1SUM@ $(tor_SOURCES) $(libtor_a_SOURCES) | \ (cd "$(srcdir)" && @SHA1SUM@ $(tor_SOURCES) $(libtor_a_SOURCES)) | \
@SED@ -n 's/^\(.*\)$$/"\1\\n"/p' > or_sha1.i; \ @SED@ -n 's/^\(.*\)$$/"\1\\n"/p' > or_sha1.i; \
elif test "@OPENSSL@" != none; then \ elif test "@OPENSSL@" != none; then \
@OPENSSL@ sha1 $(tor_SOURCES) $(libtor_a_SOURCES) | \ (cd "$(srcdir)" && @OPENSSL@ sha1 $(tor_SOURCES) $(libtor_a_SOURCES)) | \
@SED@ -n 's/SHA1(\(.*\))= \(.*\)/"\2 \1\\n"/p' > or_sha1.i; \ @SED@ -n 's/SHA1(\(.*\))= \(.*\)/"\2 \1\\n"/p' > or_sha1.i; \
else \ else \
rm or_sha1.i; \ rm or_sha1.i; \