aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/modules/UseMakeDissectorReg.cmake15
-rwxr-xr-xtools/make-dissector-reg.py19
2 files changed, 27 insertions, 7 deletions
diff --git a/cmake/modules/UseMakeDissectorReg.cmake b/cmake/modules/UseMakeDissectorReg.cmake
index 384030b125..ab6df9a0ff 100644
--- a/cmake/modules/UseMakeDissectorReg.cmake
+++ b/cmake/modules/UseMakeDissectorReg.cmake
@@ -2,14 +2,25 @@
# $Id$
#
MACRO(REGISTER_DISSECTOR_FILES _outputfile _registertype )
- set( _sources ${ARGN} )
+ if(${_registertype} STREQUAL "dissectors" )
+ set( _makeregistertype "dissectorsinfile" )
+ set( _ftmp "${CMAKE_CURRENT_BINARY_DIR}/_regc.tmp" )
+ file(REMOVE ${_ftmp})
+ foreach(f ${ARGN})
+ file(APPEND ${_ftmp} "${f}\n")
+ endforeach()
+ set( _sources ${_ftmp} )
+ else()
+ set( _makeregistertype ${_registertype} )
+ set( _sources ${ARGN} )
+ endif()
ADD_CUSTOM_COMMAND(
OUTPUT
${_outputfile}
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_SOURCE_DIR}/tools/make-dissector-reg.py
${CMAKE_CURRENT_SOURCE_DIR}
- ${_registertype}
+ ${_makeregistertype}
${_sources}
DEPENDS
${_sources}
diff --git a/tools/make-dissector-reg.py b/tools/make-dissector-reg.py
index 521352fe81..c5d07a481f 100755
--- a/tools/make-dissector-reg.py
+++ b/tools/make-dissector-reg.py
@@ -32,7 +32,7 @@ srcdir = sys.argv[1]
# "dissectors", we build a register.c for libwireshark.
#
registertype = sys.argv[2]
-if registertype == "plugin" or registertype == "plugin_wtap":
+if registertype in ("plugin", "plugin_wtap"):
final_filename = "plugin.c"
cache_filename = None
preamble = """\
@@ -42,7 +42,7 @@ if registertype == "plugin" or registertype == "plugin_wtap":
* Generated automatically from %s.
*/
""" % (sys.argv[0])
-elif registertype == "dissectors":
+elif registertype in ("dissectors", "dissectorsinfile"):
final_filename = "register.c"
cache_filename = "register-cache.pkl"
preamble = """\
@@ -64,10 +64,19 @@ else:
#
-# All subsequent arguments are the files to scan.
+# All subsequent arguments are the files to scan
+# or the name of a file containing the files to scan
#
-files = sys.argv[3:]
-
+if registertype == "dissectorsinfile":
+ try:
+ with open(sys.argv[3]) as f:
+ files = [line.rstrip() for line in f]
+ except IOError:
+ print(("Unable to open input file '%s'" % sys.argv[3]))
+ sys.exit(1)
+else:
+ files = sys.argv[3:]
+
# Create the proper list of filenames
filenames = []
for file in files: