Bug 944558 - Refactor config/makefiles/debugmake.mk for more correctness, and remove old cruft. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Sun, 01 Dec 2013 07:20:19 +0900
changeset 172808 13d5895309981dda01b10388080a79f1a92c0b55
parent 172807 0e4c943ef4a6b8e41651d975ac230dc98bc39ee5
child 172809 aaed10fb047dee2a615d74a1ad57a830446148dc
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs944558
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 944558 - Refactor config/makefiles/debugmake.mk for more correctness, and remove old cruft. r=gps Also remove use of print-depth-path.sh in UPDATE_TITLE.
build/unix/print-depth-path.sh
config/makefiles/debugmake.mk
config/rules.mk
js/src/config/makefiles/debugmake.mk
js/src/config/rules.mk
deleted file mode 100755
--- a/build/unix/print-depth-path.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#
-# This script will print the depth path for a mozilla directory based
-# on the info in Makefile
-#
-# It's a hack.  It's brute force.  It's horrible.  
-# It don't use Artificial Intelligence.  It don't use Virtual Reality.
-# It's not perl.  It's not python.   But it works.
-#
-# Usage: print-depth-path.sh
-#
-# Send comments, improvements, bugs to jim_nance@yahoo.com
-# 
-
-# Make sure a Makefile exists
-if [ ! -f Makefile ]
-then
-	echo
-	echo "There ain't no 'Makefile' over here: $pwd, dude."
-	echo
-
-	exit
-fi
-
-# awk can be quite primitave.  Try enhanced versions first
-for AWK in gawk nawk awk; do
-    if type $AWK 2>/dev/null 1>/dev/null; then
-        break;
-    fi
-done
-
-$AWK -v PWD=`pwd` '
-{
-    if($1 == "DEPTH") {
-        DEPTH=$0
-    }
-}
-
-END {
-    sub("^.*DEPTH.*=[ \t]*", "", DEPTH)
-    dlen = split(DEPTH, darray, "/")
-    plen = split(PWD,   parray, "/")
-
-    fsep=""
-    for(i=plen-dlen; i<=plen; i++) {
-        printf("%s%s", fsep, parray[i])
-        fsep="/"
-    }
-    printf("\n")
-}' Makefile
-
--- a/config/makefiles/debugmake.mk
+++ b/config/makefiles/debugmake.mk
@@ -8,110 +8,114 @@
 
 ###########################################################################
 ## Intent: Helper targets for displaying variables and state information
 ###########################################################################
 
 # Support usage outside of config/rules.mk
 ifndef INCLUDED_DEBUGMAKE_MK #{
 
+define shell_quote
+'$(subst ','\'',$(1))'
+endef
+
 echo-variable-%:
-	@echo "$($*)"
+	@echo $(call shell_quote,$($*))
 
 echo-tiers:
 	@echo $(TIERS)
 
 echo-tier-dirs:
-	@$(foreach tier,$(TIERS),echo '$(tier):'; echo '  dirs: $(tier_$(tier)_dirs)'; echo '  staticdirs: $(tier_$(tier)_staticdirs)'; )
+	@$(foreach tier,$(TIERS),echo '$(tier):'; echo '  dirs: $(tier_$(tier)_dirs)'; $(if $(tier_$(tier)_staticdirs),echo '  staticdirs: $(tier_$(tier)_staticdirs)';) )
 
 echo-dirs:
-	@echo $(DIRS)
+	@echo $(call shell_quote,$(DIRS))
 
-echo-module:
-	@echo $(MODULE)
+define print_var
+@printf '%20s = %s\n' $1 $(call shell_quote,$($1))
 
-echo-depth-path:
-	@$(topsrcdir)/build/unix/print-depth-path.sh
+endef
 
-echo-module-name:
-	@$(topsrcdir)/build/package/rpm/print-module-name.sh
-
-echo-module-filelist:
-	@$(topsrcdir)/build/package/rpm/print-module-filelist.sh
+define print_vars
+$(foreach var,$1,$(call print_var,$(var)))
+endef
 
 showtargs:
 ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
 	@echo --------------------------------------------------------------------------------
-	@echo "PROGRAM             = $(PROGRAM)"
-	@echo "SIMPLE_PROGRAMS     = $(SIMPLE_PROGRAMS)"
-	@echo "LIBRARY             = $(LIBRARY)"
-	@echo "SHARED_LIBRARY      = $(SHARED_LIBRARY)"
-	@echo "SHARED_LIBRARY_LIBS = $(SHARED_LIBRARY_LIBS)"
-	@echo "LIBS                = $(LIBS)"
-	@echo "DEF_FILE            = $(DEF_FILE)"
-	@echo "IMPORT_LIBRARY      = $(IMPORT_LIBRARY)"
-	@echo "STATIC_LIBS         = $(STATIC_LIBS)"
-	@echo "SHARED_LIBS         = $(SHARED_LIBS)"
-	@echo "EXTRA_DSO_LDOPTS    = $(EXTRA_DSO_LDOPTS)"
-	@echo "DEPENDENT_LIBS      = $(DEPENDENT_LIBS)"
+	$(call print_vars,\
+		PROGRAM \
+		SIMPLE_PROGRAMS \
+		LIBRARY \
+		SHARED_LIBRARY \
+		SHARED_LIBRARY_LIBS \
+		LIBS \
+		DEF_FILE \
+		IMPORT_LIBRARY \
+		STATIC_LIBS \
+		EXTRA_DSO_LDOPTS \
+		DEPENDENT_LIBS \
+	)
 	@echo --------------------------------------------------------------------------------
 endif
 	$(LOOP_OVER_PARALLEL_DIRS)
 	$(LOOP_OVER_DIRS)
+	$(LOOP_OVER_TOOL_DIRS)
 
 showbuild:
-	@echo "MOZ_BUILD_ROOT     = $(MOZ_BUILD_ROOT)"
-	@echo "MOZ_WIDGET_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)"
-	@echo "CC                 = $(CC)"
-	@echo "CXX                = $(CXX)"
-	@echo "CCC                = $(CCC)"
-	@echo "CPP                = $(CPP)"
-	@echo "LD                 = $(LD)"
-	@echo "AR                 = $(AR)"
-	@echo "IMPLIB             = $(IMPLIB)"
-	@echo "FILTER             = $(FILTER)"
-	@echo "MKSHLIB            = $(MKSHLIB)"
-	@echo "MKCSHLIB           = $(MKCSHLIB)"
-	@echo "RC                 = $(RC)"
-	@echo "MC                 = $(MC)"
-	@echo "CFLAGS             = $(CFLAGS)"
-	@echo "OS_CFLAGS          = $(OS_CFLAGS)"
-	@echo "COMPILE_CFLAGS     = $(COMPILE_CFLAGS)"
-	@echo "CXXFLAGS           = $(CXXFLAGS)"
-	@echo "OS_CXXFLAGS        = $(OS_CXXFLAGS)"
-	@echo "COMPILE_CXXFLAGS   = $(COMPILE_CXXFLAGS)"
-	@echo "COMPILE_CMFLAGS    = $(COMPILE_CMFLAGS)"
-	@echo "COMPILE_CMMFLAGS   = $(COMPILE_CMMFLAGS)"
-	@echo "LDFLAGS            = $(LDFLAGS)"
-	@echo "OS_LDFLAGS         = $(OS_LDFLAGS)"
-	@echo "DSO_LDOPTS         = $(DSO_LDOPTS)"
-	@echo "OS_INCLUDES        = $(OS_INCLUDES)"
-	@echo "OS_LIBS            = $(OS_LIBS)"
-	@echo "EXTRA_LIBS         = $(EXTRA_LIBS)"
-	@echo "BIN_FLAGS          = $(BIN_FLAGS)"
-	@echo "INCLUDES           = $(INCLUDES)"
-	@echo "DEFINES            = $(DEFINES)"
-	@echo "ACDEFINES          = $(ACDEFINES)"
-	@echo "BIN_SUFFIX         = $(BIN_SUFFIX)"
-	@echo "LIB_SUFFIX         = $(LIB_SUFFIX)"
-	@echo "DLL_SUFFIX         = $(DLL_SUFFIX)"
-	@echo "IMPORT_LIB_SUFFIX  = $(IMPORT_LIB_SUFFIX)"
-	@echo "INSTALL            = $(INSTALL)"
-	@echo "VPATH              = $(VPATH)"
+	$(call print_vars,\
+		MOZ_BUILD_ROOT \
+		MOZ_WIDGET_TOOLKIT \
+		CC \
+		CXX \
+		CCC \
+		CPP \
+		LD \
+		AR \
+		IMPLIB \
+		FILTER \
+		MKSHLIB \
+		MKCSHLIB \
+		RC \
+		MC \
+		CFLAGS \
+		OS_CFLAGS \
+		COMPILE_CFLAGS \
+		CXXFLAGS \
+		OS_CXXFLAGS \
+		COMPILE_CXXFLAGS \
+		COMPILE_CMFLAGS \
+		COMPILE_CMMFLAGS \
+		LDFLAGS \
+		OS_LDFLAGS \
+		DSO_LDOPTS \
+		OS_INCLUDES \
+		OS_LIBS \
+		EXTRA_LIBS \
+		BIN_FLAGS \
+		INCLUDES \
+		DEFINES \
+		ACDEFINES \
+		BIN_SUFFIX \
+		LIB_SUFFIX \
+		DLL_SUFFIX \
+		IMPORT_LIB_SUFFIX \
+		INSTALL \
+		VPATH \
+	)
 
 showhost:
-	@echo "HOST_CC            = $(HOST_CC)"
-	@echo "HOST_CXX           = $(HOST_CXX)"
-	@echo "HOST_CFLAGS        = $(HOST_CFLAGS)"
-	@echo "HOST_LDFLAGS       = $(HOST_LDFLAGS)"
-	@echo "HOST_LIBS          = $(HOST_LIBS)"
-	@echo "HOST_EXTRA_LIBS    = $(HOST_EXTRA_LIBS)"
-	@echo "HOST_EXTRA_DEPS    = $(HOST_EXTRA_DEPS)"
-	@echo "HOST_PROGRAM       = $(HOST_PROGRAM)"
-	@echo "HOST_OBJS          = $(HOST_OBJS)"
-	@echo "HOST_PROGOBJS      = $(HOST_PROGOBJS)"
-	@echo "HOST_LIBRARY       = $(HOST_LIBRARY)"
-
-showbuildmods::
-	@echo "Module dirs	= $(BUILD_MODULE_DIRS)"
+	$(call print_vars,\
+		HOST_CC \
+		HOST_CXX \
+		HOST_CFLAGS \
+		HOST_LDFLAGS \
+		HOST_LIBS \
+		HOST_EXTRA_LIBS \
+		HOST_EXTRA_DEPS \
+		HOST_PROGRAM \
+		HOST_OBJS \
+		HOST_PROGOBJS \
+		HOST_LIBRARY \
+	)
 
 INCLUDED_DEBUGMAKE_MK = 1
 endif #}
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -359,17 +359,17 @@ endif
 ifeq ($(SOLARIS_SUNPRO_CXX),1)
 GARBAGE_DIRS += SunWS_cache
 endif
 
 ifdef MOZ_UPDATE_XTERM
 # Its good not to have a newline at the end of the titlebar string because it
 # makes the make -s output easier to read.  Echo -n does not work on all
 # platforms, but we can trick printf into doing it.
-UPDATE_TITLE = printf "\033]0;%s in %s\007" $(1) $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$(2) ;
+UPDATE_TITLE = printf "\033]0;%s in %s\007" $(1) $(relativesrcdir)/$(2) ;
 endif
 
 ifdef MACH
 ifndef NO_BUILDSTATUS_MESSAGES
 define BUILDSTATUS
 @echo "BUILDSTATUS $1"
 
 endef
--- a/js/src/config/makefiles/debugmake.mk
+++ b/js/src/config/makefiles/debugmake.mk
@@ -8,110 +8,114 @@
 
 ###########################################################################
 ## Intent: Helper targets for displaying variables and state information
 ###########################################################################
 
 # Support usage outside of config/rules.mk
 ifndef INCLUDED_DEBUGMAKE_MK #{
 
+define shell_quote
+'$(subst ','\'',$(1))'
+endef
+
 echo-variable-%:
-	@echo "$($*)"
+	@echo $(call shell_quote,$($*))
 
 echo-tiers:
 	@echo $(TIERS)
 
 echo-tier-dirs:
-	@$(foreach tier,$(TIERS),echo '$(tier):'; echo '  dirs: $(tier_$(tier)_dirs)'; echo '  staticdirs: $(tier_$(tier)_staticdirs)'; )
+	@$(foreach tier,$(TIERS),echo '$(tier):'; echo '  dirs: $(tier_$(tier)_dirs)'; $(if $(tier_$(tier)_staticdirs),echo '  staticdirs: $(tier_$(tier)_staticdirs)';) )
 
 echo-dirs:
-	@echo $(DIRS)
+	@echo $(call shell_quote,$(DIRS))
 
-echo-module:
-	@echo $(MODULE)
+define print_var
+@printf '%20s = %s\n' $1 $(call shell_quote,$($1))
 
-echo-depth-path:
-	@$(topsrcdir)/build/unix/print-depth-path.sh
+endef
 
-echo-module-name:
-	@$(topsrcdir)/build/package/rpm/print-module-name.sh
-
-echo-module-filelist:
-	@$(topsrcdir)/build/package/rpm/print-module-filelist.sh
+define print_vars
+$(foreach var,$1,$(call print_var,$(var)))
+endef
 
 showtargs:
 ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
 	@echo --------------------------------------------------------------------------------
-	@echo "PROGRAM             = $(PROGRAM)"
-	@echo "SIMPLE_PROGRAMS     = $(SIMPLE_PROGRAMS)"
-	@echo "LIBRARY             = $(LIBRARY)"
-	@echo "SHARED_LIBRARY      = $(SHARED_LIBRARY)"
-	@echo "SHARED_LIBRARY_LIBS = $(SHARED_LIBRARY_LIBS)"
-	@echo "LIBS                = $(LIBS)"
-	@echo "DEF_FILE            = $(DEF_FILE)"
-	@echo "IMPORT_LIBRARY      = $(IMPORT_LIBRARY)"
-	@echo "STATIC_LIBS         = $(STATIC_LIBS)"
-	@echo "SHARED_LIBS         = $(SHARED_LIBS)"
-	@echo "EXTRA_DSO_LDOPTS    = $(EXTRA_DSO_LDOPTS)"
-	@echo "DEPENDENT_LIBS      = $(DEPENDENT_LIBS)"
+	$(call print_vars,\
+		PROGRAM \
+		SIMPLE_PROGRAMS \
+		LIBRARY \
+		SHARED_LIBRARY \
+		SHARED_LIBRARY_LIBS \
+		LIBS \
+		DEF_FILE \
+		IMPORT_LIBRARY \
+		STATIC_LIBS \
+		EXTRA_DSO_LDOPTS \
+		DEPENDENT_LIBS \
+	)
 	@echo --------------------------------------------------------------------------------
 endif
 	$(LOOP_OVER_PARALLEL_DIRS)
 	$(LOOP_OVER_DIRS)
+	$(LOOP_OVER_TOOL_DIRS)
 
 showbuild:
-	@echo "MOZ_BUILD_ROOT     = $(MOZ_BUILD_ROOT)"
-	@echo "MOZ_WIDGET_TOOLKIT = $(MOZ_WIDGET_TOOLKIT)"
-	@echo "CC                 = $(CC)"
-	@echo "CXX                = $(CXX)"
-	@echo "CCC                = $(CCC)"
-	@echo "CPP                = $(CPP)"
-	@echo "LD                 = $(LD)"
-	@echo "AR                 = $(AR)"
-	@echo "IMPLIB             = $(IMPLIB)"
-	@echo "FILTER             = $(FILTER)"
-	@echo "MKSHLIB            = $(MKSHLIB)"
-	@echo "MKCSHLIB           = $(MKCSHLIB)"
-	@echo "RC                 = $(RC)"
-	@echo "MC                 = $(MC)"
-	@echo "CFLAGS             = $(CFLAGS)"
-	@echo "OS_CFLAGS          = $(OS_CFLAGS)"
-	@echo "COMPILE_CFLAGS     = $(COMPILE_CFLAGS)"
-	@echo "CXXFLAGS           = $(CXXFLAGS)"
-	@echo "OS_CXXFLAGS        = $(OS_CXXFLAGS)"
-	@echo "COMPILE_CXXFLAGS   = $(COMPILE_CXXFLAGS)"
-	@echo "COMPILE_CMFLAGS    = $(COMPILE_CMFLAGS)"
-	@echo "COMPILE_CMMFLAGS   = $(COMPILE_CMMFLAGS)"
-	@echo "LDFLAGS            = $(LDFLAGS)"
-	@echo "OS_LDFLAGS         = $(OS_LDFLAGS)"
-	@echo "DSO_LDOPTS         = $(DSO_LDOPTS)"
-	@echo "OS_INCLUDES        = $(OS_INCLUDES)"
-	@echo "OS_LIBS            = $(OS_LIBS)"
-	@echo "EXTRA_LIBS         = $(EXTRA_LIBS)"
-	@echo "BIN_FLAGS          = $(BIN_FLAGS)"
-	@echo "INCLUDES           = $(INCLUDES)"
-	@echo "DEFINES            = $(DEFINES)"
-	@echo "ACDEFINES          = $(ACDEFINES)"
-	@echo "BIN_SUFFIX         = $(BIN_SUFFIX)"
-	@echo "LIB_SUFFIX         = $(LIB_SUFFIX)"
-	@echo "DLL_SUFFIX         = $(DLL_SUFFIX)"
-	@echo "IMPORT_LIB_SUFFIX  = $(IMPORT_LIB_SUFFIX)"
-	@echo "INSTALL            = $(INSTALL)"
-	@echo "VPATH              = $(VPATH)"
+	$(call print_vars,\
+		MOZ_BUILD_ROOT \
+		MOZ_WIDGET_TOOLKIT \
+		CC \
+		CXX \
+		CCC \
+		CPP \
+		LD \
+		AR \
+		IMPLIB \
+		FILTER \
+		MKSHLIB \
+		MKCSHLIB \
+		RC \
+		MC \
+		CFLAGS \
+		OS_CFLAGS \
+		COMPILE_CFLAGS \
+		CXXFLAGS \
+		OS_CXXFLAGS \
+		COMPILE_CXXFLAGS \
+		COMPILE_CMFLAGS \
+		COMPILE_CMMFLAGS \
+		LDFLAGS \
+		OS_LDFLAGS \
+		DSO_LDOPTS \
+		OS_INCLUDES \
+		OS_LIBS \
+		EXTRA_LIBS \
+		BIN_FLAGS \
+		INCLUDES \
+		DEFINES \
+		ACDEFINES \
+		BIN_SUFFIX \
+		LIB_SUFFIX \
+		DLL_SUFFIX \
+		IMPORT_LIB_SUFFIX \
+		INSTALL \
+		VPATH \
+	)
 
 showhost:
-	@echo "HOST_CC            = $(HOST_CC)"
-	@echo "HOST_CXX           = $(HOST_CXX)"
-	@echo "HOST_CFLAGS        = $(HOST_CFLAGS)"
-	@echo "HOST_LDFLAGS       = $(HOST_LDFLAGS)"
-	@echo "HOST_LIBS          = $(HOST_LIBS)"
-	@echo "HOST_EXTRA_LIBS    = $(HOST_EXTRA_LIBS)"
-	@echo "HOST_EXTRA_DEPS    = $(HOST_EXTRA_DEPS)"
-	@echo "HOST_PROGRAM       = $(HOST_PROGRAM)"
-	@echo "HOST_OBJS          = $(HOST_OBJS)"
-	@echo "HOST_PROGOBJS      = $(HOST_PROGOBJS)"
-	@echo "HOST_LIBRARY       = $(HOST_LIBRARY)"
-
-showbuildmods::
-	@echo "Module dirs	= $(BUILD_MODULE_DIRS)"
+	$(call print_vars,\
+		HOST_CC \
+		HOST_CXX \
+		HOST_CFLAGS \
+		HOST_LDFLAGS \
+		HOST_LIBS \
+		HOST_EXTRA_LIBS \
+		HOST_EXTRA_DEPS \
+		HOST_PROGRAM \
+		HOST_OBJS \
+		HOST_PROGOBJS \
+		HOST_LIBRARY \
+	)
 
 INCLUDED_DEBUGMAKE_MK = 1
 endif #}
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -359,17 +359,17 @@ endif
 ifeq ($(SOLARIS_SUNPRO_CXX),1)
 GARBAGE_DIRS += SunWS_cache
 endif
 
 ifdef MOZ_UPDATE_XTERM
 # Its good not to have a newline at the end of the titlebar string because it
 # makes the make -s output easier to read.  Echo -n does not work on all
 # platforms, but we can trick printf into doing it.
-UPDATE_TITLE = printf "\033]0;%s in %s\007" $(1) $(shell $(BUILD_TOOLS)/print-depth-path.sh)/$(2) ;
+UPDATE_TITLE = printf "\033]0;%s in %s\007" $(1) $(relativesrcdir)/$(2) ;
 endif
 
 ifdef MACH
 ifndef NO_BUILDSTATUS_MESSAGES
 define BUILDSTATUS
 @echo "BUILDSTATUS $1"
 
 endef