clean up libraries in meson.build files

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I6ca90bb9d02243413fc5e0b85001666e836a435c
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
+