bmc_monitor_app: Adding option to auto-complete BMC boot process

Original design assumes BMC will receive complete command externally.
While it may cause BMC state is `rebooting` forever if no proper
external daemon can do so.
Adding auto-complete option can let BMC marks itself as `completed` so
it won't always rely external daemon.

Tested:
```
\# Before
bmc:~# busctl get-property com.google.gbmc.boot_time_monitor \
/xyz/openbmc_project/time/boot/bmc \
xyz.openbmc_project.Time.Boot.Statistic IsRebooting
b true

\# After enable `AUTO_BMC_COMPLETE`
bmc:~# busctl get-property com.google.gbmc.boot_time_monitor \
/xyz/openbmc_project/time/boot/bmc \
xyz.openbmc_project.Time.Boot.Statistic IsRebooting
b false
```

Google-Bug-Id: 296530445
Change-Id: I2f94c4be496d0703062217b54ab3cf6ecd0f66a0
Signed-off-by: Michael Shen <gpgpgp@google.com>
diff --git a/meson.build b/meson.build
index e6db5bc..09b79d7 100644
--- a/meson.build
+++ b/meson.build
@@ -21,6 +21,10 @@
   add_project_arguments('-DNPCM7XX_OR_NEWER', language:'cpp')
 endif
 
+if get_option('auto-bmc-complete').enabled()
+  add_project_arguments('-DAUTO_BMC_COMPLETE', language:'cpp')
+endif
+
 generated_sources = []
 generated_others = []
 if get_option('yocto').disabled()
diff --git a/meson_options.txt b/meson_options.txt
index c173694..0a1d156 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,4 @@
 option('tests', type: 'feature', description: 'Build tests', value : 'enabled')
 option('yocto', type : 'feature', description : 'Using yocto build or not', value : 'disabled')
 option('npcm7xx-or-newer', type : 'feature', description: 'The BMC is using Nuvoton NCPM7XX+ or not', value : 'disabled')
+option('auto-bmc-complete', type : 'feature', description: 'Automatically marks BMC boot process as completed or not', value : 'disabled')
diff --git a/src/bmc_monitor_app.cpp b/src/bmc_monitor_app.cpp
index 1c42b6f..aa19c81 100644
--- a/src/bmc_monitor_app.cpp
+++ b/src/bmc_monitor_app.cpp
@@ -145,6 +145,12 @@
                                  powerOnSec.value() * 1000 - upTimeMS.value());
     }
 #endif
+
+// BMC marks the boot process as `completed` automatically if we do *NOT* have
+// external daemon to do so.
+#ifdef AUTO_BMC_COMPLETE
+    bootManager->complete();
+#endif
 }
 
 } // namespace boot_time_monitor