pwrctl: add pgood state switching application

pgood_wait simply blocks until the power state changes to
the requested state.

The intent is for use from a systemd unit similar to nm-online.

Change-Id: Icf1e18f5d47d6eb2fc424b4614fd196ef3dfd6ee
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/rules.mk b/rules.mk
index d5d1625..8082933 100644
--- a/rules.mk
+++ b/rules.mk
@@ -5,12 +5,16 @@
 ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS)
 
 BIN_SUFFIX?=.exe
+.PHONY: $(SUBDIRS)
 
-all: $(BINS:=$(BIN_SUFFIX))
+all: $(BINS:=$(BIN_SUFFIX)) $(SUBDIRS)
 
 %.o: %.c
 	$(CC) -c $(ALL_CFLAGS) -o $@ $<
 
+$(SUBDIRS):
+	$(MAKE) -C $@
+
 $(BINS:=$(BIN_SUFFIX)): %$(BIN_SUFFIX): %.o $(EXTRA_OBJS)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
 
@@ -19,6 +23,12 @@
 	@for b in $(BINS:=$(BIN_SUFFIX)); do \
 		install $$b $(DESTDIR)$(sbindir) || exit 1; \
 	done
+	@for d in $(SUBDIRS); do \
+		$(MAKE) -C $$d $@ || exit 1; \
+	done
 
 clean:
 	rm -rf *.o $(BINS:=$(BIN_SUFFIX))
+	@for d in $(SUBDIRS); do \
+		$(MAKE) -C $$d $@ || exit 1; \
+	done