* [PATCH] pm-graph: Update directory handling and installation process in Makefile
@ 2024-08-25 11:06 Amit Vadhavana
2024-08-26 20:39 ` Todd Brandt
2024-08-26 20:51 ` Todd Brandt
0 siblings, 2 replies; 4+ messages in thread
From: Amit Vadhavana @ 2024-08-25 11:06 UTC (permalink / raw)
To: todd.e.brandt, skhan, ricardo
Cc: av2082000, linux-kernel-mentees, linux-pm, linux-kernel
- Standardize directory variables to support more flexible installations.
- Add copyright and licensing information to the Makefile.
- Introduce ".PHONY" declarations to ensure that specific targets are always
executed, regardless of the presence of files with matching names.
- Add a help target to provide usage instructions.
Signed-off-by: Amit Vadhavana <av2082000@gmail.com>
---
tools/power/pm-graph/Makefile | 111 ++++++++++++++++++++++------------
1 file changed, 73 insertions(+), 38 deletions(-)
diff --git a/tools/power/pm-graph/Makefile b/tools/power/pm-graph/Makefile
index b5310832c19c..aeddbaf2d4c4 100644
--- a/tools/power/pm-graph/Makefile
+++ b/tools/power/pm-graph/Makefile
@@ -1,51 +1,86 @@
# SPDX-License-Identifier: GPL-2.0
-PREFIX ?= /usr
-DESTDIR ?=
+#
+# Copyright (c) 2013, Intel Corporation.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms and conditions of the GNU General Public License,
+# version 2, as published by the Free Software Foundation.
+#
+# This program is distributed in the hope it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# Authors:
+# Todd Brandt <todd.e.brandt@linux.intel.com>
+
+# Prefix to the directories we're installing to
+DESTDIR ?=
+
+# Directory definitions. These are default and most probably
+# do not need to be changed. Please note that DESTDIR is
+# added in front of any of them
+
+BINDIR ?= /usr/bin
+MANDIR ?= /usr/share/man
+LIBDIR ?= /usr/lib
+
+# Toolchain: what tools do we use, and what options do they need:
+INSTALL = /usr/bin/install
+INSTALL_DATA = ${INSTALL} -m 644
all:
@echo "Nothing to build"
install : uninstall
- install -d $(DESTDIR)$(PREFIX)/lib/pm-graph
- install sleepgraph.py $(DESTDIR)$(PREFIX)/lib/pm-graph
- install bootgraph.py $(DESTDIR)$(PREFIX)/lib/pm-graph
- install -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/cgskip.txt $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/freeze-callgraph.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/freeze.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/freeze-dev.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/standby-callgraph.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/standby.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/standby-dev.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/suspend-callgraph.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/suspend.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/suspend-dev.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
- install -m 644 config/suspend-x2-proc.cfg $(DESTDIR)$(PREFIX)/lib/pm-graph/config
-
- install -d $(DESTDIR)$(PREFIX)/bin
- ln -s ../lib/pm-graph/bootgraph.py $(DESTDIR)$(PREFIX)/bin/bootgraph
- ln -s ../lib/pm-graph/sleepgraph.py $(DESTDIR)$(PREFIX)/bin/sleepgraph
-
- install -d $(DESTDIR)$(PREFIX)/share/man/man8
- install bootgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8
- install sleepgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8
+ $(INSTALL) -d $(DESTDIR)$(LIBDIR)/pm-graph
+ $(INSTALL) sleepgraph.py $(DESTDIR)$(LIBDIR)/pm-graph
+ $(INSTALL) bootgraph.py $(DESTDIR)$(LIBDIR)/pm-graph
+ $(INSTALL) -d $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/cgskip.txt $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/freeze-callgraph.cfg $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/freeze.cfg $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/freeze-dev.cfg $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/standby-callgraph.cfg $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/standby.cfg $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/standby-dev.cfg $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/suspend-callgraph.cfg $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/suspend.cfg $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/suspend-dev.cfg $(DESTDIR)$(LIBDIR)/pm-graph/config
+ $(INSTALL_DATA) config/suspend-x2-proc.cfg $(DESTDIR)$(LIBDIR)/pm-graph/config
+
+ $(INSTALL) -d $(DESTDIR)$(BINDIR)
+ ln -s ../lib/pm-graph/bootgraph.py $(DESTDIR)$(BINDIR)/bootgraph
+ ln -s ../lib/pm-graph/sleepgraph.py $(DESTDIR)$(BINDIR)/sleepgraph
+
+ $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8
+ $(INSTALL) bootgraph.8 $(DESTDIR)$(MANDIR)/man8
+ $(INSTALL) sleepgraph.8 $(DESTDIR)$(MANDIR)/man8
uninstall :
- rm -f $(DESTDIR)$(PREFIX)/share/man/man8/bootgraph.8
- rm -f $(DESTDIR)$(PREFIX)/share/man/man8/sleepgraph.8
+ rm -f $(DESTDIR)$(MANDIR)/man8/bootgraph.8
+ rm -f $(DESTDIR)$(MANDIR)/man8/sleepgraph.8
- rm -f $(DESTDIR)$(PREFIX)/bin/bootgraph
- rm -f $(DESTDIR)$(PREFIX)/bin/sleepgraph
+ rm -f $(DESTDIR)$(BINDIR)/bootgraph
+ rm -f $(DESTDIR)$(BINDIR)/sleepgraph
- rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/config/*
- if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config ] ; then \
- rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/config; \
+ rm -f $(DESTDIR)$(LIBDIR)/pm-graph/config/*
+ if [ -d $(DESTDIR)$(LIBDIR)/pm-graph/config ] ; then \
+ rmdir $(DESTDIR)$(LIBDIR)/pm-graph/config; \
fi;
- rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__/*
- if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__ ] ; then \
- rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__; \
+ rm -f $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__/*
+ if [ -d $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__ ] ; then \
+ rmdir $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__; \
fi;
- rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/*
- if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph ] ; then \
- rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph; \
+ rm -f $(DESTDIR)$(LIBDIR)/pm-graph/*
+ if [ -d $(DESTDIR)$(LIBDIR)/pm-graph ] ; then \
+ rmdir $(DESTDIR)$(LIBDIR)/pm-graph; \
fi;
+
+help:
+ @echo 'Building targets:'
+ @echo ' all - Nothing to build'
+ @echo ' install - Install the program and create necessary directories'
+ @echo ' uninstall - Remove installed files and directories'
+
+.PHONY: all install uninstall help
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pm-graph: Update directory handling and installation process in Makefile
2024-08-25 11:06 [PATCH] pm-graph: Update directory handling and installation process in Makefile Amit Vadhavana
@ 2024-08-26 20:39 ` Todd Brandt
2024-08-26 20:51 ` Todd Brandt
1 sibling, 0 replies; 4+ messages in thread
From: Todd Brandt @ 2024-08-26 20:39 UTC (permalink / raw)
To: Amit Vadhavana, skhan, ricardo
Cc: linux-kernel-mentees, linux-pm, linux-kernel
On Sun, 2024-08-25 at 16:36 +0530, Amit Vadhavana wrote:
> - Standardize directory variables to support more flexible
> installations.
> - Add copyright and licensing information to the Makefile.
> - Introduce ".PHONY" declarations to ensure that specific targets are
> always
> executed, regardless of the presence of files with matching names.
> - Add a help target to provide usage instructions.
>
> Signed-off-by: Amit Vadhavana <av2082000@gmail.com>
> ---
> tools/power/pm-graph/Makefile | 111 ++++++++++++++++++++++----------
> --
> 1 file changed, 73 insertions(+), 38 deletions(-)
>
> diff --git a/tools/power/pm-graph/Makefile b/tools/power/pm-
> graph/Makefile
> index b5310832c19c..aeddbaf2d4c4 100644
> --- a/tools/power/pm-graph/Makefile
> +++ b/tools/power/pm-graph/Makefile
> @@ -1,51 +1,86 @@
> # SPDX-License-Identifier: GPL-2.0
> -PREFIX ?= /usr
> -DESTDIR ?=
> +#
> +# Copyright (c) 2013, Intel Corporation.
> +#
> +# This program is free software; you can redistribute it and/or
> modify it
> +# under the terms and conditions of the GNU General Public License,
> +# version 2, as published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope it will be useful, but
> WITHOUT
> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> or
> +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
> License for
> +# more details.
> +#
> +# Authors:
> +# Todd Brandt <todd.e.brandt@linux.intel.com>
> +
> +# Prefix to the directories we're installing to
> +DESTDIR ?=
> +
> +# Directory definitions. These are default and most probably
> +# do not need to be changed. Please note that DESTDIR is
> +# added in front of any of them
> +
> +BINDIR ?= /usr/bin
> +MANDIR ?= /usr/share/man
> +LIBDIR ?= /usr/lib
> +
> +# Toolchain: what tools do we use, and what options do they need:
> +INSTALL = /usr/bin/install
> +INSTALL_DATA = ${INSTALL} -m 644
>
> all:
> @echo "Nothing to build"
>
> install : uninstall
> - install -d $(DESTDIR)$(PREFIX)/lib/pm-graph
> - install sleepgraph.py $(DESTDIR)$(PREFIX)/lib/pm-graph
> - install bootgraph.py $(DESTDIR)$(PREFIX)/lib/pm-graph
> - install -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/cgskip.txt $(DESTDIR)$(PREFIX)/lib/pm-
> graph/config
> - install -m 644 config/freeze-callgraph.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/freeze.cfg $(DESTDIR)$(PREFIX)/lib/pm-
> graph/config
> - install -m 644 config/freeze-dev.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/standby-callgraph.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/standby.cfg $(DESTDIR)$(PREFIX)/lib/pm-
> graph/config
> - install -m 644 config/standby-dev.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/suspend-callgraph.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/suspend.cfg $(DESTDIR)$(PREFIX)/lib/pm-
> graph/config
> - install -m 644 config/suspend-dev.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/suspend-x2-proc.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> -
> - install -d $(DESTDIR)$(PREFIX)/bin
> - ln -s ../lib/pm-graph/bootgraph.py
> $(DESTDIR)$(PREFIX)/bin/bootgraph
> - ln -s ../lib/pm-graph/sleepgraph.py
> $(DESTDIR)$(PREFIX)/bin/sleepgraph
> -
> - install -d $(DESTDIR)$(PREFIX)/share/man/man8
> - install bootgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8
> - install sleepgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8
> + $(INSTALL) -d $(DESTDIR)$(LIBDIR)/pm-graph
> + $(INSTALL) sleepgraph.py $(DESTDIR)$(LIBDIR)/pm-graph
> + $(INSTALL) bootgraph.py $(DESTDIR)$(LIBDIR)/pm-graph
> + $(INSTALL) -d $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/cgskip.txt $(DESTDIR)$(LIBDIR)/pm-
> graph/config
> + $(INSTALL_DATA) config/freeze-callgraph.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/freeze.cfg $(DESTDIR)$(LIBDIR)/pm-
> graph/config
> + $(INSTALL_DATA) config/freeze-dev.cfg $(DESTDIR)$(LIBDIR)/pm-
> graph/config
> + $(INSTALL_DATA) config/standby-callgraph.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/standby.cfg $(DESTDIR)$(LIBDIR)/pm-
> graph/config
> + $(INSTALL_DATA) config/standby-dev.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/suspend-callgraph.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/suspend.cfg $(DESTDIR)$(LIBDIR)/pm-
> graph/config
> + $(INSTALL_DATA) config/suspend-dev.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/suspend-x2-proc.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> +
> + $(INSTALL) -d $(DESTDIR)$(BINDIR)
> + ln -s ../lib/pm-graph/bootgraph.py
> $(DESTDIR)$(BINDIR)/bootgraph
> + ln -s ../lib/pm-graph/sleepgraph.py
> $(DESTDIR)$(BINDIR)/sleepgraph
> +
> + $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8
> + $(INSTALL) bootgraph.8 $(DESTDIR)$(MANDIR)/man8
> + $(INSTALL) sleepgraph.8 $(DESTDIR)$(MANDIR)/man8
>
> uninstall :
> - rm -f $(DESTDIR)$(PREFIX)/share/man/man8/bootgraph.8
> - rm -f $(DESTDIR)$(PREFIX)/share/man/man8/sleepgraph.8
> + rm -f $(DESTDIR)$(MANDIR)/man8/bootgraph.8
> + rm -f $(DESTDIR)$(MANDIR)/man8/sleepgraph.8
>
> - rm -f $(DESTDIR)$(PREFIX)/bin/bootgraph
> - rm -f $(DESTDIR)$(PREFIX)/bin/sleepgraph
> + rm -f $(DESTDIR)$(BINDIR)/bootgraph
> + rm -f $(DESTDIR)$(BINDIR)/sleepgraph
>
> - rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/config/*
> - if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config ] ; then \
> - rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/config; \
> + rm -f $(DESTDIR)$(LIBDIR)/pm-graph/config/*
> + if [ -d $(DESTDIR)$(LIBDIR)/pm-graph/config ] ; then \
> + rmdir $(DESTDIR)$(LIBDIR)/pm-graph/config; \
> fi;
> - rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__/*
> - if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__ ] ; then
> \
> - rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__; \
> + rm -f $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__/*
> + if [ -d $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__ ] ; then \
> + rmdir $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__; \
> fi;
> - rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/*
> - if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph ] ; then \
> - rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph; \
> + rm -f $(DESTDIR)$(LIBDIR)/pm-graph/*
> + if [ -d $(DESTDIR)$(LIBDIR)/pm-graph ] ; then \
> + rmdir $(DESTDIR)$(LIBDIR)/pm-graph; \
> fi;
> +
> +help:
> + @echo 'Building targets:'
> + @echo ' all - Nothing to build'
> + @echo ' install - Install the program and create
> necessary directories'
> + @echo ' uninstall - Remove installed files and
> directories'
> +
> +.PHONY: all install uninstall help
This does look much nicer, and it's good to use the absolute path of
install in case the system doesn't have the PATH setup. Thank you for
cleaning this up!
Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pm-graph: Update directory handling and installation process in Makefile
2024-08-25 11:06 [PATCH] pm-graph: Update directory handling and installation process in Makefile Amit Vadhavana
2024-08-26 20:39 ` Todd Brandt
@ 2024-08-26 20:51 ` Todd Brandt
2024-09-04 12:36 ` Rafael J. Wysocki
1 sibling, 1 reply; 4+ messages in thread
From: Todd Brandt @ 2024-08-26 20:51 UTC (permalink / raw)
To: Amit Vadhavana, skhan, ricardo
Cc: linux-kernel-mentees, linux-pm, linux-kernel
On Sun, 2024-08-25 at 16:36 +0530, Amit Vadhavana wrote:
> - Standardize directory variables to support more flexible
> installations.
> - Add copyright and licensing information to the Makefile.
> - Introduce ".PHONY" declarations to ensure that specific targets are
> always
> executed, regardless of the presence of files with matching names.
> - Add a help target to provide usage instructions.
>
> Signed-off-by: Amit Vadhavana <av2082000@gmail.com>
> ---
> tools/power/pm-graph/Makefile | 111 ++++++++++++++++++++++----------
> --
> 1 file changed, 73 insertions(+), 38 deletions(-)
>
> diff --git a/tools/power/pm-graph/Makefile b/tools/power/pm-
> graph/Makefile
> index b5310832c19c..aeddbaf2d4c4 100644
> --- a/tools/power/pm-graph/Makefile
> +++ b/tools/power/pm-graph/Makefile
> @@ -1,51 +1,86 @@
> # SPDX-License-Identifier: GPL-2.0
> -PREFIX ?= /usr
> -DESTDIR ?=
> +#
> +# Copyright (c) 2013, Intel Corporation.
> +#
> +# This program is free software; you can redistribute it and/or
> modify it
> +# under the terms and conditions of the GNU General Public License,
> +# version 2, as published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope it will be useful, but
> WITHOUT
> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> or
> +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
> License for
> +# more details.
> +#
> +# Authors:
> +# Todd Brandt <todd.e.brandt@linux.intel.com>
> +
> +# Prefix to the directories we're installing to
> +DESTDIR ?=
> +
> +# Directory definitions. These are default and most probably
> +# do not need to be changed. Please note that DESTDIR is
> +# added in front of any of them
> +
> +BINDIR ?= /usr/bin
> +MANDIR ?= /usr/share/man
> +LIBDIR ?= /usr/lib
> +
> +# Toolchain: what tools do we use, and what options do they need:
> +INSTALL = /usr/bin/install
> +INSTALL_DATA = ${INSTALL} -m 644
>
> all:
> @echo "Nothing to build"
>
> install : uninstall
> - install -d $(DESTDIR)$(PREFIX)/lib/pm-graph
> - install sleepgraph.py $(DESTDIR)$(PREFIX)/lib/pm-graph
> - install bootgraph.py $(DESTDIR)$(PREFIX)/lib/pm-graph
> - install -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/cgskip.txt $(DESTDIR)$(PREFIX)/lib/pm-
> graph/config
> - install -m 644 config/freeze-callgraph.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/freeze.cfg $(DESTDIR)$(PREFIX)/lib/pm-
> graph/config
> - install -m 644 config/freeze-dev.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/standby-callgraph.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/standby.cfg $(DESTDIR)$(PREFIX)/lib/pm-
> graph/config
> - install -m 644 config/standby-dev.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/suspend-callgraph.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/suspend.cfg $(DESTDIR)$(PREFIX)/lib/pm-
> graph/config
> - install -m 644 config/suspend-dev.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> - install -m 644 config/suspend-x2-proc.cfg
> $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> -
> - install -d $(DESTDIR)$(PREFIX)/bin
> - ln -s ../lib/pm-graph/bootgraph.py
> $(DESTDIR)$(PREFIX)/bin/bootgraph
> - ln -s ../lib/pm-graph/sleepgraph.py
> $(DESTDIR)$(PREFIX)/bin/sleepgraph
> -
> - install -d $(DESTDIR)$(PREFIX)/share/man/man8
> - install bootgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8
> - install sleepgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8
> + $(INSTALL) -d $(DESTDIR)$(LIBDIR)/pm-graph
> + $(INSTALL) sleepgraph.py $(DESTDIR)$(LIBDIR)/pm-graph
> + $(INSTALL) bootgraph.py $(DESTDIR)$(LIBDIR)/pm-graph
> + $(INSTALL) -d $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/cgskip.txt $(DESTDIR)$(LIBDIR)/pm-
> graph/config
> + $(INSTALL_DATA) config/freeze-callgraph.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/freeze.cfg $(DESTDIR)$(LIBDIR)/pm-
> graph/config
> + $(INSTALL_DATA) config/freeze-dev.cfg $(DESTDIR)$(LIBDIR)/pm-
> graph/config
> + $(INSTALL_DATA) config/standby-callgraph.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/standby.cfg $(DESTDIR)$(LIBDIR)/pm-
> graph/config
> + $(INSTALL_DATA) config/standby-dev.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/suspend-callgraph.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/suspend.cfg $(DESTDIR)$(LIBDIR)/pm-
> graph/config
> + $(INSTALL_DATA) config/suspend-dev.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> + $(INSTALL_DATA) config/suspend-x2-proc.cfg
> $(DESTDIR)$(LIBDIR)/pm-graph/config
> +
> + $(INSTALL) -d $(DESTDIR)$(BINDIR)
> + ln -s ../lib/pm-graph/bootgraph.py
> $(DESTDIR)$(BINDIR)/bootgraph
> + ln -s ../lib/pm-graph/sleepgraph.py
> $(DESTDIR)$(BINDIR)/sleepgraph
> +
> + $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8
> + $(INSTALL) bootgraph.8 $(DESTDIR)$(MANDIR)/man8
> + $(INSTALL) sleepgraph.8 $(DESTDIR)$(MANDIR)/man8
>
> uninstall :
> - rm -f $(DESTDIR)$(PREFIX)/share/man/man8/bootgraph.8
> - rm -f $(DESTDIR)$(PREFIX)/share/man/man8/sleepgraph.8
> + rm -f $(DESTDIR)$(MANDIR)/man8/bootgraph.8
> + rm -f $(DESTDIR)$(MANDIR)/man8/sleepgraph.8
>
> - rm -f $(DESTDIR)$(PREFIX)/bin/bootgraph
> - rm -f $(DESTDIR)$(PREFIX)/bin/sleepgraph
> + rm -f $(DESTDIR)$(BINDIR)/bootgraph
> + rm -f $(DESTDIR)$(BINDIR)/sleepgraph
>
> - rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/config/*
> - if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config ] ; then \
> - rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/config; \
> + rm -f $(DESTDIR)$(LIBDIR)/pm-graph/config/*
> + if [ -d $(DESTDIR)$(LIBDIR)/pm-graph/config ] ; then \
> + rmdir $(DESTDIR)$(LIBDIR)/pm-graph/config; \
> fi;
> - rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__/*
> - if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__ ] ; then
> \
> - rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__; \
> + rm -f $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__/*
> + if [ -d $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__ ] ; then \
> + rmdir $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__; \
> fi;
> - rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/*
> - if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph ] ; then \
> - rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph; \
> + rm -f $(DESTDIR)$(LIBDIR)/pm-graph/*
> + if [ -d $(DESTDIR)$(LIBDIR)/pm-graph ] ; then \
> + rmdir $(DESTDIR)$(LIBDIR)/pm-graph; \
> fi;
> +
> +help:
> + @echo 'Building targets:'
> + @echo ' all - Nothing to build'
> + @echo ' install - Install the program and create
> necessary directories'
> + @echo ' uninstall - Remove installed files and
> directories'
> +
> +.PHONY: all install uninstall help
This does look much nicer, and it's good to use the absolute path of
install in case the system doesn't have the PATH setup. Thank you for
cleaning this up! (re-send with Acked-by)
Acked-by: Todd Brandt <todd.e.brandt@linux.intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pm-graph: Update directory handling and installation process in Makefile
2024-08-26 20:51 ` Todd Brandt
@ 2024-09-04 12:36 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2024-09-04 12:36 UTC (permalink / raw)
To: todd.e.brandt, Amit Vadhavana
Cc: skhan, ricardo, linux-kernel-mentees, linux-pm, linux-kernel
On Mon, Aug 26, 2024 at 10:51 PM Todd Brandt
<todd.e.brandt@linux.intel.com> wrote:
>
> On Sun, 2024-08-25 at 16:36 +0530, Amit Vadhavana wrote:
> > - Standardize directory variables to support more flexible
> > installations.
> > - Add copyright and licensing information to the Makefile.
> > - Introduce ".PHONY" declarations to ensure that specific targets are
> > always
> > executed, regardless of the presence of files with matching names.
> > - Add a help target to provide usage instructions.
> >
> > Signed-off-by: Amit Vadhavana <av2082000@gmail.com>
> > ---
> > tools/power/pm-graph/Makefile | 111 ++++++++++++++++++++++----------
> > --
> > 1 file changed, 73 insertions(+), 38 deletions(-)
> >
> > diff --git a/tools/power/pm-graph/Makefile b/tools/power/pm-
> > graph/Makefile
> > index b5310832c19c..aeddbaf2d4c4 100644
> > --- a/tools/power/pm-graph/Makefile
> > +++ b/tools/power/pm-graph/Makefile
> > @@ -1,51 +1,86 @@
> > # SPDX-License-Identifier: GPL-2.0
> > -PREFIX ?= /usr
> > -DESTDIR ?=
> > +#
> > +# Copyright (c) 2013, Intel Corporation.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > modify it
> > +# under the terms and conditions of the GNU General Public License,
> > +# version 2, as published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope it will be useful, but
> > WITHOUT
> > +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> > or
> > +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
> > License for
> > +# more details.
> > +#
> > +# Authors:
> > +# Todd Brandt <todd.e.brandt@linux.intel.com>
> > +
> > +# Prefix to the directories we're installing to
> > +DESTDIR ?=
> > +
> > +# Directory definitions. These are default and most probably
> > +# do not need to be changed. Please note that DESTDIR is
> > +# added in front of any of them
> > +
> > +BINDIR ?= /usr/bin
> > +MANDIR ?= /usr/share/man
> > +LIBDIR ?= /usr/lib
> > +
> > +# Toolchain: what tools do we use, and what options do they need:
> > +INSTALL = /usr/bin/install
> > +INSTALL_DATA = ${INSTALL} -m 644
> >
> > all:
> > @echo "Nothing to build"
> >
> > install : uninstall
> > - install -d $(DESTDIR)$(PREFIX)/lib/pm-graph
> > - install sleepgraph.py $(DESTDIR)$(PREFIX)/lib/pm-graph
> > - install bootgraph.py $(DESTDIR)$(PREFIX)/lib/pm-graph
> > - install -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> > - install -m 644 config/cgskip.txt $(DESTDIR)$(PREFIX)/lib/pm-
> > graph/config
> > - install -m 644 config/freeze-callgraph.cfg
> > $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> > - install -m 644 config/freeze.cfg $(DESTDIR)$(PREFIX)/lib/pm-
> > graph/config
> > - install -m 644 config/freeze-dev.cfg
> > $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> > - install -m 644 config/standby-callgraph.cfg
> > $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> > - install -m 644 config/standby.cfg $(DESTDIR)$(PREFIX)/lib/pm-
> > graph/config
> > - install -m 644 config/standby-dev.cfg
> > $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> > - install -m 644 config/suspend-callgraph.cfg
> > $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> > - install -m 644 config/suspend.cfg $(DESTDIR)$(PREFIX)/lib/pm-
> > graph/config
> > - install -m 644 config/suspend-dev.cfg
> > $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> > - install -m 644 config/suspend-x2-proc.cfg
> > $(DESTDIR)$(PREFIX)/lib/pm-graph/config
> > -
> > - install -d $(DESTDIR)$(PREFIX)/bin
> > - ln -s ../lib/pm-graph/bootgraph.py
> > $(DESTDIR)$(PREFIX)/bin/bootgraph
> > - ln -s ../lib/pm-graph/sleepgraph.py
> > $(DESTDIR)$(PREFIX)/bin/sleepgraph
> > -
> > - install -d $(DESTDIR)$(PREFIX)/share/man/man8
> > - install bootgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8
> > - install sleepgraph.8 $(DESTDIR)$(PREFIX)/share/man/man8
> > + $(INSTALL) -d $(DESTDIR)$(LIBDIR)/pm-graph
> > + $(INSTALL) sleepgraph.py $(DESTDIR)$(LIBDIR)/pm-graph
> > + $(INSTALL) bootgraph.py $(DESTDIR)$(LIBDIR)/pm-graph
> > + $(INSTALL) -d $(DESTDIR)$(LIBDIR)/pm-graph/config
> > + $(INSTALL_DATA) config/cgskip.txt $(DESTDIR)$(LIBDIR)/pm-
> > graph/config
> > + $(INSTALL_DATA) config/freeze-callgraph.cfg
> > $(DESTDIR)$(LIBDIR)/pm-graph/config
> > + $(INSTALL_DATA) config/freeze.cfg $(DESTDIR)$(LIBDIR)/pm-
> > graph/config
> > + $(INSTALL_DATA) config/freeze-dev.cfg $(DESTDIR)$(LIBDIR)/pm-
> > graph/config
> > + $(INSTALL_DATA) config/standby-callgraph.cfg
> > $(DESTDIR)$(LIBDIR)/pm-graph/config
> > + $(INSTALL_DATA) config/standby.cfg $(DESTDIR)$(LIBDIR)/pm-
> > graph/config
> > + $(INSTALL_DATA) config/standby-dev.cfg
> > $(DESTDIR)$(LIBDIR)/pm-graph/config
> > + $(INSTALL_DATA) config/suspend-callgraph.cfg
> > $(DESTDIR)$(LIBDIR)/pm-graph/config
> > + $(INSTALL_DATA) config/suspend.cfg $(DESTDIR)$(LIBDIR)/pm-
> > graph/config
> > + $(INSTALL_DATA) config/suspend-dev.cfg
> > $(DESTDIR)$(LIBDIR)/pm-graph/config
> > + $(INSTALL_DATA) config/suspend-x2-proc.cfg
> > $(DESTDIR)$(LIBDIR)/pm-graph/config
> > +
> > + $(INSTALL) -d $(DESTDIR)$(BINDIR)
> > + ln -s ../lib/pm-graph/bootgraph.py
> > $(DESTDIR)$(BINDIR)/bootgraph
> > + ln -s ../lib/pm-graph/sleepgraph.py
> > $(DESTDIR)$(BINDIR)/sleepgraph
> > +
> > + $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8
> > + $(INSTALL) bootgraph.8 $(DESTDIR)$(MANDIR)/man8
> > + $(INSTALL) sleepgraph.8 $(DESTDIR)$(MANDIR)/man8
> >
> > uninstall :
> > - rm -f $(DESTDIR)$(PREFIX)/share/man/man8/bootgraph.8
> > - rm -f $(DESTDIR)$(PREFIX)/share/man/man8/sleepgraph.8
> > + rm -f $(DESTDIR)$(MANDIR)/man8/bootgraph.8
> > + rm -f $(DESTDIR)$(MANDIR)/man8/sleepgraph.8
> >
> > - rm -f $(DESTDIR)$(PREFIX)/bin/bootgraph
> > - rm -f $(DESTDIR)$(PREFIX)/bin/sleepgraph
> > + rm -f $(DESTDIR)$(BINDIR)/bootgraph
> > + rm -f $(DESTDIR)$(BINDIR)/sleepgraph
> >
> > - rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/config/*
> > - if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config ] ; then \
> > - rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/config; \
> > + rm -f $(DESTDIR)$(LIBDIR)/pm-graph/config/*
> > + if [ -d $(DESTDIR)$(LIBDIR)/pm-graph/config ] ; then \
> > + rmdir $(DESTDIR)$(LIBDIR)/pm-graph/config; \
> > fi;
> > - rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__/*
> > - if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__ ] ; then
> > \
> > - rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__; \
> > + rm -f $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__/*
> > + if [ -d $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__ ] ; then \
> > + rmdir $(DESTDIR)$(LIBDIR)/pm-graph/__pycache__; \
> > fi;
> > - rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/*
> > - if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph ] ; then \
> > - rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph; \
> > + rm -f $(DESTDIR)$(LIBDIR)/pm-graph/*
> > + if [ -d $(DESTDIR)$(LIBDIR)/pm-graph ] ; then \
> > + rmdir $(DESTDIR)$(LIBDIR)/pm-graph; \
> > fi;
> > +
> > +help:
> > + @echo 'Building targets:'
> > + @echo ' all - Nothing to build'
> > + @echo ' install - Install the program and create
> > necessary directories'
> > + @echo ' uninstall - Remove installed files and
> > directories'
> > +
> > +.PHONY: all install uninstall help
> This does look much nicer, and it's good to use the absolute path of
> install in case the system doesn't have the PATH setup. Thank you for
> cleaning this up! (re-send with Acked-by)
>
> Acked-by: Todd Brandt <todd.e.brandt@linux.intel.com>
Applied as 6.12 material, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-04 12:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-25 11:06 [PATCH] pm-graph: Update directory handling and installation process in Makefile Amit Vadhavana
2024-08-26 20:39 ` Todd Brandt
2024-08-26 20:51 ` Todd Brandt
2024-09-04 12:36 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome