From 75ef19188d021a5e965198bde774c1c33bedc1f3 Mon Sep 17 00:00:00 2001 From: marha Date: Sat, 30 Oct 2010 18:34:27 +0000 Subject: Increased gnu make compatibility. --- tools/mhmake/addstdafxh.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tools/mhmake/addstdafxh.py (limited to 'tools/mhmake/addstdafxh.py') diff --git a/tools/mhmake/addstdafxh.py b/tools/mhmake/addstdafxh.py new file mode 100644 index 000000000..45413a474 --- /dev/null +++ b/tools/mhmake/addstdafxh.py @@ -0,0 +1,33 @@ +import sys,re,os + +try: + InputFile=sys.argv[1] +except: + print "No input file specified" + sys.exit(1) + +try: + InputFile=sys.argv[1] + pIN=open(InputFile,"r") + data=pIN.read() + pIN.close() +except: + print "Error reading input file",InputFile + sys.exit(1) + +try: + pOUT=open(InputFile,"w") +except: + print "Error opening",InputFile,"for writing" + sys.exit(1) + +pOUT.write("""#include "stdafx.h"\n""") +#since we are going to add one line we need to update all line statements +def IncrementLine(matchobj): + return "#line %d%s"%(int(matchobj.group(1))+1,matchobj.group(2)) + +data=re.sub(r"#\s*line\s+(\d+)(.*%s)"%os.path.split(InputFile)[1],IncrementLine,data) + +pOUT.write(data) +pOUT.close() + -- cgit v1.2.3