summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2016-07-27 14:50:51 -0500
committerPatrick Williams <patrick@stwcx.xyz>2016-09-02 18:37:24 +0000
commit3cff7ed7a9e397de35809f787deabcc8a6b3350d (patch)
treeef53070cd680920f2bd1d984d9bd351e51d229bd
parentfd28dd7ae4dafc8b919098feb2876623474eeeaa (diff)
downloadphosphor-host-ipmid-3cff7ed7a9e397de35809f787deabcc8a6b3350d.tar.gz
phosphor-host-ipmid-3cff7ed7a9e397de35809f787deabcc8a6b3350d.zip
Convert build process to autotools
Replaced the use of manual Makefile(s) with the use of autotools to automatically verify and generate the necessary build files. Follow the steps outlined within the README file to build the package. Change-Id: Ia3e1e1be7b18fb90382fd56f555866120ae5ece9 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
-rw-r--r--Makefile85
-rw-r--r--Makefile.am61
-rw-r--r--README7
-rw-r--r--configure.ac31
4 files changed, 99 insertions, 85 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index cdb396b..0000000
--- a/Makefile
+++ /dev/null
@@ -1,85 +0,0 @@
-CXX ?= $(CROSS_COMPILE)g++
-
-TESTER = testit
-
-TESTADDSEL = testaddsel
-
-DAEMON = ipmid
-DAEMON_OBJ = ipmid.o \
- ipmiwhitelist.o
-
-LIB_APP_OBJ = apphandler.o \
- sensorhandler.o \
- storagehandler.o \
- chassishandler.o \
- dcmihandler.o \
- ipmisensor.o \
- storageaddsel.o \
- transporthandler.o \
- globalhandler.o \
- groupext.o
-
-LIB_HOST_SRV_OBJ = host-services.o
-
-TESTADDSEL_OBJ = $(TESTADDSEL).o \
- storageaddsel.o
-
-TESTER_OBJ = ipmisensor.o \
- testit.o
-
-LIB_APP = libapphandler.so
-LIB_HOST_SRV = libhostservice.so
-
-INSTALLED_LIBS += $(LIB_APP) $(LIB_HOST_SRV)
-INSTALLED_HEADERS = ipmid-api.h
-
-CXXFLAGS += -Wall -Wno-unused-result
-CFLAGS += -Wall -Wno-unused-result
-
-INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2
-LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic
-IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
-
-DESTDIR ?= /
-SBINDIR ?= /usr/sbin
-INCLUDEDIR ?= /usr/include
-LIBDIR ?= /usr/lib
-
-WHITELIST_SRC = ipmiwhitelist.cpp
-WHITELIST_CONF ?= host-ipmid-whitelist.conf
-
-all: $(DAEMON) $(LIB_APP) $(LIB_HOST_SRV) $(TESTER)
-
-$(WHITELIST_SRC) : generate_whitelist.sh $(WHITELIST_CONF)
- ./$^ > $@
-
-%.o: %.cpp
- $(CXX) -std=c++14 -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
-
-$(LIB_APP): $(LIB_APP_OBJ)
- $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@ -lmapper
-
-$(LIB_HOST_SRV): $(LIB_HOST_SRV_OBJ)
- $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
-
-$(DAEMON): $(DAEMON_OBJ)
- $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -lmapper -ldl
-
-$(TESTER): $(TESTER_OBJ)
- $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
-
-clean:
- rm -f $(DAEMON) $(TESTER) *.o *.so $(WHITELIST_SRC)
-
-$(TESTADDSEL): $(TESTADDSEL_OBJ)
- $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
-
-install:
- install -m 0755 -d $(DESTDIR)$(SBINDIR)
- install -m 0755 ipmid $(DESTDIR)$(SBINDIR)
- install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid
- install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid
- install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid
- install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid
-
-
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..cbdfa04
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,61 @@
+AM_DEFAULT_SOURCE_EXT = .cpp
+
+testit_SOURCES = \
+ ipmisensor.cpp \
+ testit.cpp
+testit_LDFLAGS = $(SYSTEMD_LIBS) $(LIBADD_DLOPEN)
+
+#testaddsel_SOURCES = \
+# testaddsel.cpp \
+# storageaddsel.cpp
+#testaddsel_LDFLAGS = $(SYSTEMD_CFLAGS) $(SYSTEMD_LIBS) $(LIBADD_DLOPEN)
+
+ipmid_SOURCES = \
+ ipmid.cpp
+ ipmiwhitelist.cpp
+nodist_ipmid_SOURCES = ipmiwhitelist.cpp
+BUILT_SOURCES = ipmiwhitelist.cpp
+CLEANFILES = ipmiwhitelist.cpp
+WHITELIST_CONF ?= ${srcdir}/host-ipmid-whitelist.conf
+ipmiwhitelist.cpp: ${srcdir}/generate_whitelist.sh $(WHITELIST_CONF)
+ ${srcdir}/$^ > $@
+#TODO - Make this path a configure option (bitbake parameter)
+ipmid_CPPFLAGS = -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
+ipmid_LDFLAGS = $(SYSTEMD_LIBS) $(libmapper_LIBS) $(LIBADD_DLOPEN) -export-dynamic
+
+libapphandlerdir = /usr/lib/host-ipmid
+libapphandler_LTLIBRARIES = libapphandler.la
+libapphandler_la_SOURCES = \
+ apphandler.cpp \
+ sensorhandler.cpp \
+ storagehandler.cpp \
+ chassishandler.cpp \
+ dcmihandler.cpp \
+ ipmisensor.cpp \
+ storageaddsel.cpp \
+ transporthandler.cpp \
+ globalhandler.cpp \
+ groupext.cpp
+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
+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)
+
+libdir = /usr/lib/host-ipmid
+includedir = /usr/include/host-ipmid
+
+include_HEADERS = \
+ ipmid-api.h
+
+#default sbin dir
+sbin_PROGRAMS = \
+ ipmid
+
+check_PROGRAMS = \
+ testit
+# testaddsel
diff --git a/README b/README
new file mode 100644
index 0000000..f841a4e
--- /dev/null
+++ b/README
@@ -0,0 +1,7 @@
+To build this package, do the following steps:
+
+1.) autoreconf -i
+
+2.) ./configure ${CONFIGURE_FLAGS}
+
+3.) make
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..b292adf
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,31 @@
+# Initialization
+AC_PREREQ([2.69])
+AC_INIT([phosphor-host-ipmid], [1.0], [https://github.com/openbmc/phosphor-host-ipmid/issues])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
+AM_PROG_AR()
+
+# Checks for programs.
+AC_PROG_CXX
+AX_CXX_COMPILE_STDCXX(14, [noext])
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+
+# Checks for libraries.
+AC_CHECK_LIB([mapper], [mapper_get_service])
+PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
+
+# Checks for header files.
+AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])])
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+LT_INIT
+LT_LIB_DLLOAD
+AC_ENABLE_SHARED
+AC_DISABLE_STATIC
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
OpenPOWER on IntegriCloud