diff options
Diffstat (limited to 'scripts/package/Makefile')
-rw-r--r-- | scripts/package/Makefile | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 99ca6e76eb0a..1aca224e8597 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
@@ -21,37 +21,38 @@ | |||
21 | # Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT, | 21 | # Note that the rpm-pkg target cannot be used with KBUILD_OUTPUT, |
22 | # but the binrpm-pkg target can; for some reason O= gets ignored. | 22 | # but the binrpm-pkg target can; for some reason O= gets ignored. |
23 | 23 | ||
24 | # Do we have rpmbuild, otherwise fall back to the older rpm | ||
25 | RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ | ||
26 | else echo rpm; fi) | ||
27 | |||
28 | # Remove hyphens since they have special meaning in RPM filenames | 24 | # Remove hyphens since they have special meaning in RPM filenames |
29 | KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) | 25 | KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) |
26 | KDEB_SOURCENAME ?= linux-$(KERNELRELEASE) | ||
27 | export KDEB_SOURCENAME | ||
30 | # Include only those top-level files that are needed by make, plus the GPL copy | 28 | # Include only those top-level files that are needed by make, plus the GPL copy |
31 | TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \ | 29 | TAR_CONTENT := $(KBUILD_ALLDIRS) .config .scmversion Makefile \ |
32 | Kbuild Kconfig COPYING $(wildcard localversion*) | 30 | Kbuild Kconfig COPYING $(wildcard localversion*) |
33 | TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT)) | ||
34 | MKSPEC := $(srctree)/scripts/package/mkspec | 31 | MKSPEC := $(srctree)/scripts/package/mkspec |
35 | 32 | ||
33 | quiet_cmd_src_tar = TAR $(2).tar.gz | ||
34 | cmd_src_tar = \ | ||
35 | if test "$(objtree)" != "$(srctree)"; then \ | ||
36 | echo "Building source tarball is not possible outside the"; \ | ||
37 | echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ | ||
38 | echo "binrpm-pkg or bindeb-pkg target instead."; \ | ||
39 | false; \ | ||
40 | fi ; \ | ||
41 | $(srctree)/scripts/setlocalversion --save-scmversion; \ | ||
42 | ln -sf $(srctree) $(2); \ | ||
43 | tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \ | ||
44 | $(addprefix $(2)/,$(TAR_CONTENT) $(3)); \ | ||
45 | rm -f $(2) $(objtree)/.scmversion | ||
46 | |||
36 | # rpm-pkg | 47 | # rpm-pkg |
37 | # --------------------------------------------------------------------------- | 48 | # --------------------------------------------------------------------------- |
38 | rpm-pkg rpm: FORCE | 49 | rpm-pkg rpm: FORCE |
39 | @if test "$(objtree)" != "$(srctree)"; then \ | ||
40 | echo "Building source + binary RPM is not possible outside the"; \ | ||
41 | echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ | ||
42 | echo "binrpm-pkg target instead."; \ | ||
43 | false; \ | ||
44 | fi | ||
45 | $(MAKE) clean | 50 | $(MAKE) clean |
46 | ln -sf $(srctree) $(KERNELPATH) | ||
47 | $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec | 51 | $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec |
48 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion | 52 | $(call cmd,src_tar,$(KERNELPATH),kernel.spec) |
49 | tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT) | ||
50 | rm $(KERNELPATH) | ||
51 | rm -f $(objtree)/.scmversion | ||
52 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version | 53 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version |
53 | mv -f $(objtree)/.tmp_version $(objtree)/.version | 54 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
54 | $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz | 55 | rpmbuild --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz |
55 | rm $(KERNELPATH).tar.gz kernel.spec | 56 | rm $(KERNELPATH).tar.gz kernel.spec |
56 | 57 | ||
57 | # binrpm-pkg | 58 | # binrpm-pkg |
@@ -62,7 +63,7 @@ binrpm-pkg: FORCE | |||
62 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version | 63 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version |
63 | mv -f $(objtree)/.tmp_version $(objtree)/.version | 64 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
64 | 65 | ||
65 | $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ | 66 | rpmbuild --define "_builddir $(objtree)" --target \ |
66 | $(UTS_MACHINE) -bb $(objtree)/binkernel.spec | 67 | $(UTS_MACHINE) -bb $(objtree)/binkernel.spec |
67 | rm binkernel.spec | 68 | rm binkernel.spec |
68 | 69 | ||
@@ -84,11 +85,17 @@ quiet_cmd_builddeb = BUILDDEB | |||
84 | } && \ | 85 | } && \ |
85 | \ | 86 | \ |
86 | $$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \ | 87 | $$KBUILD_PKG_ROOTCMD $(CONFIG_SHELL) \ |
87 | $(srctree)/scripts/package/builddeb | 88 | $(srctree)/scripts/package/builddeb $@ |
88 | 89 | ||
89 | deb-pkg: FORCE | 90 | deb-pkg: FORCE |
91 | $(MAKE) clean | ||
92 | $(call cmd,src_tar,$(KDEB_SOURCENAME)) | ||
93 | $(MAKE) KBUILD_SRC= | ||
94 | +$(call cmd,builddeb) | ||
95 | |||
96 | bindeb-pkg: FORCE | ||
90 | $(MAKE) KBUILD_SRC= | 97 | $(MAKE) KBUILD_SRC= |
91 | $(call cmd,builddeb) | 98 | +$(call cmd,builddeb) |
92 | 99 | ||
93 | clean-dirs += $(objtree)/debian/ | 100 | clean-dirs += $(objtree)/debian/ |
94 | 101 | ||
@@ -133,8 +140,9 @@ perf-%pkg: FORCE | |||
133 | # --------------------------------------------------------------------------- | 140 | # --------------------------------------------------------------------------- |
134 | help: FORCE | 141 | help: FORCE |
135 | @echo ' rpm-pkg - Build both source and binary RPM kernel packages' | 142 | @echo ' rpm-pkg - Build both source and binary RPM kernel packages' |
136 | @echo ' binrpm-pkg - Build only the binary kernel package' | 143 | @echo ' binrpm-pkg - Build only the binary kernel RPM package' |
137 | @echo ' deb-pkg - Build the kernel as a deb package' | 144 | @echo ' deb-pkg - Build both source and binary deb kernel packages' |
145 | @echo ' bindeb-pkg - Build only the binary kernel deb package' | ||
138 | @echo ' tar-pkg - Build the kernel as an uncompressed tarball' | 146 | @echo ' tar-pkg - Build the kernel as an uncompressed tarball' |
139 | @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' | 147 | @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' |
140 | @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' | 148 | @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' |