diff --git a/Makefile b/Makefile index 2c9c1feb9..3ebfd3862 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ dataset_path = dataset/loser surveydir_path = surveys cavern_flags = -qq -s tar_flags = -cz --exclude "*/CVS" --ignore-case -f -svxtrace_cmd = /home/cucc/bin/svxtrace.py +svxtrace_cmd = svxtrace.py ########### @@ -29,11 +29,12 @@ folk/index.htm: noinfo/folk.csv noinfo/make-folklist.py ########### -surveytable: +surveytable: $(surveydir_path)/surveytable.html + +$(surveydir_path)/surveytable.html: $(shell find $(surveydir_path -printf "\"%p\"\n")) cd $(surveydir_path); perl tablize-csv.pl Surveys.csv -# Output depends on entire contents of the survey tree; the script is -# quite quick anyway so we might as well run it every time. +# Output depends on entire contents of the survey tree. ########### @@ -79,7 +80,7 @@ clean: rm -f indxal.htm folk/index.htm noinfo/all.pos rm -f noinfo/all.3d smkridge/204/204.3d smkridge/234/234.3d plateau/76/76.3d rm -f smkridge/204/surveydata.tgz smkridge/234/surveydata.tgz plateau/76/surveydata.tgz noinfo/all.tgz - rm -f surveys/surveytable.html + rm -f $(surveydir_path)/surveytable.html rm -f report.html ########### diff --git a/svxtrace.py b/svxtrace.py new file mode 100755 index 000000000..af97012b5 --- /dev/null +++ b/svxtrace.py @@ -0,0 +1,29 @@ +#!/usr/bin/python +import sys, os.path, re + +reg = re.compile(r'^\*include ([^;\s]*?)\s*$', re.MULTILINE) + + + +def printdeps(filename): + """Expects a filename relative to script's working directory.""" + if(filename[-4:]!='.svx'): filename += ".svx" + print filename + t = file(filename).read() + for m in re.findall(reg, t): + newfname = m + if(newfname[-4:]!='.svx'): newfname += '.svx' + newfname = os.path.normpath(os.path.dirname(filename) + '/' + newfname) + if(os.path.exists(newfname)): + printdeps(newfname) + else: # imitate cavern case-sensitivity workaround + newfname = m.lower() + newfname = os.path.normpath(os.path.dirname(filename) + '/' + newfname) + printdeps(newfname) + + +if(len(sys.argv) != 2): + print >>sys.stderr, "Usage: %s SVXFILE" % sys.argv[0] + sys.exit(1) + +printdeps(sys.argv[1])