clean up libraries in meson.build files

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I6ca90bb9d02243413fc5e0b85001666e836a435c
diff --git a/analyzer/meson.build b/analyzer/meson.build
index 371e0b8..1ef013c 100644
--- a/analyzer/meson.build
+++ b/analyzer/meson.build
@@ -1,4 +1,4 @@
-# gather analyzer sources to be used here and elsewhere if needed
+# Source files.
 analyzer_src = files(
     'analyzer_main.cpp',
     'create_pel.cpp',
@@ -13,10 +13,13 @@
     sdbusplus_dep,
 ]
 
-# Create hardware error analyzer library
-analyzer = static_library('analyzer',
-                          analyzer_src,
-                          include_directories : incdir,
-                          dependencies : analyzer_deps,
-                          cpp_args : test_arg,
-                          install : false)
+# Create static library.
+analyzer_lib = static_library(
+    'analyzer_lib',
+    analyzer_src,
+    include_directories : incdir,
+    dependencies : analyzer_deps,
+    cpp_args : test_arg,
+    install : false,
+)
+
diff --git a/attn/meson.build b/attn/meson.build
index ceaad7d..f8a1d9d 100644
--- a/attn/meson.build
+++ b/attn/meson.build
@@ -23,15 +23,32 @@
     logging_src = '../test/end2end/logging.cpp'
 endif
 
-# gather attention sources to be used here and elsewhere if needed
-attn_src = files('attn_main.cpp', 'attn_handler.cpp', 'attn_monitor.cpp',
-                 'bp_handler.cpp', 'ti_handler.cpp', logging_src,
-                 'attention.cpp', 'attn_config.cpp')
+# Source files.
+attn_src = files(
+    'attn_config.cpp',
+    'attention.cpp',
+    'attn_handler.cpp',
+    'attn_main.cpp',
+    'attn_monitor.cpp',
+    'bp_handler.cpp',
+    logging_src,
+    'ti_handler.cpp',
+)
 
-# Create attention handler library
-attn = static_library('attn_handler',
-                      attn_src,
-                      include_directories : incdir,
-                      dependencies : [libpdbg_dep, sdbusplus_dep, libgpiod],
-                      cpp_args : [boost_args, test_arg],
-                      install : true)
+# Library dependencies.
+attn_deps = [
+    libgpiod,
+    libpdbg_dep,
+    sdbusplus_dep,
+]
+
+# Create static library.
+attn_lib = static_library(
+    'attn_lib',
+    attn_src,
+    include_directories : incdir,
+    dependencies : attn_deps,
+    cpp_args : [boost_args, test_arg],
+    install : false,
+)
+
diff --git a/meson.build b/meson.build
index dd05445..f477fce 100644
--- a/meson.build
+++ b/meson.build
@@ -34,29 +34,48 @@
     phosphor_logging = false
 endif
 
+pthread = declare_dependency(link_args : '-pthread')
+lrt = declare_dependency(link_args : '-lrt')
+
+#-------------------------------------------------------------------------------
+# Build the static libraries
+#-------------------------------------------------------------------------------
+
 subdir('analyzer')
 subdir('attn')
 subdir('util')
 
-pthread = declare_dependency(link_args : '-pthread')
-lrt = declare_dependency(link_args : '-lrt')
+hwdiags_libs = [
+    analyzer_lib,
+    attn_lib,
+    util_lib,
+]
+
+#-------------------------------------------------------------------------------
+# Build the executable
+#-------------------------------------------------------------------------------
 
 no_listener_mode = get_option('nlmode')
 
 if not no_listener_mode.disabled()
   executable('openpower-hw-diags', 'main_nl.cpp', 'cli.cpp',
-              link_with : [analyzer, attn, util_lib],
+              link_with : hwdiags_libs,
               install : true)
 else
   executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp',
               dependencies : [lrt, pthread],
-              link_with : [analyzer, attn, util_lib],
+              link_with : hwdiags_libs,
               cpp_args : test_arg,
               install : true)
 endif
 
+#-------------------------------------------------------------------------------
+# Test, if configured
+#-------------------------------------------------------------------------------
+
 build_tests = get_option('tests')
 
 if not build_tests.disabled()
   subdir('test')
 endif
+
diff --git a/test/end2end/meson.build b/test/end2end/meson.build
index 5b6451e..b5639bc 100644
--- a/test/end2end/meson.build
+++ b/test/end2end/meson.build
@@ -11,17 +11,10 @@
     '../../cli.cpp',
 ]
 
-# Link with the analyzer and attention handler static libraries.
-end2end_libs = [
-    analyzer,
-    attn,
-    util_lib,
-]
-
 # create openpower-hw-diags executable for local testing
 end2end = executable('openpower-hw-diags-test',
             end2end_src, additional_src,
-            link_with : end2end_libs,
+            link_with : hwdiags_libs,
             include_directories : incdir,
             cpp_args : test_arg,
             install : false)
diff --git a/util/meson.build b/util/meson.build
index 7618260..1258b1f 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -18,6 +18,6 @@
     include_directories : incdir,
     dependencies : util_deps,
     cpp_args : test_arg,
-    install : false
+    install : false,
 )