monitor:JSON: Enable JSON configuration file usage
Add the support to enable the use of a JSON configuration file at
configure time using the same `enable_json` flag along with the
appropriate makefile attributes to compile in the JSON configuration
file support.
Tested:
`--enable-json` configure flag enables use of JSON in place of YAML
YAML build time configuration used when `--enable-json` not given
JSON configuration file loaded/parsed/used when enabled
Change-Id: Ie869b245df533d2a3656543f8ce370d9d24cf4ce
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/monitor/Makefile.am b/monitor/Makefile.am
index 9575244..185c2e3 100644
--- a/monitor/Makefile.am
+++ b/monitor/Makefile.am
@@ -11,11 +11,6 @@
tach_sensor.cpp \
conditions.cpp
-nodist_phosphor_fan_monitor_SOURCES = \
- fan_monitor_defs.cpp
-
-BUILT_SOURCES = fan_monitor_defs.cpp
-
phosphor_fan_monitor_LDADD = \
$(SDBUSPLUS_LIBS) \
$(SDEVENTPLUS_LIBS) \
@@ -30,5 +25,13 @@
${PHOSPHOR_DBUS_INTERFACES_CFLAGS} \
-flto
+if WANT_JSON
+phosphor_fan_monitor_SOURCES += json_parser.cpp
+else
+BUILT_SOURCES = fan_monitor_defs.cpp
+nodist_phosphor_fan_monitor_SOURCES = \
+ fan_monitor_defs.cpp
+
fan_monitor_defs.cpp: ${srcdir}/gen-fan-monitor-defs.py
$(AM_V_GEN)$(GEN_FAN_MONITOR_DEFS) > ${builddir}/$@
+endif