Bug 528367 - generate ipdl_{lex,yacc}tab.py in the objdir, not the srcdir
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 24 Nov 2009 10:34:38 -0500
changeset 36109 4d8cb0be8c0290fa1103dc01320aa3413d373490
parent 36108 133d4a382af1cc2d7ab028fb93b32951dc03853b
child 36110 e259e884b23a31e8502a3e2fc200093024b614cc
push id10694
push userbsmedberg@mozilla.com
push dateMon, 14 Dec 2009 15:23:10 +0000
treeherdermozilla-central@683dfdc4adf0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs528367
milestone1.9.3a1pre
Bug 528367 - generate ipdl_{lex,yacc}tab.py in the objdir, not the srcdir
ipc/ipdl/Makefile.in
ipc/ipdl/ipdl/parser.py
--- a/ipc/ipdl/Makefile.in
+++ b/ipc/ipdl/Makefile.in
@@ -35,16 +35,20 @@
 # ***** END LICENSE BLOCK *****
 
 DEPTH = ../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
+
+GARBAGE_DIRS += _ipdlheaders
+GARBAGE += ipdl_lextab.py ipdl_yacctab.py
+
 include $(topsrcdir)/config/rules.mk
 
 IPDLDIRS =  \
   dom/plugins  \
   dom/ipc  \
   netwerk/ipc  \
   netwerk/protocol/http/src  \
   ipc/ipdl/test/cxx  \
--- a/ipc/ipdl/ipdl/parser.py
+++ b/ipc/ipdl/ipdl/parser.py
@@ -35,20 +35,16 @@ from ply import lex, yacc
 
 from ipdl.ast import *
 
 def _getcallerpath():
     '''Return the absolute path of the file containing the code that
 **CALLED** this function.'''
     return os.path.abspath(sys._getframe(1).f_code.co_filename)
 
-# we want PLY to generate its output in the module directory, not wherever
-# the user chooses to run ipdlc from
-_thisdir, _ = os.path.split(_getcallerpath())
-
 ##-----------------------------------------------------------------------------
 
 class ParseError(Exception):
     def __init__(self, loc, fmt, *args):
         self.loc = loc
         self.error = ('%s%s: error: %s'% (
             Parser.includeStackString(), loc, fmt)) % args
     def __str__(self):
@@ -87,22 +83,20 @@ class Parser:
     def parse(self, input, filename, includedirs, errout):
         assert os.path.isabs(filename)
 
         if filename in Parser.parsed:
             return Parser.parsed[filename].tu
 
         self.lexer = lex.lex(debug=self.debug,
                              optimize=not self.debug,
-                             lextab="ipdl_lextab",
-                             outputdir=_thisdir)
+                             lextab="ipdl_lextab")
         self.parser = yacc.yacc(debug=self.debug,
                                 optimize=not self.debug,
-                                tabmodule="ipdl_yacctab",
-                                outputdir=_thisdir)
+                                tabmodule="ipdl_yacctab")
         self.filename = filename
         self.includedirs = includedirs
         self.tu.filename = filename
         self.errout = errout
 
         Parser.parsed[filename] = self
         Parser.parseStack.append(Parser.current)
         Parser.current = self