Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | # Makefile for the different targets used to generate full packages of a kernel |
2 | # It uses the generic clean infrastructure of kbuild | |
3 | ||
4 | # Ignore the following files/directories during tar operation | |
5 | TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS | |
6 | ||
7 | ||
8 | # RPM target | |
9 | # --------------------------------------------------------------------------- | |
10 | # The rpm target generates two rpm files: | |
11 | # /usr/src/packages/SRPMS/kernel-2.6.7rc2-1.src.rpm | |
12 | # /usr/src/packages/RPMS/i386/kernel-2.6.7rc2-1.<arch>.rpm | |
13 | # The src.rpm files includes all source for the kernel being built | |
14 | # The <arch>.rpm includes kernel configuration, modules etc. | |
15 | # | |
16 | # Process to create the rpm files | |
17 | # a) clean the kernel | |
18 | # b) Generate .spec file | |
19 | # c) Build a tar ball, using symlink to make kernel version | |
20 | # first entry in the path | |
21 | # d) and pack the result to a tar.gz file | |
22 | # e) generate the rpm files, based on kernel.spec | |
23 | # - Use /. to avoid tar packing just the symlink | |
24 | ||
25 | # Do we have rpmbuild, otherwise fall back to the older rpm | |
26 | RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ | |
27 | else echo rpm; fi) | |
28 | ||
29 | # Remove hyphens since they have special meaning in RPM filenames | |
30 | KERNELPATH := kernel-$(subst -,,$(KERNELRELEASE)) | |
31 | MKSPEC := $(srctree)/scripts/package/mkspec | |
32 | PREV := set -e; cd ..; | |
33 | ||
34 | # rpm-pkg | |
4f193362 | 35 | PHONY += rpm-pkg rpm |
1da177e4 LT |
36 | |
37 | $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile | |
38 | $(CONFIG_SHELL) $(MKSPEC) > $@ | |
39 | ||
40 | rpm-pkg rpm: $(objtree)/kernel.spec | |
41 | $(MAKE) clean | |
42 | $(PREV) ln -sf $(srctree) $(KERNELPATH) | |
43 | $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. | |
44 | $(PREV) rm $(KERNELPATH) | |
45 | ||
46 | set -e; \ | |
47 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version | |
48 | set -e; \ | |
49 | mv -f $(objtree)/.tmp_version $(objtree)/.version | |
50 | ||
51 | $(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz | |
52 | rm ../$(KERNELPATH).tar.gz | |
53 | ||
54 | clean-files := $(objtree)/kernel.spec | |
55 | ||
56 | # binrpm-pkg | |
4f193362 | 57 | PHONY += binrpm-pkg |
1da177e4 LT |
58 | $(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile |
59 | $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@ | |
4f193362 | 60 | |
1da177e4 | 61 | binrpm-pkg: $(objtree)/binkernel.spec |
a91f98a2 | 62 | $(MAKE) KBUILD_SRC= |
1da177e4 LT |
63 | set -e; \ |
64 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version | |
65 | set -e; \ | |
66 | mv -f $(objtree)/.tmp_version $(objtree)/.version | |
67 | ||
68 | $(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $< | |
69 | ||
70 | clean-files += $(objtree)/binkernel.spec | |
71 | ||
72 | # Deb target | |
73 | # --------------------------------------------------------------------------- | |
74 | # | |
4f193362 | 75 | PHONY += deb-pkg |
1da177e4 | 76 | deb-pkg: |
a91f98a2 | 77 | $(MAKE) KBUILD_SRC= |
1da177e4 LT |
78 | $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb |
79 | ||
80 | clean-dirs += $(objtree)/debian/ | |
81 | ||
82 | ||
6d983fea JBG |
83 | # tarball targets |
84 | # --------------------------------------------------------------------------- | |
4f193362 | 85 | PHONY += tar%pkg |
6d983fea | 86 | tar%pkg: |
6073aa64 | 87 | $(MAKE) KBUILD_SRC= |
6d983fea JBG |
88 | $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ |
89 | ||
90 | clean-dirs += $(objtree)/tar-install/ | |
91 | ||
92 | ||
1da177e4 LT |
93 | # Help text displayed when executing 'make help' |
94 | # --------------------------------------------------------------------------- | |
95 | help: | |
6d983fea | 96 | @echo ' rpm-pkg - Build the kernel as an RPM package' |
d1788178 | 97 | @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel' |
be3cef98 | 98 | @echo ' and modules' |
6d983fea JBG |
99 | @echo ' deb-pkg - Build the kernel as an deb package' |
100 | @echo ' tar-pkg - Build the kernel as an uncompressed tarball' | |
101 | @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' | |
102 | @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' | |
1da177e4 | 103 |