bug 476163 - consolidate makefile cruft for generating automation.py. r=bsmedberg
authorTed Mielczarek <ted.mielczarek@gmail.com>
Thu, 12 Feb 2009 08:49:53 -0500
changeset 24961 ee4fde1683df2ecdf988804665242cc61a822b62
parent 24960 29d0e3e2bee01c26affb2de0bb36c484b3305139
child 24962 e94509d21882f52c2d26cea0607e48d4a2248766
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs476163
milestone1.9.2a1pre
bug 476163 - consolidate makefile cruft for generating automation.py. r=bsmedberg
build/Makefile.in
build/automation-build.mk
build/automation.py.in
build/pgo/Makefile.in
build/pgo/automation.py.in
testing/mochitest/Makefile.in
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -56,89 +56,29 @@ endif
 ifdef WINCE
 DIRS += wince/tools wince/shunt
 endif
 
 DIRS += pgo
 
 include $(topsrcdir)/config/rules.mk
 
-
-ifeq ($(USE_SHORT_LIBNAME), 1)
-PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
-else
-PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
-endif
-
-ifeq ($(MOZ_BUILD_APP),camino)
-browser_path = \"$(DIST)/Camino.app/Contents/MacOS/Camino\"
-else
-ifeq ($(OS_ARCH),Darwin)
-ifdef MOZ_DEBUG
-browser_path = \"$(DIST)/$(MOZ_APP_DISPLAYNAME)Debug.app/Contents/MacOS/$(PROGRAM)\"
-else
-browser_path = \"$(DIST)/$(MOZ_APP_DISPLAYNAME).app/Contents/MacOS/$(PROGRAM)\"
-endif
-else
-browser_path = \"$(DIST)/bin/$(PROGRAM)\"
-endif
-endif
-
-_PROFILE_DIR = ../_profile/pgo
-_CERTS_SRC_DIR = $(srcdir)/pgo/certs
-
-AUTOMATION_PPARGS = 	\
-			-DBROWSER_PATH=$(browser_path) \
-			-DXPC_BIN_PATH=\"$(LIBXUL_DIST)/bin\" \
-			-DBIN_SUFFIX=\"$(BIN_SUFFIX)\" \
-			-DPROFILE_DIR=\"$(_PROFILE_DIR)\" \
-			-DCERTS_SRC_DIR=\"$(_CERTS_SRC_DIR)\" \
-			$(NULL)
-
-ifeq ($(OS_ARCH),Darwin)
-AUTOMATION_PPARGS += -DIS_MAC=1
-else
-AUTOMATION_PPARGS += -DIS_MAC=0
-endif
-
-ifeq ($(MOZ_BUILD_APP),camino)
-AUTOMATION_PPARGS += -DIS_CAMINO=1
-else
-AUTOMATION_PPARGS += -DIS_CAMINO=0
-endif
-
-ifeq ($(host_os), cygwin)
-AUTOMATION_PPARGS += -DIS_CYGWIN=1
-endif
-
-ifeq ($(ENABLE_TESTS), 1)
-AUTOMATION_PPARGS += -DIS_TEST_BUILD=1
-else
-AUTOMATION_PPARGS += -DIS_TEST_BUILD=0
-endif
-
-ifeq ($(MOZ_DEBUG), 1)
-AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=1
-else
-AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=0
-endif
+# we install to _leaktest/
+TARGET_DEPTH = ..
+include $(srcdir)/automation-build.mk
 
 _LEAKTEST_DIR = $(DEPTH)/_leaktest
 
 _LEAKTEST_FILES =    \
 		automation.py \
 		leaktest.py \
 		bloatcycle.html \
 		$(topsrcdir)/build/pgo/server-locations.txt \
 		$(NULL)
 
-automation.py: $(topsrcdir)/build/pgo/automation.py.in
-	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
-	$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ > $@
-
 leaktest.py: leaktest.py.in
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $^ > $@
 	chmod +x $@
 
 libs:: $(_LEAKTEST_FILES)
 	$(INSTALL) $^ $(_LEAKTEST_DIR)
 
 ifdef ENABLE_TESTS
new file mode 100644
--- /dev/null
+++ b/build/automation-build.mk
@@ -0,0 +1,65 @@
+
+ifeq ($(USE_SHORT_LIBNAME), 1)
+PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
+else
+PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
+endif
+
+TARGET_DIST = $(TARGET_DEPTH)/dist
+
+ifeq ($(MOZ_BUILD_APP),camino)
+browser_path = \"$(TARGET_DIST)/Camino.app/Contents/MacOS/Camino\"
+else
+ifeq ($(OS_ARCH),Darwin)
+ifdef MOZ_DEBUG
+browser_path = \"($(TARGET_DIST)/$(MOZ_APP_DISPLAYNAME)Debug.app/Contents/MacOS/$(PROGRAM)\"
+else
+browser_path = \"$(TARGET_DIST)/$(MOZ_APP_DISPLAYNAME).app/Contents/MacOS/$(PROGRAM)\"
+endif
+else
+browser_path = \"$(TARGET_DIST)/bin/$(PROGRAM)\"
+endif
+endif
+
+_PROFILE_DIR = $(TARGET_DEPTH)/_profile/pgo
+_CERTS_SRC_DIR = $(topsrcdir)/build/pgo/certs
+
+AUTOMATION_PPARGS = 	\
+			-DBROWSER_PATH=$(browser_path) \
+			-DXPC_BIN_PATH=\"$(LIBXUL_DIST)/bin\" \
+			-DBIN_SUFFIX=\"$(BIN_SUFFIX)\" \
+			-DPROFILE_DIR=\"$(_PROFILE_DIR)\" \
+			-DCERTS_SRC_DIR=\"$(_CERTS_SRC_DIR)\" \
+			$(NULL)
+
+ifeq ($(OS_ARCH),Darwin)
+AUTOMATION_PPARGS += -DIS_MAC=1
+else
+AUTOMATION_PPARGS += -DIS_MAC=0
+endif
+
+ifeq ($(MOZ_BUILD_APP),camino)
+AUTOMATION_PPARGS += -DIS_CAMINO=1
+else
+AUTOMATION_PPARGS += -DIS_CAMINO=0
+endif
+
+ifeq ($(host_os), cygwin)
+AUTOMATION_PPARGS += -DIS_CYGWIN=1
+endif
+
+ifeq ($(ENABLE_TESTS), 1)
+AUTOMATION_PPARGS += -DIS_TEST_BUILD=1
+else
+AUTOMATION_PPARGS += -DIS_TEST_BUILD=0
+endif
+
+ifeq ($(MOZ_DEBUG), 1)
+AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=1
+else
+AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=0
+endif
+
+automation.py: $(topsrcdir)/build/automation.py.in
+	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
+	$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
rename from build/pgo/automation.py.in
rename to build/automation.py.in
--- a/build/pgo/Makefile.in
+++ b/build/pgo/Makefile.in
@@ -46,89 +46,31 @@ include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   blueprint \
   js-input \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
+# We install to _profile/pgo
+TARGET_DEPTH = ../..
+include $(topsrcdir)/build/automation-build.mk
+
 # Stuff to make a build with a profile
-_PROFILE_DIR = $(DEPTH)/_profile/pgo
-_CERTS_SRC_DIR = $(srcdir)/certs
 
 _PGO_FILES = 	\
   automation.py \
   profileserver.py \
   genpgocert.py \
   index.html \
   server-locations.txt \
   favicon.ico \
   $(NULL)
 
-ifeq ($(USE_SHORT_LIBNAME), 1)
-PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
-else
-PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
-endif
-
-ifeq ($(MOZ_BUILD_APP),camino)
-browser_path = \"$(DIST)/Camino.app/Contents/MacOS/Camino\"
-else
-ifeq ($(OS_ARCH),Darwin)
-ifdef MOZ_DEBUG
-browser_path = \"$(DIST)/$(MOZ_APP_DISPLAYNAME)Debug.app/Contents/MacOS/$(PROGRAM)\"
-else
-browser_path = \"$(DIST)/$(MOZ_APP_DISPLAYNAME).app/Contents/MacOS/$(PROGRAM)\"
-endif
-else
-browser_path = \"$(DIST)/bin/$(PROGRAM)\"
-endif
-endif
-
-AUTOMATION_PPARGS = 	\
-			-DBROWSER_PATH=$(browser_path) \
-			-DXPC_BIN_PATH=\"$(LIBXUL_DIST)/bin\" \
-			-DBIN_SUFFIX=\"$(BIN_SUFFIX)\" \
-			-DPROFILE_DIR=\"$(_PROFILE_DIR)\" \
-			-DCERTS_SRC_DIR=\"$(_CERTS_SRC_DIR)\" \
-			$(NULL)
-
-ifeq ($(OS_ARCH),Darwin)
-AUTOMATION_PPARGS += -DIS_MAC=1
-else
-AUTOMATION_PPARGS += -DIS_MAC=0
-endif
-
-ifeq ($(MOZ_BUILD_APP),camino)
-AUTOMATION_PPARGS += -DIS_CAMINO=1
-else
-AUTOMATION_PPARGS += -DIS_CAMINO=0
-endif
-
-ifeq ($(host_os), cygwin)
-AUTOMATION_PPARGS += -DIS_CYGWIN=1
-endif
-
-ifeq ($(ENABLE_TESTS), 1)
-AUTOMATION_PPARGS += -DIS_TEST_BUILD=1
-else
-AUTOMATION_PPARGS += -DIS_TEST_BUILD=0
-endif
-
-ifeq ($(MOZ_DEBUG), 1)
-AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=1
-else
-AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=0
-endif
-
-automation.py: automation.py.in
-	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
-	$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ > $@
-
 genpgocert.py: genpgocert.py.in
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
 	$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ > $@
 
 profileserver.py: profileserver.py.in
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $^ > $@
 	chmod +x $@
 
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -46,16 +46,20 @@ include $(DEPTH)/config/autoconf.mk
 DIRS =	MochiKit \
 	static \
 	tests \
 	chrome \
 	ssltunnel \
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
+# We're installing to _tests/testing/mochitest, so this is the depth
+# necessary for relative objdir paths.
+TARGET_DEPTH = ../../..
+include $(topsrcdir)/build/automation-build.mk
 
 # files that get copied into $objdir/_tests/
 _SERV_FILES = 	\
 		runtests.py \
 		automation.py \
 		gen_template.pl \
 		server.js \
 		harness-a11y.xul \
@@ -69,85 +73,22 @@ include $(topsrcdir)/config/rules.mk
 		redirect.js \
 		$(topsrcdir)/build/pgo/server-locations.txt \
 		$(topsrcdir)/netwerk/test/httpserver/httpd.js \
 		mozprefs.js \
 		$(NULL)	
 
 
 _DEST_DIR = $(DEPTH)/_tests/$(relativesrcdir)
-_PROFILE_DIR = $(DEPTH)/_profile/pgo
-_CERTS_SRC_DIR = $(topsrcdir)/build/pgo/certs
-
-ifeq ($(USE_SHORT_LIBNAME), 1)
-PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
-else
-PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
-endif
-
-ifeq ($(MOZ_BUILD_APP),camino)
-browser_path = \"../$(DIST)/Camino.app/Contents/MacOS/Camino\"
-else
-ifeq ($(OS_ARCH),Darwin)
-ifdef MOZ_DEBUG
-browser_path = \"../$(DIST)/$(MOZ_APP_DISPLAYNAME)Debug.app/Contents/MacOS/$(PROGRAM)\"
-else
-browser_path = \"../$(DIST)/$(MOZ_APP_DISPLAYNAME).app/Contents/MacOS/$(PROGRAM)\"
-endif
-else
-browser_path = \"../$(DIST)/bin/$(PROGRAM)\"
-endif
-endif
-
-# These go in _tests/ so they need to go up an extra path segement
-TEST_DRIVER_PPARGS = 	\
-			-DBROWSER_PATH=$(browser_path) \
-			-DXPC_BIN_PATH=\"$(LIBXUL_DIST)/bin\" \
-			-DBIN_SUFFIX=\"$(BIN_SUFFIX)\" \
-			-DPROFILE_DIR=\"../$(_PROFILE_DIR)\" \
-			-DCERTS_SRC_DIR=\"$(_CERTS_SRC_DIR)\" \
-			$(NULL)
-
-ifeq ($(OS_ARCH),Darwin)
-TEST_DRIVER_PPARGS += -DIS_MAC=1
-else
-TEST_DRIVER_PPARGS += -DIS_MAC=0
-endif
-
-ifeq ($(MOZ_BUILD_APP),camino)
-TEST_DRIVER_PPARGS += -DIS_CAMINO=1
-else
-TEST_DRIVER_PPARGS += -DIS_CAMINO=0
-endif
-
-ifeq ($(host_os), cygwin)
-TEST_DRIVER_PPARGS += -DIS_CYGWIN=1
-endif
-
-ifeq ($(ENABLE_TESTS), 1)
-TEST_DRIVER_PPARGS += -DIS_TEST_BUILD=1
-else
-TEST_DRIVER_PPARGS += -DIS_TEST_BUILD=0
-endif
-
-ifeq ($(MOZ_DEBUG), 1)
-TEST_DRIVER_PPARGS += -DIS_DEBUG_BUILD=1
-else
-TEST_DRIVER_PPARGS += -DIS_DEBUG_BUILD=0
-endif
 
 runtests.py: runtests.py.in
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
-	$(TEST_DRIVER_PPARGS) $(DEFINES) $(ACDEFINES) $^ > $@
+	$(DEFINES) $(ACDEFINES) $^ > $@
 
-automation.py: $(topsrcdir)/build/pgo/automation.py.in
-	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
-	$(TEST_DRIVER_PPARGS) $(DEFINES) $(ACDEFINES) $^ > $@
-
-GARBAGE += runtests.py automation.py
+GARBAGE += automation.py runtests.py
 
 libs:: $(_SERV_FILES)
 	$(INSTALL) $^ $(_DEST_DIR)
 
 # Binaries that don't get packaged with the build,
 # but that we need for the test harness
 TEST_HARNESS_BINS := \
   xpcshell$(BIN_SUFFIX) \