1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/devtools/rootAnalysis/Makefile.in Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,79 @@ 1.4 +# -*- Mode: makefile -*- 1.5 +# 1.6 +# This Source Code Form is subject to the terms of the Mozilla Public 1.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.9 + 1.10 +# This Makefile is used to kick off a static rooting analysis. This Makefile is 1.11 +# NOT intended for use as part of the standard Mozilla build. Instead, this 1.12 +# Makefile will use $PATH to subvert compiler invocations to add in the sixgill 1.13 +# plugin, and then do a regular build of whatever portion of the tree you are 1.14 +# analyzing. The plugins will dump out several xdb database files. Various 1.15 +# analysis scripts, written in JS, will run over those database files to 1.16 +# produce the final analysis output. 1.17 + 1.18 +include $(topsrcdir)/config/config.mk 1.19 + 1.20 +# Tree to build and analyze, defaulting to the current tree 1.21 +TARGET_JSOBJDIR ?= $(MOZ_BUILD_ROOT) 1.22 + 1.23 +# Path to a JS binary to use to run the analysis. You really want this to be an 1.24 +# optimized build. 1.25 +JS ?= $(MOZ_BUILD_ROOT)/shell/js 1.26 + 1.27 +# Path to an xgill checkout containing the GCC plugin, xdb-processing binaries, 1.28 +# and compiler wrapper scripts used to automatically integrate into an existing 1.29 +# build system. 1.30 +SIXGILL ?= @SIXGILL_PATH@ 1.31 + 1.32 +# Path to the JS scripts that will perform the analysis, defaulting to the same 1.33 +# place as this Makefile.in, which is probably what you want. 1.34 +ANALYSIS_SCRIPT_DIR ?= $(srcdir) 1.35 + 1.36 +# Number of simultanous analyzeRoots.js scripts to run. 1.37 +JOBS ?= 6 1.38 + 1.39 +all : rootingHazards.txt allFunctions.txt 1.40 + 1.41 +CALL_JS := time env PATH=$$PATH:$(SIXGILL)/bin XDB=$(SIXGILL)/bin/xdb.so $(JS) 1.42 + 1.43 +src_body.xdb src_comp.xdb: run_complete 1.44 + @echo Started compilation at $$(date) 1.45 + $(ANALYSIS_SCRIPT_DIR)/run_complete --foreground --build-root=$(TARGET_JSOBJDIR) --work-dir=work -b $(SIXGILL)/bin $(CURDIR) 1.46 + @echo Finished compilation at $$(date) 1.47 + 1.48 +callgraph.txt: src_body.xdb src_comp.xdb computeCallgraph.js 1.49 + @echo Started computation of $@ at $$(date) 1.50 + $(CALL_JS) $(ANALYSIS_SCRIPT_DIR)/computeCallgraph.js > $@.tmp 1.51 + mv $@.tmp $@ 1.52 + @echo Finished computation of $@ at $$(date) 1.53 + 1.54 +gcFunctions.txt: callgraph.txt computeGCFunctions.js annotations.js 1.55 + @echo Started computation of $@ at $$(date) 1.56 + $(CALL_JS) $(ANALYSIS_SCRIPT_DIR)/computeGCFunctions.js ./callgraph.txt > $@.tmp 1.57 + mv $@.tmp $@ 1.58 + @echo Finished computation of $@ at $$(date) 1.59 + 1.60 +gcFunctions.lst: gcFunctions.txt 1.61 + perl -lne 'print $$1 if /^GC Function: (.*)/' gcFunctions.txt > $@ 1.62 + 1.63 +suppressedFunctions.lst: gcFunctions.txt 1.64 + perl -lne 'print $$1 if /^Suppressed Function: (.*)/' gcFunctions.txt > $@ 1.65 + 1.66 +gcTypes.txt: src_comp.xdb computeGCTypes.js annotations.js 1.67 + @echo Started computation of $@ at $$(date) 1.68 + $(CALL_JS) $(ANALYSIS_SCRIPT_DIR)/computeGCTypes.js > $@.tmp 1.69 + mv $@.tmp $@ 1.70 + @echo Finished computation of $@ at $$(date) 1.71 + 1.72 +allFunctions.txt: src_body.xdb 1.73 + @echo Started computation of $@ at $$(date) 1.74 + time $(SIXGILL)/bin/xdbkeys $^ > $@.tmp 1.75 + mv $@.tmp $@ 1.76 + @echo Finished computation of $@ at $$(date) 1.77 + 1.78 +rootingHazards.txt: gcFunctions.lst suppressedFunctions.lst gcTypes.txt analyzeRoots.js annotations.js gen-hazards.sh 1.79 + @echo Started computation of $@ at $$(date) 1.80 + time env JS=$(JS) ANALYZE='$(ANALYSIS_SCRIPT_DIR)/analyzeRoots.js' SIXGILL='$(SIXGILL)' '$(ANALYSIS_SCRIPT_DIR)/gen-hazards.sh' $(JOBS) > $@.tmp 1.81 + mv $@.tmp $@ 1.82 + @echo Finished computation of $@ at $$(date)