From a97cd074ff30cb8dde020de1cc4899c018ab2ecd Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Wed, 19 Sep 2007 12:28:30 -0700
Subject: [PATCH] Makefile: use .built to only require one tahoe-compile pass

---
 .darcs-boringfile |  2 ++
 Makefile          | 16 +++++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/.darcs-boringfile b/.darcs-boringfile
index dd8fa277..f3952a58 100644
--- a/.darcs-boringfile
+++ b/.darcs-boringfile
@@ -87,3 +87,5 @@
 ^src/allmydata/Crypto/[^/]*/.*\.so$
 
 ^\.checked-deps$
+^\.built$
+
diff --git a/Makefile b/Makefile
index ac9d12b5..d4b61066 100644
--- a/Makefile
+++ b/Makefile
@@ -57,7 +57,9 @@ endif
 
 TRIAL=$(PYTHON) -u "$(TRIALPATH)" --rterrors $(REACTOROPT)
 
-build-deps: build
+# build-deps wants setuptools to have been built first. It's easiest to
+# accomplish this by depending upon the tahoe compile.
+build-deps: .built
 	mkdir -p "$(SUPPORTLIB)"
 	PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)$(PATHSEP)." \
          $(PYTHON) misc/dependencies/build-deps-setup.py install \
@@ -73,6 +75,10 @@ PP=PYTHONPATH="$(SRCPATH)$(PATHSEP)$(EGGSPATH)$(PATHSEP)$(PYTHONPATH)"
 make-version:
 	$(PYTHON) misc/make-version.py "allmydata-tahoe" "src/allmydata/_version.py"
 
+.built:
+	$(MAKE) build
+	touch .built
+
 build: make-version
 	$(PYTHON) ./setup.py build_ext -i
 	chmod +x bin/allmydata-tahoe
@@ -115,11 +121,11 @@ TEST=allmydata
 # use 'make test REPORTER=--reporter=bwverbose' from buildbot, to
 # suppress the ansi color sequences
 
-test: build .checked-deps
+test: .built .checked-deps
 	$(PP) \
 	 $(TRIAL) $(REPORTER) $(TEST)
 
-test-figleaf: build .checked-deps
+test-figleaf: .built .checked-deps
 	rm -f .figleaf
 	$(PP) \
 	 $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
@@ -169,7 +175,7 @@ count-lines:
 	@echo -n "TODO: "
 	@grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
 
-check-memory: build
+check-memory: .built
 	rm -rf _test_memory
 	$(PP) \
 	 $(PYTHON) src/allmydata/test/check_memory.py upload
@@ -197,7 +203,7 @@ test-clean:
 	diff allfiles.tmp.old allfiles.tmp.new
 
 clean:
-	rm -rf build _trial_temp _test_memory .checked-deps
+	rm -rf build _trial_temp _test_memory .checked-deps .built
 	rm -f debian
 	rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'`
 	rm -rf tahoe_deps.egg-info allmydata_tahoe.egg-info
-- 
2.45.2