Add install target

The following patch adds an install target so we can install the utils/scripts
somewhere. The default prefix is /opt/pm-qa.

2019-01-11  Luis Machado  <luis.machado@linaro.org>

	* Makefile (prefix, SRC, EXEC, SUBDIRS, INSTALL_FILES): New variables.
	(install): New target.
	* README: Document install target.

Signed-off-by: Luis Machado <luis.machado@linaro.org>
diff --git a/Makefile b/Makefile
index 1c7bc9b..6c0621f 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,15 @@
 #       - initial API and implementation
 #
 hotplug_allow_cpu0?=0
+prefix := /opt/pm-qa
+SRC := $(wildcard utils/*.c) $(wildcard cpuidle/*.c)
+EXEC=$(SRC:%.c=%)
+
+# All directories that need to be created during installation.
+SUBDIRS := $(wildcard */.)
+
+# All files that need to be installed.
+INSTALL_FILES := $(wildcard */*.sh */*.txt) $(EXEC)
 
 # Build all the utils required by the tests.
 all:
@@ -49,3 +58,15 @@
 clean:
 	@(cd utils; $(MAKE) clean)
 
+# Copy all the required directories and files to the installation
+# directory.
+install: all
+	@echo "Installing files to $(DESTDIR)/$(prefix)"
+
+	@(for dir in $(SUBDIRS); do		\
+	  mkdir -p $(DESTDIR)$(prefix)/$$dir;	\
+	done;)
+
+	@(for file in $(INSTALL_FILES); do	    \
+	  cp -a $$file $(DESTDIR)$(prefix)/$$file; \
+	done;)
diff --git a/README b/README
index 8d1519f..db76ea6 100644
--- a/README
+++ b/README
@@ -16,6 +16,10 @@
 
 	make -C cpufreq check
 
+- If you want to install the pm-qa suite somewhere (default prefix is
+  /opt/pm-qa), invoke:
+
+	make install DESTDIR=<destination_directory>
 
 Test Specifications
 ===================