summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-07-02 04:39:48 (GMT)
committerSteven Knight <knight@baldmt.com>2003-07-02 04:39:48 (GMT)
commit4494c32726f5560df070bd13696272e88babcb3c (patch)
treeb0d785fd9030d2e79b2af3cf1f1bd993fca296ad /src/engine
parentf7eddbc1949e72d148a877a8f48c615cdb9487d7 (diff)
downloadSCons-4494c32726f5560df070bd13696272e88babcb3c.zip
SCons-4494c32726f5560df070bd13696272e88babcb3c.tar.gz
SCons-4494c32726f5560df070bd13696272e88babcb3c.tar.bz2
When an input yacc file ends in .yy and the yacc -d flag is used, expect a generated .hpp file, not a .h file.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Defaults.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index 6fa053d..e2bb3b4 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -69,14 +69,19 @@ CScan = SCons.Scanner.C.CScan()
FortranScan = SCons.Scanner.Fortran.FortranScan()
def yaccEmitter(target, source, env, **kw):
- # Yacc can be configured to emit a .h file as well
- # as a .c file, if -d is specified on the command line.
- if len(source) and \
- os.path.splitext(SCons.Util.to_String(source[0]))[1] in \
- [ '.y', '.yy'] and \
- '-d' in string.split(env.subst("$YACCFLAGS")):
- target.append(os.path.splitext(SCons.Util.to_String(target[0]))[0] + \
- '.h')
+ # If -d is specified on the command line, yacc will emit a .h
+ # or .hpp file as well as a .c or .cpp file, depending on whether
+ # the input file is a .y or .yy, respectively.
+ if len(source) and '-d' in string.split(env.subst("$YACCFLAGS")):
+ suff = os.path.splitext(SCons.Util.to_String(source[0]))[1]
+ h = None
+ if suff == '.y':
+ h = '.h'
+ elif suff == '.yy':
+ h = '.hpp'
+ if h:
+ base = os.path.splitext(SCons.Util.to_String(target[0]))[0]
+ target.append(base + h)
return (target, source)
def CFile():