Reorganize directory structure

Moving to directory per-application layout.  This facilitates
building single applications which is useful in the Yocto build
environment since different applications satisfy different OpenBMC
build requirements.

A number of issues are also addressed:
 - All applications were pulling in libsystemd and the gdbus libs
    irrespective of whether or not they were needed.
 - gpio.o duplicated in every application - moved to libopenbmc_intf
 - Added install target

Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/rules.mk b/rules.mk
new file mode 100644
index 0000000..9cad8cf
--- /dev/null
+++ b/rules.mk
@@ -0,0 +1,31 @@
+TOP := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
+
+.DEFAULT_GOAL := all
+sbindir=/usr/sbin
+libdir=/usr/lib
+
+LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS))
+CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -Werror
+
+INSTALLDEPS?=install-bins
+BIN_SUFFIX?=.exe
+DEFAULT_ALL?=$(BINS)
+
+all: $(DEFAULT_ALL)
+
+%.o: %.c
+	$(CC) -c $(CFLAGS) -fPIC -o $@ $<
+
+$(BINS): %: %.o $(EXTRA_OBJS)
+	$(CC) $(LDFLAGS) -o $@$(BIN_SUFFIX) $^ $(LDLIBS)
+
+install-bins:
+	@mkdir -p $(DESTDIR)$(sbindir)
+	@for b in $(BINS); do \
+		install $$b$(BIN_SUFFIX) $(DESTDIR)$(sbindir) || exit 1; \
+	done
+
+install: all $(INSTALLDEPS)
+
+clean: $(CLEANDEPS)
+	rm -rf *.o $(BINS:=$(BIN_SUFFIX))