Allow out-of-tree builds

Change-Id: If4b97e65f63c3abbf23140dd97b9febe00b3be0d
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/Makefile.am b/Makefile.am
index d90cd38..4cab12c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,10 +18,10 @@
 
 WHITELIST_CONF ?= ${srcdir}/host-ipmid-whitelist.conf
 ipmiwhitelist.cpp: ${srcdir}/generate_whitelist.sh $(WHITELIST_CONF)
-	${srcdir}/$^ > $@
+	$(SHELL) $^ > $@
 
 
-libapphandlerdir = /usr/lib/host-ipmid
+libapphandlerdir = ${libdir}/host-ipmid
 libapphandler_LTLIBRARIES = libapphandler.la
 libapphandler_la_SOURCES = \
 	apphandler.cpp \
@@ -37,17 +37,15 @@
 libapphandler_la_LDFLAGS = $(SYSTEMD_LIBS) $(libmapper_LIBS) -version-info 0:0:0 -shared
 libapphandler_la_CXXFLAGS = $(SYSTEMD_CFLAGS) $(libmapper_CFLAGS)
 
-libhostservicedir = /usr/lib/host-ipmid
+libhostservicedir = ${libdir}/host-ipmid
 libhostservice_LTLIBRARIES = libhostservice.la
 libhostservice_la_SOURCES = \
 	host-services.c
 libhostservice_la_LDFLAGS = $(SYSTEMD_LIBS) $(libmapper_LIBS) -version-info 0:0:0 -shared
 libhostservice_la_CXXFLAGS = $(SYSTEMD_CFLAGS) $(libmapper_CFLAGS)
 
-includedir = /usr/include/host-ipmid
-
-include_HEADERS = \
-	ipmid-api.h
+nobase_include_HEADERS = \
+	host-ipmid/ipmid-api.h
 
 check_PROGRAMS = \
 	testit
diff --git a/apphandler.cpp b/apphandler.cpp
index bfc821e..8da85e4 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -1,5 +1,5 @@
 #include "apphandler.h"
-#include "ipmid-api.h"
+#include "host-ipmid/ipmid-api.h"
 #include "ipmid.hpp"
 #include <stdio.h>
 #include <string.h>
diff --git a/chassishandler.cpp b/chassishandler.cpp
index 1df4c0a..2952725 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -1,5 +1,5 @@
 #include "chassishandler.h"
-#include "ipmid-api.h"
+#include "host-ipmid/ipmid-api.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index fafebdc..5775a35 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -1,5 +1,5 @@
 #include "dcmihandler.h"
-#include "ipmid-api.h"
+#include "host-ipmid/ipmid-api.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
diff --git a/globalhandler.cpp b/globalhandler.cpp
index 889d127..9008278 100644
--- a/globalhandler.cpp
+++ b/globalhandler.cpp
@@ -1,5 +1,5 @@
 #include "globalhandler.h"
-#include "ipmid-api.h"
+#include "host-ipmid/ipmid-api.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
diff --git a/groupext.cpp b/groupext.cpp
index 92edd04..ba43794 100644
--- a/groupext.cpp
+++ b/groupext.cpp
@@ -1,4 +1,4 @@
-#include "ipmid-api.h"
+#include "host-ipmid/ipmid-api.h"
 #include "ipmid.hpp"
 #include <stdio.h>
 #include <stdint.h>
diff --git a/ipmid-api.h b/host-ipmid/ipmid-api.h
similarity index 100%
rename from ipmid-api.h
rename to host-ipmid/ipmid-api.h
diff --git a/host-services.c b/host-services.c
index 78ad4c3..4c8fc7c 100644
--- a/host-services.c
+++ b/host-services.c
@@ -3,7 +3,7 @@
 #include <errno.h>
 #include <systemd/sd-bus.h>
 #include <mapper.h>
-#include "ipmid-api.h"
+#include "host-ipmid/ipmid-api.h"
 
 void register_host_services() __attribute__((constructor));
 
diff --git a/ipmid.hpp b/ipmid.hpp
index f465072..bcf15b5 100644
--- a/ipmid.hpp
+++ b/ipmid.hpp
@@ -1,6 +1,6 @@
 #ifndef __HOST_IPMID_IPMI_H__
 #define __HOST_IPMID_IPMI_H__
-#include "ipmid-api.h"
+#include "host-ipmid/ipmid-api.h"
 #include <stdio.h>
 #include "host-services.h"
 
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 39de660..ea8099d 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -1,5 +1,5 @@
 #include "sensorhandler.h"
-#include "ipmid-api.h"
+#include "host-ipmid/ipmid-api.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
diff --git a/storagehandler.cpp b/storagehandler.cpp
index 9622ed9..9379b0d 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -7,7 +7,7 @@
 
 #include "storagehandler.h"
 #include "storageaddsel.h"
-#include "ipmid-api.h"
+#include "host-ipmid/ipmid-api.h"
 
 void register_netfn_storage_functions() __attribute__((constructor));
 
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 0739d06..f7a029b 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -4,7 +4,7 @@
 #include <arpa/inet.h>
 #include <string>
 
-#include "ipmid-api.h"
+#include "host-ipmid/ipmid-api.h"
 #include "ipmid.hpp"
 #include "transporthandler.h"