* [PATCH 6.1 091/600] tools lib subcmd: Add install target
[not found] <20230911134633.619970489@linuxfoundation.org>
@ 2023-09-11 13:42 ` Greg Kroah-Hartman
2023-09-11 13:42 ` [PATCH 6.1 092/600] tools lib subcmd: Make install_headers clearer Greg Kroah-Hartman
2023-09-11 13:42 ` [PATCH 6.1 093/600] tools lib subcmd: Add dependency test to install_headers Greg Kroah-Hartman
2 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2023-09-11 13:42 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Namhyung Kim,
Alexander Shishkin, Andrii Nakryiko, Jiri Olsa, Mark Rutland,
Masahiro Yamada, Nick Desaulniers, Nicolas Schier, Peter Zijlstra,
Stephane Eranian, bpf, Arnaldo Carvalho de Melo,
Nathan Chancellor
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
commit 630ae80ea1dd253609cb50cff87f3248f901aca3 upstream.
This allows libsubcmd to be installed as a dependency.
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nicolas Schier <nicolas@fjasle.eu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: bpf@vger.kernel.org
Link: http://lore.kernel.org/lkml/20221109184914.1357295-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
tools/lib/subcmd/Makefile | 49 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
--- a/tools/lib/subcmd/Makefile
+++ b/tools/lib/subcmd/Makefile
@@ -17,6 +17,15 @@ RM = rm -f
MAKEFLAGS += --no-print-directory
+INSTALL = install
+
+# Use DESTDIR for installing into a different root directory.
+# This is useful for building a package. The program will be
+# installed in this directory as if it was the root directory.
+# Then the build tool can move it later.
+DESTDIR ?=
+DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
+
LIBFILE = $(OUTPUT)libsubcmd.a
CFLAGS := -ggdb3 -Wall -Wextra -std=gnu99 -fPIC
@@ -48,6 +57,18 @@ CFLAGS += $(EXTRA_WARNINGS) $(EXTRA_CFLA
SUBCMD_IN := $(OUTPUT)libsubcmd-in.o
+ifeq ($(LP64), 1)
+ libdir_relative = lib64
+else
+ libdir_relative = lib
+endif
+
+prefix ?=
+libdir = $(prefix)/$(libdir_relative)
+
+# Shell quotes
+libdir_SQ = $(subst ','\'',$(libdir))
+
all:
export srctree OUTPUT CC LD CFLAGS V
@@ -61,6 +82,34 @@ $(SUBCMD_IN): FORCE
$(LIBFILE): $(SUBCMD_IN)
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(SUBCMD_IN)
+define do_install_mkdir
+ if [ ! -d '$(DESTDIR_SQ)$1' ]; then \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1'; \
+ fi
+endef
+
+define do_install
+ if [ ! -d '$(DESTDIR_SQ)$2' ]; then \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
+ fi; \
+ $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2'
+endef
+
+install_lib: $(LIBFILE)
+ $(call QUIET_INSTALL, $(LIBFILE)) \
+ $(call do_install_mkdir,$(libdir_SQ)); \
+ cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ)
+
+install_headers:
+ $(call QUIET_INSTALL, headers) \
+ $(call do_install,exec-cmd.h,$(prefix)/include/subcmd,644); \
+ $(call do_install,help.h,$(prefix)/include/subcmd,644); \
+ $(call do_install,pager.h,$(prefix)/include/subcmd,644); \
+ $(call do_install,parse-options.h,$(prefix)/include/subcmd,644); \
+ $(call do_install,run-command.h,$(prefix)/include/subcmd,644);
+
+install: install_lib install_headers
+
clean:
$(call QUIET_CLEAN, libsubcmd) $(RM) $(LIBFILE); \
find $(or $(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 6.1 092/600] tools lib subcmd: Make install_headers clearer
[not found] <20230911134633.619970489@linuxfoundation.org>
2023-09-11 13:42 ` [PATCH 6.1 091/600] tools lib subcmd: Add install target Greg Kroah-Hartman
@ 2023-09-11 13:42 ` Greg Kroah-Hartman
2023-09-11 13:42 ` [PATCH 6.1 093/600] tools lib subcmd: Add dependency test to install_headers Greg Kroah-Hartman
2 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2023-09-11 13:42 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Alexander Shishkin,
Alexei Starovoitov, Andrii Nakryiko, Daniel Borkmann, Hao Luo,
Ingo Molnar, Jiri Olsa, John Fastabend, KP Singh, Mark Rutland,
Martin KaFai Lau, Masahiro Yamada, Namhyung Kim, Nicolas Schier,
Peter Zijlstra, Song Liu, Stanislav Fomichev, Stephane Eranian,
Yonghong Song, bpf, Arnaldo Carvalho de Melo, Nathan Chancellor
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
commit 77dce6890a2a715b186bdc149c843571a5bb47df upstream.
Add libsubcmd to the name so that this install_headers build appears
different to similar targets in different libraries.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Hao Luo <haoluo@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: KP Singh <kpsingh@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin KaFai Lau <martin.lau@linux.dev>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nicolas Schier <nicolas@fjasle.eu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <song@kernel.org>
Cc: Stanislav Fomichev <sdf@google.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20221117004356.279422-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
tools/lib/subcmd/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/tools/lib/subcmd/Makefile
+++ b/tools/lib/subcmd/Makefile
@@ -101,7 +101,7 @@ install_lib: $(LIBFILE)
cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ)
install_headers:
- $(call QUIET_INSTALL, headers) \
+ $(call QUIET_INSTALL, libsubcmd_headers) \
$(call do_install,exec-cmd.h,$(prefix)/include/subcmd,644); \
$(call do_install,help.h,$(prefix)/include/subcmd,644); \
$(call do_install,pager.h,$(prefix)/include/subcmd,644); \
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 6.1 093/600] tools lib subcmd: Add dependency test to install_headers
[not found] <20230911134633.619970489@linuxfoundation.org>
2023-09-11 13:42 ` [PATCH 6.1 091/600] tools lib subcmd: Add install target Greg Kroah-Hartman
2023-09-11 13:42 ` [PATCH 6.1 092/600] tools lib subcmd: Make install_headers clearer Greg Kroah-Hartman
@ 2023-09-11 13:42 ` Greg Kroah-Hartman
2 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2023-09-11 13:42 UTC (permalink / raw)
To: stable
Cc: Greg Kroah-Hartman, patches, Ian Rogers, Alexander Shishkin,
Ingo Molnar, Jiri Olsa, Josh Poimboeuf, Mark Rutland,
Masahiro Yamada, Namhyung Kim, Nathan Chancellor,
Nick Desaulniers, Nicolas Schier, Peter Zijlstra,
Stephane Eranian, Tom Rix, bpf, llvm, Arnaldo Carvalho de Melo
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <irogers@google.com>
commit 5d890591db6bed8ca69bd4bfe0cdaca372973033 upstream.
Compute the headers to be installed from their source headers and make
each have its own build target to install it. Using dependencies
avoids headers being reinstalled and getting a new timestamp which
then causes files that depend on the header to be rebuilt.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nicolas Schier <nicolas@fjasle.eu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Rix <trix@redhat.com>
Cc: bpf@vger.kernel.org
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20221202045743.2639466-4-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
tools/lib/subcmd/Makefile | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
--- a/tools/lib/subcmd/Makefile
+++ b/tools/lib/subcmd/Makefile
@@ -89,10 +89,10 @@ define do_install_mkdir
endef
define do_install
- if [ ! -d '$(DESTDIR_SQ)$2' ]; then \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
+ if [ ! -d '$2' ]; then \
+ $(INSTALL) -d -m 755 '$2'; \
fi; \
- $(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2'
+ $(INSTALL) $1 $(if $3,-m $3,) '$2'
endef
install_lib: $(LIBFILE)
@@ -100,13 +100,16 @@ install_lib: $(LIBFILE)
$(call do_install_mkdir,$(libdir_SQ)); \
cp -fpR $(LIBFILE) $(DESTDIR)$(libdir_SQ)
-install_headers:
- $(call QUIET_INSTALL, libsubcmd_headers) \
- $(call do_install,exec-cmd.h,$(prefix)/include/subcmd,644); \
- $(call do_install,help.h,$(prefix)/include/subcmd,644); \
- $(call do_install,pager.h,$(prefix)/include/subcmd,644); \
- $(call do_install,parse-options.h,$(prefix)/include/subcmd,644); \
- $(call do_install,run-command.h,$(prefix)/include/subcmd,644);
+HDRS := exec-cmd.h help.h pager.h parse-options.h run-command.h
+INSTALL_HDRS_PFX := $(DESTDIR)$(prefix)/include/subcmd
+INSTALL_HDRS := $(addprefix $(INSTALL_HDRS_PFX)/, $(HDRS))
+
+$(INSTALL_HDRS): $(INSTALL_HDRS_PFX)/%.h: %.h
+ $(call QUIET_INSTALL, $@) \
+ $(call do_install,$<,$(INSTALL_HDRS_PFX)/,644)
+
+install_headers: $(INSTALL_HDRS)
+ $(call QUIET_INSTALL, libsubcmd_headers)
install: install_lib install_headers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-11 15:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230911134633.619970489@linuxfoundation.org>
2023-09-11 13:42 ` [PATCH 6.1 091/600] tools lib subcmd: Add install target Greg Kroah-Hartman
2023-09-11 13:42 ` [PATCH 6.1 092/600] tools lib subcmd: Make install_headers clearer Greg Kroah-Hartman
2023-09-11 13:42 ` [PATCH 6.1 093/600] tools lib subcmd: Add dependency test to install_headers Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox