From 3c370c8ff7f432234c737d92feef63498b8ad224 Mon Sep 17 00:00:00 2001 From: Luis Machado Date: Fri, 11 Jan 2019 15:52:53 -0200 Subject: 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 * Makefile (prefix, SRC, EXEC, SUBDIRS, INSTALL_FILES): New variables. (install): New target. * README: Document install target. Signed-off-by: Luis Machado --- Makefile | 21 +++++++++++++++++++++ README | 4 ++++ 2 files changed, 25 insertions(+) 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 @@ recheck: uncheck check 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 @@ Commands make -C cpufreq check +- If you want to install the pm-qa suite somewhere (default prefix is + /opt/pm-qa), invoke: + + make install DESTDIR= Test Specifications =================== -- cgit v1.2.3