Skip to content

Commit f6d8283

Browse files
committed
kbuild: merge cmd_archive_linux and cmd_archive_perf
The two commands, cmd_archive_linux and cmd_archive_perf, are similar. Merge them to make it easier to add more changes to the git-archive command. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
1 parent 735faf9 commit f6d8283

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

scripts/Makefile.package

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,17 @@ check-git:
5757
false; \
5858
fi
5959

60+
quiet_cmd_archive = ARCHIVE $@
61+
cmd_archive = git -C $(srctree) archive \
62+
--output=$$(realpath $@) --prefix=$(basename $@)/ $(archive-args)
63+
6064
# Linux source tarball
6165
# ---------------------------------------------------------------------------
6266

63-
quiet_cmd_archive_linux = ARCHIVE $@
64-
cmd_archive_linux = \
65-
git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ $$(cat $<)
66-
6767
targets += linux.tar
68+
linux.tar: archive-args = $$(cat $<)
6869
linux.tar: .tmp_HEAD FORCE
69-
$(call if_changed,archive_linux)
70+
$(call if_changed,archive)
7071

7172
# rpm-pkg
7273
# ---------------------------------------------------------------------------
@@ -181,16 +182,14 @@ quiet_cmd_perf_version_file = GEN $@
181182
.tmp_perf/PERF-VERSION-FILE: .tmp_HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN | .tmp_perf
182183
$(call cmd,perf_version_file)
183184

184-
quiet_cmd_archive_perf = ARCHIVE $@
185-
cmd_archive_perf = \
186-
git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ \
187-
--add-file=$$(realpath $(word 2, $^)) \
185+
perf-archive-args = --add-file=$$(realpath $(word 2, $^)) \
188186
--add-file=$$(realpath $(word 3, $^)) \
189187
$$(cat $(word 2, $^))^{tree} $$(cat $<)
190188

191189
targets += perf-$(KERNELVERSION).tar
190+
perf-$(KERNELVERSION).tar: archive-args = $(perf-archive-args)
192191
perf-$(KERNELVERSION).tar: tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE
193-
$(call if_changed,archive_perf)
192+
$(call if_changed,archive)
194193

195194
PHONY += perf-tar-src-pkg
196195
perf-tar-src-pkg: perf-$(KERNELVERSION).tar

0 commit comments

Comments
 (0)