include $(topsrcdir)/config/config.mk
TARGET_JSOBJDIR ?= $(MOZ_BUILD_ROOT)
JS ?= $(MOZ_BUILD_ROOT)/shell/js
SIXGILL ?= @SIXGILL_PATH@
ANALYSIS_SCRIPT_DIR ?= $(srcdir)
JOBS ?= 6
all : rootingHazards.txt allFunctions.txt
CALL_JS := time env PATH=$$PATH:$(SIXGILL)/bin XDB=$(SIXGILL)/bin/xdb.so $(JS)
src_body.xdb src_comp.xdb: run_complete
@echo Started compilation at $$(date)
$(ANALYSIS_SCRIPT_DIR)/run_complete --foreground --build-root=$(TARGET_JSOBJDIR) --work-dir=work -b $(SIXGILL)/bin $(CURDIR)
@echo Finished compilation at $$(date)
callgraph.txt: src_body.xdb src_comp.xdb computeCallgraph.js
@echo Started computation of $@ at $$(date)
$(CALL_JS) $(ANALYSIS_SCRIPT_DIR)/computeCallgraph.js > $@.tmp
mv $@.tmp $@
@echo Finished computation of $@ at $$(date)
gcFunctions.txt: callgraph.txt computeGCFunctions.js annotations.js
@echo Started computation of $@ at $$(date)
$(CALL_JS) $(ANALYSIS_SCRIPT_DIR)/computeGCFunctions.js ./callgraph.txt > $@.tmp
mv $@.tmp $@
@echo Finished computation of $@ at $$(date)
gcFunctions.lst: gcFunctions.txt
perl -lne 'print $$1 if /^GC Function: (.*)/' gcFunctions.txt > $@
suppressedFunctions.lst: gcFunctions.txt
perl -lne 'print $$1 if /^Suppressed Function: (.*)/' gcFunctions.txt > $@
gcTypes.txt: src_comp.xdb computeGCTypes.js annotations.js
@echo Started computation of $@ at $$(date)
$(CALL_JS) $(ANALYSIS_SCRIPT_DIR)/computeGCTypes.js > $@.tmp
mv $@.tmp $@
@echo Finished computation of $@ at $$(date)
allFunctions.txt: src_body.xdb
@echo Started computation of $@ at $$(date)
time $(SIXGILL)/bin/xdbkeys $^ > $@.tmp
mv $@.tmp $@
@echo Finished computation of $@ at $$(date)
rootingHazards.txt: gcFunctions.lst suppressedFunctions.lst gcTypes.txt analyzeRoots.js annotations.js gen-hazards.sh
@echo Started computation of $@ at $$(date)
time env JS=$(JS) ANALYZE='$(ANALYSIS_SCRIPT_DIR)/analyzeRoots.js' SIXGILL='$(SIXGILL)' '$(ANALYSIS_SCRIPT_DIR)/gen-hazards.sh' $(JOBS) > $@.tmp
mv $@.tmp $@
@echo Finished computation of $@ at $$(date)