summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2016-10-06 10:15:48 -0500
committerMatthew Barth <msbarth@us.ibm.com>2016-10-13 16:09:09 -0500
commit6292aeed77cb97a069655d80c37d3587d0846bad (patch)
tree79cbaa6fa696f26b79f9ee4615c563d73c0d5f2b
parent1f1b41ed8e1be794e51559abf14db9dad3e2bcdc (diff)
downloadphosphor-hwmon-6292aeed77cb97a069655d80c37d3587d0846bad.tar.gz
phosphor-hwmon-6292aeed77cb97a069655d80c37d3587d0846bad.zip
Convert build process to autotools
Replaced the use of a manual Makefile with the use of autotools to automatically verify and generate the necessary build files. Follow the steps outlined within the README.md file to build the package. Change-Id: Ieed870c63b2bef83b3741dd22e413c25916ed408 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
-rw-r--r--Makefile60
-rw-r--r--Makefile.am12
-rw-r--r--README.md13
-rw-r--r--argument.cpp (renamed from argument.C)2
-rw-r--r--argument.hpp (renamed from argument.H)0
-rwxr-xr-xbootstrap.sh18
-rw-r--r--configure.ac49
-rw-r--r--directory.cpp (renamed from directory.C)2
-rw-r--r--directory.hpp (renamed from directory.H)0
-rw-r--r--hwmon.hpp (renamed from hwmon.H)0
-rw-r--r--readd.cpp (renamed from readd.C)10
-rw-r--r--sensorcache.hpp (renamed from sensorcache.H)0
-rw-r--r--sensorset.cpp (renamed from sensorset.C)4
-rw-r--r--sensorset.hpp (renamed from sensorset.H)0
-rw-r--r--sysfs.hpp (renamed from sysfs.H)0
15 files changed, 99 insertions, 71 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 72bec3d..0000000
--- a/Makefile
+++ /dev/null
@@ -1,60 +0,0 @@
-LIBS += libphosphor-hwmon.so
-libphosphor-hwmon.so_OBJS += argument.o
-libphosphor-hwmon.so_OBJS += directory.o
-libphosphor-hwmon.so_OBJS += sensorset.o
-
-EXES += phosphor-hwmon-readd
-phosphor-hwmon-readd_OBJS += readd.o
-phosphor-hwmon-readd_LIBS += phosphor-hwmon
-
-#TODO: Issue#1 - Add the write-daemon for fan, pwm control.
-#EXES += phosphor-hwmon-writed
-#phosphor-hwmon-writed_OBJS += writed.o
-#phosphor-hwmon-writed_LIBS += phosphor-hwmon
-
-#### -----------------------------------------------------------------------####
-# #
-## Compilare Regulas Sequi ##
-# #
-#### -----------------------------------------------------------------------####
-
-CXXFLAGS ?= -O3 -g -pipe
-CXXFLAGS += --std=gnu++14 -Wall -Werror -flto -fPIC
-
-define __BUILD_EXE
-$1 : $$($1_OBJS) $$(LIBS)
- $$(LINK.cpp) -o $$@ $$^
-
-#include $$($1_OBJS:.o=.d)
-endef
-
-$(foreach exe,$(EXES),$(eval $(call __BUILD_EXE,$(exe))))
-
-define __BUILD_LIB
-$1 : $$($1_OBJS)
- $$(LINK.cpp) -shared -o $$@ $$^
-
-#include $$($1_OBJS:.o=.d)
-endef
-
-$(foreach lib,$(LIBS),$(eval $(call __BUILD_LIB,$(lib))))
-
-.PHONY: clean
-clean:
- $(RM) $(foreach exe,$(EXES),$(exe) $($(exe)_OBJS)) \
- $(foreach lib,$(LIBS),$(lib) $($(lib)_OBJS))
-
-DESTDIR ?= /
-BINDIR ?= /usr/bin
-LIBDIR ?= /usr/lib
-
-.PHONY: install
-install:
- install -m 0755 -d $(DESTDIR)$(BINDIR)
- install -m 0755 $(EXES) $(DESTDIR)$(BINDIR)
- install -m 0755 -d $(DESTDIR)$(LIBDIR)
- install -m 0755 $(LIBS) $(DESTDIR)$(LIBDIR)
-
-.DEFAULT_GOAL: all
-.PHONY: all
-all: $(EXES) $(LIBS)
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..571f857
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,12 @@
+bin_PROGRAMS = phosphor-hwmon-readd
+
+phosphor_hwmon_readd_SOURCES = readd.cpp
+phosphor_hwmon_readd_LDADD = libphosphor-hwmon.la
+
+libphosphor_hwmondir = ${libdir}
+libphosphor_hwmon_LTLIBRARIES = libphosphor-hwmon.la
+libphosphor_hwmon_la_SOURCES = \
+ argument.cpp \
+ directory.cpp \
+ sensorset.cpp
+libphosphor_hwmon_la_LDFLAGS = -version-info 0:0:0 -shared
diff --git a/README.md b/README.md
index 88122e6..8ac88a2 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,12 @@
-= phosphor-hwmon =
-
Exposes generic hwmon entries as DBus objects.
+
+## To Build
+```
+To build this package, do the following steps:
+
+ 1. ./bootstrap.sh
+ 2. ./configure ${CONFIGURE_FLAGS}
+ 3. make
+
+To full clean the repository again run `./bootstrap.sh clean`.
+```
diff --git a/argument.C b/argument.cpp
index e9a9088..e2ae471 100644
--- a/argument.C
+++ b/argument.cpp
@@ -2,7 +2,7 @@
#include <iterator>
#include <algorithm>
#include <cassert>
-#include "argument.H"
+#include "argument.hpp"
ArgumentParser::ArgumentParser(int argc, char** argv)
{
diff --git a/argument.H b/argument.hpp
index 252fc36..252fc36 100644
--- a/argument.H
+++ b/argument.hpp
diff --git a/bootstrap.sh b/bootstrap.sh
new file mode 100755
index 0000000..50b75b7
--- /dev/null
+++ b/bootstrap.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+AUTOCONF_FILES="Makefile.in aclocal.m4 ar-lib autom4te.cache compile \
+ config.guess config.h.in config.sub configure depcomp install-sh \
+ ltmain.sh missing *libtool test-driver"
+
+case $1 in
+ clean)
+ test -f Makefile && make maintainer-clean
+ for file in ${AUTOCONF_FILES}; do
+ find -name "$file" | xargs -r rm -rf
+ done
+ exit 0
+ ;;
+esac
+
+autoreconf -i
+echo 'Run "./configure ${CONFIGURE_FLAGS} && make"'
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..4447d76
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,49 @@
+# Initialization
+AC_PREREQ([2.69])
+AC_INIT([phosphor-hwmon], [1.0], [https://github.com/openbmc/phosphor-hwmon/issues])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign dist-xz])
+AM_SILENT_RULES([yes])
+
+# Checks for programs.
+AC_PROG_CXX
+AM_PROG_AR
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+
+# Checks for libraries.
+
+# Checks for header files.
+
+# Checks for typedefs, structures, and compiler characteristics.
+AX_CXX_COMPILE_STDCXX_14([noext])
+AX_APPEND_COMPILE_FLAGS([-flto -fpic -Wall -Werror], [CXXFLAGS])
+
+# Checks for library functions.
+LT_INIT([shared])
+
+# Check/set gtest specific functions.
+AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"])
+AC_SUBST(GTEST_CPPFLAGS)
+
+AC_ARG_ENABLE([oe-sdk],
+ AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])
+)
+AC_ARG_VAR(OECORE_TARGET_SYSROOT,
+ [Path to the OE SDK SYSROOT])
+AS_IF([test "x$enable_oe_sdk" == "xyes"],
+ AS_IF([test "x$OECORE_TARGET_SYSROOT" == "x"],
+ AC_MSG_ERROR([OECORE_TARGET_SYSROOT must be set with --enable-oe-sdk])
+ )
+ AC_MSG_NOTICE([Enabling OE-SDK at $OECORE_TARGET_SYSROOT])
+ [
+ testcase_flags="-Wl,-rpath,\${OECORE_TARGET_SYSROOT}/lib"
+ testcase_flags="${testcase_flags} -Wl,-rpath,\${OECORE_TARGET_SYSROOT}/usr/lib"
+ testcase_flags="${testcase_flags} -Wl,-dynamic-linker,`find \${OECORE_TARGET_SYSROOT}/lib/ld-*.so | sort -r -n | head -n1`"
+ ]
+ AC_SUBST([OESDK_TESTCASE_FLAGS], [$testcase_flags])
+)
+
+# Create configured output
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/directory.C b/directory.cpp
index 5be9ff1..93cf5d5 100644
--- a/directory.C
+++ b/directory.cpp
@@ -1,7 +1,7 @@
#include <cerrno>
#include <cstring>
#include <iostream>
-#include "directory.H"
+#include "directory.hpp"
Directory::Directory(const std::string& path) : entry(nullptr)
{
diff --git a/directory.H b/directory.hpp
index 1b085c5..1b085c5 100644
--- a/directory.H
+++ b/directory.hpp
diff --git a/hwmon.H b/hwmon.hpp
index 494d38e..494d38e 100644
--- a/hwmon.H
+++ b/hwmon.hpp
diff --git a/readd.C b/readd.cpp
index 467ecbf..35523d9 100644
--- a/readd.C
+++ b/readd.cpp
@@ -1,11 +1,11 @@
#include <iostream>
#include <memory>
#include <thread>
-#include "argument.H"
-#include "sensorset.H"
-#include "sensorcache.H"
-#include "hwmon.H"
-#include "sysfs.H"
+#include "argument.hpp"
+#include "sensorset.hpp"
+#include "sensorcache.hpp"
+#include "hwmon.hpp"
+#include "sysfs.hpp"
static void exit_with_error(const char* err, char** argv)
{
diff --git a/sensorcache.H b/sensorcache.hpp
index 64333d8..64333d8 100644
--- a/sensorcache.H
+++ b/sensorcache.hpp
diff --git a/sensorset.C b/sensorset.cpp
index 8b59ac1..1edabad 100644
--- a/sensorset.C
+++ b/sensorset.cpp
@@ -1,7 +1,7 @@
#include <regex>
#include <iostream>
-#include "sensorset.H"
-#include "directory.H"
+#include "sensorset.hpp"
+#include "directory.hpp"
// TODO: Issue#2 - STL regex generates really bloated code. Use POSIX regex
// interfaces instead.
diff --git a/sensorset.H b/sensorset.hpp
index beb8446..beb8446 100644
--- a/sensorset.H
+++ b/sensorset.hpp
diff --git a/sysfs.H b/sysfs.hpp
index d073d77..d073d77 100644
--- a/sysfs.H
+++ b/sysfs.hpp
OpenPOWER on IntegriCloud