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.

Built with master and p10bmc

Change-Id: I347e218cb66386665bd15b72612dbe8e1e4fc7cf
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/meson.build b/meson.build
index 5696b45..54a233c 100644
--- a/meson.build
+++ b/meson.build
@@ -124,20 +124,88 @@
               )
 subdir('xyz/openbmc_project/Dump/Internal/Create')
 
+dump_types_yaml_files = []
+
+# Dump types YAML file
+dump_types_yaml_files += {'input': 'example_dump_types.yaml',
+         'output': 'dump_types.yaml'}
+
+# Copy and combine YAML files
+concatenate_command = 'cat '
+combined_yaml_file = 'combined_dump_types.yaml'
+
+foreach yaml_file : dump_types_yaml_files
+    configure_file(input : yaml_file.get('input'),
+                   output : yaml_file.get('output'),
+                   copy : true)
+    concatenate_command += meson.build_root() + '/' + yaml_file.get('output') + ' '
+endforeach
+
+concatenate_command += '> ' + meson.build_root() + '/' + combined_yaml_file
+run_command('sh', '-c', concatenate_command)
+
 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',
+                        meson.build_root() + '/' +  combined_yaml_file,
+                        '-t',
+                        'dump_types.mako.hpp',
+                        '-v',
+                        'DUMP_TYPE_TABLE',
+                        '-o',
+                        'dump_types.hpp'
+                    ],
+                    depend_files : [ 'dump_types.mako.hpp',
+                                     'map_gen.py',
+                                     meson.build_root() + '/' +  combined_yaml_file
+                                   ],
+                    output : 'dump_types.hpp'
+                 )
+
+dump_types_cpp = custom_target(
+                    'dump_types.cpp',
+                    command : [
+                        python,
+                        map_gen_file_loc,
+                        '-i',
+                        meson.build_root() + '/' +  combined_yaml_file,
+                        '-t',
+                        'dump_types.mako.cpp',
+                        '-v',
+                        'DUMP_TYPE_TABLE',
+                        '-o',
+                        'dump_types.cpp'
+                    ],
+                    depend_files : [ 'dump_types.mako.cpp',
+                                     'map_gen.py',
+                                     meson.build_root() + '/' +  combined_yaml_file
+                                   ],
+                    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'
@@ -154,13 +222,14 @@
         common_hpp,
         server_hpp,
         server_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 = [
@@ -184,6 +253,7 @@
 subdir('dump-extensions')
 
 phosphor_dump_monitor_sources = [
+        dump_types_hpp,
         'core_manager.cpp',
         'core_manager_main.cpp',
         'watch.cpp'
@@ -199,6 +269,7 @@
 phosphor_dump_monitor_incdir = []
 
 phosphor_ramoops_monitor_sources = [
+        dump_types_hpp,
         'ramoops_manager.cpp',
         'ramoops_manager_main.cpp',
         'watch.cpp'