Generate dump types table

This commit refines the map generation process in
phosphor-debug-collector. The existing Python script is
enhanced to accept varying templates and variable names,
A new Mako template is introduced for generating dump
types. This enhancement allows different architectures
to support various types of dumps without requiring
major changes.

Tests:
Successfully tested the creation of different types of
BMC dumps.
Change-Id: I347e218cb66386665bd15b72612dbe8e1e4fc7cf
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/meson.build b/meson.build
index 47aaff4..c35f26a 100644
--- a/meson.build
+++ b/meson.build
@@ -118,24 +118,75 @@
 conf_data.set('BMC_DUMP_ROTATE_CONFIG', get_option('dump_rotate_config').enabled(),
                description : 'Turn on rotate config for bmc dump'
              )
+conf_data.set('DUMP_TYPES_YAML', get_option('DUMP_TYPES_YAML'),
+               description : 'YAML filepath containing dump types'
+             )
 
 configure_file(configuration : conf_data,
                output : 'config.h'
               )
 python = find_program('python3')
-errors_map_gen_file_loc = meson.project_source_root()
-errors_map_gen_file_loc += '/errors_map_gen.py'
+map_gen_file_loc = meson.project_source_root()
+map_gen_file_loc += '/map_gen.py'
+
+dump_types_hpp = custom_target(
+                    'dump_types.hpp',
+                    command : [
+                        python,
+                        map_gen_file_loc,
+                        '-i',
+                        get_option('DUMP_TYPES_YAML'),
+                        '-t',
+                        'dump_types.mako.hpp',
+                        '-v',
+                        'DUMP_TYPE_TABLE',
+                        '-o',
+                        'dump_types.hpp'
+                    ],
+                    depend_files : [ 'dump_types.mako.hpp',
+                                     'map_gen.py',
+                                     get_option('DUMP_TYPES_YAML')
+                                   ],
+                    output : 'dump_types.hpp'
+                 )
+
+dump_types_cpp = custom_target(
+                    'dump_types.cpp',
+                    command : [
+                        python,
+                        map_gen_file_loc,
+                        '-i',
+                        get_option('DUMP_TYPES_YAML'),
+                        '-t',
+                        'dump_types.mako.cpp',
+			                  '-v',
+			                  'DUMP_TYPE_TABLE',
+                        '-o',
+                        'dump_types.cpp'
+                    ],
+                    depend_files : [ 'dump_types.mako.cpp',
+                                     'map_gen.py',
+                                     get_option('DUMP_TYPES_YAML')
+                                   ],
+                    output : 'dump_types.cpp'
+                 )
 
 errors_map_cpp = custom_target(
                     'errors_map.cpp',
                     command : [
                         python,
-                        errors_map_gen_file_loc,
+                        map_gen_file_loc,
                         '-i',
-                        get_option('ERROR_MAP_YAML')
+                        get_option('ERROR_MAP_YAML'),
+                        '-t',
+                        'errors_map.mako.cpp',
+			                  '-v',
+                        'errDict',
+                        '-o',
+                        'errors_map.cpp'
                     ],
                     depend_files : [ 'errors_map.mako.cpp',
-                                     'errors_map_gen.py',
+                                     'map_gen.py',
                                      get_option('ERROR_MAP_YAML')
                                    ],
                     output : 'errors_map.cpp'
@@ -149,13 +200,14 @@
         'dump_serialize.cpp',
         'elog_watch.cpp',
         errors_map_cpp,
+        dump_types_hpp,
+	      dump_types_cpp,
         'watch.cpp',
         'bmc_dump_entry.cpp',
         'dump_utils.cpp',
         'dump_offload.cpp',
         'dump_manager_faultlog.cpp',
-        'faultlog_dump_entry.cpp',
-        'dump_types.cpp'
+        'faultlog_dump_entry.cpp'
     ]
 
 phosphor_dump_manager_dependency = [