Makefile.package (e7853995594baa1a1258b20ff077b60a958becdc) Makefile.package (e0ca16749ac3392a5a2ea4e67327fa71ef4aa680)
1# SPDX-License-Identifier: GPL-2.0-only
2# Makefile for the different targets used to generate full packages of a kernel
3
4include $(srctree)/scripts/Kbuild.include
5
6KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
7KBUILD_PKG_ROOTCMD ?="fakeroot -u"
8# Include only those top-level files that are needed by make, plus the GPL copy

--- 36 unchanged lines hidden (view full) ---

45
46quiet_cmd_tar = TAR $@
47 cmd_tar = tar -c -f $@ $(tar-compress-opt) $(tar-exclude-opt) \
48 --owner=0 --group=0 --sort=name \
49 --transform 's:^\.:$*:S' -C $(tar-rootdir) .
50
51tar-rootdir := $(srctree)
52
1# SPDX-License-Identifier: GPL-2.0-only
2# Makefile for the different targets used to generate full packages of a kernel
3
4include $(srctree)/scripts/Kbuild.include
5
6KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
7KBUILD_PKG_ROOTCMD ?="fakeroot -u"
8# Include only those top-level files that are needed by make, plus the GPL copy

--- 36 unchanged lines hidden (view full) ---

45
46quiet_cmd_tar = TAR $@
47 cmd_tar = tar -c -f $@ $(tar-compress-opt) $(tar-exclude-opt) \
48 --owner=0 --group=0 --sort=name \
49 --transform 's:^\.:$*:S' -C $(tar-rootdir) .
50
51tar-rootdir := $(srctree)
52
53%.tar:
54 $(call cmd,tar)
55
53%.tar.gz: private tar-compress-opt := -I $(KGZIP)
54%.tar.gz:
55 $(call cmd,tar)
56
56%.tar.gz: private tar-compress-opt := -I $(KGZIP)
57%.tar.gz:
58 $(call cmd,tar)
59
60%.tar.bz2: private tar-compress-opt := -I $(KBZIP2)
61%.tar.bz2:
62 $(call cmd,tar)
63
64%.tar.xz: private tar-compress-opt := -I $(XZ)
65%.tar.xz:
66 $(call cmd,tar)
67
68%.tar.zst: private tar-compress-opt := -I $(ZSTD)
69%.tar.zst:
70 $(call cmd,tar)
71
57# Linux source tarball
58# ---------------------------------------------------------------------------
59
60linux.tar.gz: tar-exclude-opt = --exclude=./$@ --exclude-from=$<_exclude
61linux.tar.gz: .tmp_filelist
62
63# rpm-pkg
64# ---------------------------------------------------------------------------

--- 68 unchanged lines hidden (view full) ---

133# tarball targets
134# ---------------------------------------------------------------------------
135tar-pkgs := dir-pkg tar-pkg targz-pkg tarbz2-pkg tarxz-pkg tarzst-pkg
136PHONY += $(tar-pkgs)
137$(tar-pkgs):
138 $(MAKE) -f $(srctree)/Makefile
139 +$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
140
72# Linux source tarball
73# ---------------------------------------------------------------------------
74
75linux.tar.gz: tar-exclude-opt = --exclude=./$@ --exclude-from=$<_exclude
76linux.tar.gz: .tmp_filelist
77
78# rpm-pkg
79# ---------------------------------------------------------------------------

--- 68 unchanged lines hidden (view full) ---

148# tarball targets
149# ---------------------------------------------------------------------------
150tar-pkgs := dir-pkg tar-pkg targz-pkg tarbz2-pkg tarxz-pkg tarzst-pkg
151PHONY += $(tar-pkgs)
152$(tar-pkgs):
153 $(MAKE) -f $(srctree)/Makefile
154 +$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
155
141# perf-pkg - generate a source tarball with perf source
156# perf-tar*-src-pkg - generate a source tarball with perf source
142# ---------------------------------------------------------------------------
143
157# ---------------------------------------------------------------------------
158
144perf-tar=perf-$(KERNELVERSION)
159perf-tar-src-pkg-tarball = perf-$(KERNELVERSION).$(1)
160perf-tar-src-pkg-phony = perf-$(subst .,,$(1))-src-pkg
145
161
146quiet_cmd_perf_tar = TAR
147 cmd_perf_tar = \
148git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \
149 HEAD^{tree} $$(cd $(srctree); \
150 echo $$(cat tools/perf/MANIFEST)) \
151 -o $(perf-tar).tar; \
152mkdir -p $(perf-tar); \
153git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \
154(cd $(srctree)/tools/perf; \
155util/PERF-VERSION-GEN $(CURDIR)/$(perf-tar)/); \
156tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \
157rm -r $(perf-tar); \
158$(if $(findstring tar-src,$@),, \
159$(if $(findstring bz2,$@),$(KBZIP2), \
160$(if $(findstring gz,$@),$(KGZIP), \
161$(if $(findstring xz,$@),$(XZ), \
162$(if $(findstring zst,$@),$(ZSTD), \
163$(error unknown target $@))))) \
164 -f -9 $(perf-tar).tar)
162quiet_cmd_stage_perf_src = STAGE $@
163 cmd_stage_perf_src = \
164 rm -rf $@; \
165 mkdir -p $@; \
166 tar -c -f - --exclude-from=$<_exclude -C $(srctree) --files-from=$(srctree)/tools/perf/MANIFEST | \
167 tar -x -f - -C $@
165
168
166perf-tar-pkgs := perf-tar-src-pkg perf-targz-src-pkg perf-tarbz2-src-pkg \
167 perf-tarxz-src-pkg perf-tarzst-src-pkg
168PHONY += $(perf-tar-pkgs)
169$(perf-tar-pkgs):
170 $(call cmd,perf_tar)
169.tmp_perf: .tmp_filelist
170 $(call cmd,stage_perf_src)
171
171
172filechk_perf_head = \
173 if test -z "$(git -C $(srctree) rev-parse --show-cdup 2>/dev/null)" && \
174 head=$$(git -C $(srctree) rev-parse --verify HEAD 2>/dev/null); then \
175 echo $$head; \
176 else \
177 echo "not a git tree"; \
178 fi
179
180.tmp_perf/HEAD: .tmp_perf FORCE
181 $(call filechk,perf_head)
182
183quiet_cmd_perf_version_file = GEN $@
184 cmd_perf_version_file = cd $(srctree)/tools/perf; util/PERF-VERSION-GEN $(dir $(abspath $@))
185
186# PERF-VERSION-FILE and HEAD are independent, but this avoids updating the
187# timestamp of PERF-VERSION-FILE.
188# The best is to fix tools/perf/util/PERF-VERSION-GEN.
189.tmp_perf/PERF-VERSION-FILE: .tmp_perf/HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN
190 $(call cmd,perf_version_file)
191
192define perf-tar-src-pkg-rule
193PHONY += $(perf-tar-src-pkg-phony)
194$(perf-tar-src-pkg-phony): $(perf-tar-src-pkg-tarball)
195 @:
196
197$(perf-tar-src-pkg-tarball): private tar-rootdir := .tmp_perf
198$(perf-tar-src-pkg-tarball): .tmp_filelist .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE
199endef
200
201$(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call perf-tar-src-pkg-rule,$(x))))
202
172# Help text displayed when executing 'make help'
173# ---------------------------------------------------------------------------
174PHONY += help
175help:
176 @echo ' rpm-pkg - Build both source and binary RPM kernel packages'
177 @echo ' srcrpm-pkg - Build only the source kernel RPM package'
178 @echo ' binrpm-pkg - Build only the binary kernel RPM package'
179 @echo ' deb-pkg - Build both source and binary deb kernel packages'
180 @echo ' bindeb-pkg - Build only the binary kernel deb package'
181 @echo ' snap-pkg - Build only the binary kernel snap package'
182 @echo ' (will connect to external hosts)'
183 @echo ' dir-pkg - Build the kernel as a plain directory structure'
184 @echo ' tar-pkg - Build the kernel as an uncompressed tarball'
185 @echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
186 @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
187 @echo ' tarxz-pkg - Build the kernel as a xz compressed tarball'
188 @echo ' tarzst-pkg - Build the kernel as a zstd compressed tarball'
203# Help text displayed when executing 'make help'
204# ---------------------------------------------------------------------------
205PHONY += help
206help:
207 @echo ' rpm-pkg - Build both source and binary RPM kernel packages'
208 @echo ' srcrpm-pkg - Build only the source kernel RPM package'
209 @echo ' binrpm-pkg - Build only the binary kernel RPM package'
210 @echo ' deb-pkg - Build both source and binary deb kernel packages'
211 @echo ' bindeb-pkg - Build only the binary kernel deb package'
212 @echo ' snap-pkg - Build only the binary kernel snap package'
213 @echo ' (will connect to external hosts)'
214 @echo ' dir-pkg - Build the kernel as a plain directory structure'
215 @echo ' tar-pkg - Build the kernel as an uncompressed tarball'
216 @echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
217 @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
218 @echo ' tarxz-pkg - Build the kernel as a xz compressed tarball'
219 @echo ' tarzst-pkg - Build the kernel as a zstd compressed tarball'
189 @echo ' perf-tar-src-pkg - Build $(perf-tar).tar source tarball'
190 @echo ' perf-targz-src-pkg - Build $(perf-tar).tar.gz source tarball'
191 @echo ' perf-tarbz2-src-pkg - Build $(perf-tar).tar.bz2 source tarball'
192 @echo ' perf-tarxz-src-pkg - Build $(perf-tar).tar.xz source tarball'
193 @echo ' perf-tarzst-src-pkg - Build $(perf-tar).tar.zst source tarball'
220 @echo ' perf-tar-src-pkg - Build the perf source tarball with no compression'
221 @echo ' perf-targz-src-pkg - Build the perf source tarball with gzip compression'
222 @echo ' perf-tarbz2-src-pkg - Build the perf source tarball with bz2 compression'
223 @echo ' perf-tarxz-src-pkg - Build the perf source tarball with xz compression'
224 @echo ' perf-tarzst-src-pkg - Build the perf source tarball with zst compression'
194
195PHONY += FORCE
196FORCE:
197
198.PHONY: $(PHONY)
225
226PHONY += FORCE
227FORCE:
228
229.PHONY: $(PHONY)