VPPAPIGEN: Run tool directly from source tree. 93/10993/2
authorOle Troan <ot@cisco.com>
Wed, 7 Mar 2018 07:40:58 +0000 (08:40 +0100)
committerDamjan Marion <dmarion.lists@gmail.com>
Wed, 7 Mar 2018 10:53:52 +0000 (10:53 +0000)
This ensures that tool changes do not require re-bootstrap.
Disabled generation of temporary files (gentab / .pyc) to avoid polluting the source tree.

Change-Id: I4d6bc035fbb46550fa8f4e99f4091eef90e2d86c
Signed-off-by: Ole Troan <ot@cisco.com>
src/configure.ac
src/suffix-rules.mk
src/tools/vppapigen/vppapigen.py

index d9c8a47..1ee55e7 100644 (file)
@@ -297,11 +297,6 @@ AM_COND_IF([WITH_MBEDTLS],
     ], [])
 ])
 
-AC_PATH_PROG([VPPAPIGEN], [vppapigen], [no])
-if test "$VPPAPIGEN" = "no"; then
-   VPPAPIGEN=\$\(top_srcdir\)/tools/vppapigen/vppapigen
-fi
-
 ###############################################################################
 # JAVA
 ###############################################################################
index 495d828..8b1ab83 100644 (file)
 # Shared suffix rules
 # Please do not set "SUFFIXES = .api.h .api" here
 
-%.api.h: %.api @VPPAPIGEN@
+VPPAPIGEN = $(top_srcdir)/tools/vppapigen/vppapigen
+%.api.h: %.api
        @echo "  APIGEN  " $@ ;                                              \
        mkdir -p `dirname $@` ;                                              \
-       @VPPAPIGEN@ --includedir $(top_srcdir) --input $< --output $@
+       $(VPPAPIGEN) --includedir $(top_srcdir) --input $< --output $@
 
 %.api.json: %.api
        @echo "  JSON API" $@ ;                                              \
        mkdir -p `dirname $@` ;                                              \
-       @VPPAPIGEN@ --includedir $(top_srcdir) --input $< JSON --output $@
+       $(VPPAPIGEN) --includedir $(top_srcdir) --input $< JSON --output $@
index e6237a7..628bb09 100755 (executable)
@@ -9,6 +9,9 @@ import logging
 import binascii
 import os
 
+# Ensure we don't leave temporary files around
+sys.dont_write_bytecode = True
+
 #
 # VPP API language
 #
@@ -527,7 +530,7 @@ class VPPAPI(object):
     def __init__(self, debug=False, filename='', logger=None):
         self.lexer = lex.lex(module=VPPAPILexer(filename), debug=debug)
         self.parser = yacc.yacc(module=VPPAPIParser(filename, logger),
-                                tabmodule='vppapigentab', debug=debug)
+                                write_tables=False, debug=debug)
         self.logger = logger
 
     def parse_string(self, code, debug=0, lineno=1):