build: Move presence to a subdirectory
Change-Id: I33b28922107b9b041de3699e4a6eebd3d05ebdef
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/Makefile.am b/Makefile.am
index 6180d1e..c3dee8b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,25 +1,12 @@
AM_DEFAULT_SOURCE_EXT = .cpp
-sbin_PROGRAMS = \
- phosphor-fan-presence-tach
-
-phosphor_fan_presence_tach_SOURCES = \
- fan_enclosure.cpp \
- tach_sensor.cpp \
- tach_detect.cpp \
+noinst_LTLIBRARIES = libfan.la
+libfan_la_LDFLAGS = -static
+libfan_la_LIBADD = \
+ $(SDBUSPLUS_LIBS)
+libfan_la_CXXFLAGS =
+ $(SDBUSPLUS_CFLAGS)
+libfan_la_SOURCES = \
utility.cpp
-nodist_phosphor_fan_presence_tach_SOURCES = \
- fan_detect_defs.cpp
-phosphor_fan_presence_tach_LDFLAGS = $(SDBUSPLUS_LIBS) $(PHOSPHOR_LOGGING_LIBS)
-phosphor_fan_presence_tach_CXXFLAGS = \
- $(SDBUSPLUS_CFLAGS) \
- $(PHOSPHOR_LOGGING_CFLAGS)
-
-BUILT_SOURCES = fan_detect_defs.cpp
-CLEANFILES = fan_detect_defs.cpp
-
-fan_detect_defs.cpp: ${srcdir}/gen-fan-detect-defs.py
- $(AM_V_GEN)$(GEN_FAN_DETECT_DEFS) > $@
-
-SUBDIRS = control
\ No newline at end of file
+SUBDIRS = . presence control
diff --git a/configure.ac b/configure.ac
index 2c083ca..c3d5d75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,12 +35,12 @@
AC_ARG_VAR(FAN_DETECT_YAML_FILE,
[The fan presence detection definition file to use])
AS_IF([test "x$FAN_DETECT_YAML_FILE" == "x"],
-[FAN_DETECT_YAML_FILE="${srcdir}/example/fan-detect.yaml"])
+[FAN_DETECT_YAML_FILE="${srcdir}/presence/example/fan-detect.yaml"])
AC_DEFINE_UNQUOTED([FAN_DETECT_YAML_FILE], ["$FAN_DETECT_YAML_FILE"],
[The fan presence detection definition file to use])
# Create configured output
AC_SUBST([GEN_FAN_DETECT_DEFS],
-[$PYTHON ${srcdir}/gen-fan-detect-defs.py -y $FAN_DETECT_YAML_FILE])
-AC_CONFIG_FILES([Makefile control/Makefile])
+[$PYTHON ${srcdir}/presence/gen-fan-detect-defs.py -y $FAN_DETECT_YAML_FILE])
+AC_CONFIG_FILES([Makefile presence/Makefile control/Makefile])
AC_OUTPUT
diff --git a/control/Makefile.am b/control/Makefile.am
index a9b8133..73dea93 100644
--- a/control/Makefile.am
+++ b/control/Makefile.am
@@ -1,5 +1,5 @@
AM_DEFAULT_SOURCE_EXT = .cpp
-AM_CPPFLAGS = -I${top_src_dir}
+AM_CPPFLAGS = -iquote ${top_srcdir}
sbin_PROGRAMS = \
phosphor-fan-control
diff --git a/presence/Makefile.am b/presence/Makefile.am
new file mode 100644
index 0000000..10a7363
--- /dev/null
+++ b/presence/Makefile.am
@@ -0,0 +1,25 @@
+AM_DEFAULT_SOURCE_EXT = .cpp
+AM_CPPFLAGS = -iquote ${top_srcdir}
+
+sbin_PROGRAMS = \
+ phosphor-fan-presence-tach
+
+phosphor_fan_presence_tach_SOURCES = \
+ fan_enclosure.cpp \
+ tach_sensor.cpp \
+ tach_detect.cpp
+nodist_phosphor_fan_presence_tach_SOURCES = \
+ fan_detect_defs.cpp
+
+phosphor_fan_presence_tach_LDADD = \
+ $(top_builddir)/libfan.la \
+ $(SDBUSPLUS_LIBS) \
+ $(PHOSPHOR_LOGGING_LIBS)
+phosphor_fan_presence_tach_CXXFLAGS = \
+ $(SDBUSPLUS_CFLAGS) \
+ $(PHOSPHOR_LOGGING_CFLAGS)
+
+BUILT_SOURCES = fan_detect_defs.cpp
+
+fan_detect_defs.cpp: ${srcdir}/gen-fan-detect-defs.py
+ $(AM_V_GEN)$(GEN_FAN_DETECT_DEFS) > $@
diff --git a/example/fan-detect.yaml b/presence/example/fan-detect.yaml
similarity index 100%
rename from example/fan-detect.yaml
rename to presence/example/fan-detect.yaml
diff --git a/fan_detect_defs.hpp b/presence/fan_detect_defs.hpp
similarity index 100%
rename from fan_detect_defs.hpp
rename to presence/fan_detect_defs.hpp
diff --git a/fan_enclosure.cpp b/presence/fan_enclosure.cpp
similarity index 100%
rename from fan_enclosure.cpp
rename to presence/fan_enclosure.cpp
diff --git a/fan_enclosure.hpp b/presence/fan_enclosure.hpp
similarity index 100%
rename from fan_enclosure.hpp
rename to presence/fan_enclosure.hpp
diff --git a/fan_properties.hpp b/presence/fan_properties.hpp
similarity index 100%
rename from fan_properties.hpp
rename to presence/fan_properties.hpp
diff --git a/gen-fan-detect-defs.py b/presence/gen-fan-detect-defs.py
similarity index 100%
rename from gen-fan-detect-defs.py
rename to presence/gen-fan-detect-defs.py
diff --git a/sensor_base.hpp b/presence/sensor_base.hpp
similarity index 100%
rename from sensor_base.hpp
rename to presence/sensor_base.hpp
diff --git a/tach_detect.cpp b/presence/tach_detect.cpp
similarity index 100%
rename from tach_detect.cpp
rename to presence/tach_detect.cpp
diff --git a/tach_sensor.cpp b/presence/tach_sensor.cpp
similarity index 100%
rename from tach_sensor.cpp
rename to presence/tach_sensor.cpp
diff --git a/tach_sensor.hpp b/presence/tach_sensor.hpp
similarity index 100%
rename from tach_sensor.hpp
rename to presence/tach_sensor.hpp