diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/build/port/SConscript | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/webkit/build/port/SConscript b/webkit/build/port/SConscript index 49b58e9..ab0bcc9 100644 --- a/webkit/build/port/SConscript +++ b/webkit/build/port/SConscript @@ -566,20 +566,31 @@ env.Command(['$DERIVED_DIR/UserAgentStyleSheets.h', '$DERIVED_DIR/quirks.css'], '$PERL ${SOURCES[0].posix} ${TARGETS.posix} ${SOURCES[1:].posix}') +def create_h_wrapper(target, source, env): + """ + Create a *.h file by surrounding the contents of a + yacc-generated *.hpp with a #ifndef-#define-#endif guard. + """ + t = str(target[1]) + fp = open(t, 'w') + define = os.path.splitext(os.path.split(t)[1])[0] + fp.write('#ifndef %s_h\n' % define) + fp.write('#define %s_h\n' % define) + fp.write(open(t + 'pp', 'r').read()) + fp.write('#endif %s_h\n' % define) + +# TODO(sgk): make this a real pseudo-Builder def BuildYacc(env, dir, name, file): env.Command(['$DERIVED_DIR/%s.cpp' % file, '$DERIVED_DIR/%s.h' % file], ['$WEBKIT_PORT_DIR/%s/%s.y' % (dir, file)], - ('$YACC -d -p %syy ${SOURCES[0].posix} ' % name + - '-o ${TARGET.posix} && ' + - '(echo \#ifndef %s_h;' % file + - ' echo \#define %s_h;' % file + - ' cat $DERIVED_DIR/%s.hpp;' % file + - ' echo \#endif) >> $DERIVED_DIR/%s.h && ' % file + - 'rm $DERIVED_DIR/%s.hpp' % file)) - -BuildYacc(env, 'xml', 'xpath', 'XPathGrammar') -BuildYacc(env, 'css', 'css', 'CSSGrammar') + ['$YACC -d -p %s ${SOURCES[0].posix} ' % name + + '-o ${TARGET.posix}', + Action(create_h_wrapper), + Delete('${TARGETS[1]}pp')]) + +BuildYacc(env, 'xml', 'xpathyy', 'XPathGrammar') +BuildYacc(env, 'css', 'cssyy', 'CSSGrammar') # TODO(bradnelson): need to add in error checking |