/usr/share/kernel-package/ruleset/targets/headers.mk is in kernel-package 13.018.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | ######################### -*- Mode: Makefile-Gmake -*- ########################
## headers.mk ---
## Author : Manoj Srivastava ( srivasta@glaurung.internal.golden-gryphon.com )
## Created On : Mon Oct 31 16:23:51 2005
## Created On Node : glaurung.internal.golden-gryphon.com
## Last Modified By : Manoj Srivastava
## Last Modified On : Thu Oct 9 22:09:12 2008
## Last Machine Used: anzu.internal.golden-gryphon.com
## Update Count : 28
## Status : Unknown, Use with caution!
## HISTORY :
## Description : This file is responsible for creating the kernel-headers packages
##
## arch-tag: 2280e193-fbb3-4990-ac8c-d0504ee9bab5
##
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
###############################################################################
LINK_ARCH=$(KERNEL_ARCH)
ifneq ($(filter i386 x86_64,$(KERNEL_ARCH)),)
LINK_ARCH=x86
endif
INSTALL_HDR_PATH=$(SRCDIR)
debian/stamp/install/$(h_package):
$(REASON)
@echo "This is kernel package version $(kpkg_version)."
$(if $(subst $(strip $(UTS_RELEASE_VERSION)),,$(strip $(KERNELRELEASE))), \
echo "The UTS Release version in $(UTS_RELEASE_HEADER)"; \
echo " \"$(strip $(UTS_RELEASE_VERSION))\" "; \
echo "does not match current version:"; \
echo " \"$(strip $(KERNELRELEASE))\" "; \
echo "Please correct this."; \
exit 2,)
rm -rf $(TMPTOP)
@test -d debian/stamp/install || mkdir debian/stamp/install
$(make_directory) $(SRCDIR)
$(make_directory) $(DOCDIR)/examples
$(make_directory) $(TMPTOP)/etc/kernel/header_postinst.d
$(make_directory) $(TMPTOP)/etc/kernel/header_preinst.d
$(make_directory) $(TMPTOP)/etc/kernel/header_postrm.d
$(make_directory) $(TMPTOP)/etc/kernel/header_prerm.d
$(make_directory) $(SRCDIR)/arch/$(LINK_ARCH)
$(make_directory) $(SRCDIR)/arch/$(LINK_ARCH)/kernel/
$(eval $(which_debdir))
######################################################################
#### Add documentation to /usr/share/doc
######################################################################
$(install_file) debian/changelog $(DOCDIR)/changelog.Debian
$(install_file) $(DEBDIR)/pkg/headers/README $(DOCDIR)/debian.README
$(install_file) $(config) $(DOCDIR)/config-$(KERNELRELEASE)
test ! -f debian/stamp/conf/vars || \
$(install_file) debian/stamp/conf/vars $(DOCDIR)/conf.vars
$(install_file) CREDITS $(DOCDIR)/
$(install_file) MAINTAINERS $(DOCDIR)/
$(install_file) REPORTING-BUGS $(DOCDIR)/
$(install_file) README $(DOCDIR)/
if test -f README.Debian ; then \
$(install_file) README.Debian $(DOCDIR)/README.Debian.1st;\
fi
gzip -9qfr $(DOCDIR)/
echo "This was produced by kernel-package version: $(kpkg_version)." > \
$(DOCDIR)/Buildinfo
chmod 0644 $(DOCDIR)/Buildinfo
$(install_file) $(DEBDIR)/pkg/headers/copyright $(DOCDIR)/copyright
######################################################################
####
######################################################################
$(install_file) Makefile $(SRCDIR)
test ! -e Rules.make || $(install_file) Rules.make $(SRCDIR)
test ! -e .kernelrelease || $(install_file) .kernelrelease $(SRCDIR)
test ! -e arch/$(LINK_ARCH)/Makefile || \
$(install_file) arch/$(LINK_ARCH)/Makefile \
$(SRCDIR)/arch/$(LINK_ARCH)
test ! -e arch/$(LINK_ARCH)/Makefile.cpu || \
$(install_file) arch/$(LINK_ARCH)/Makefile.cpu \
$(SRCDIR)/arch/$(LINK_ARCH)
test ! -e arch/$(LINK_ARCH)/Makefile_32.cpu || \
$(install_file) arch/$(LINK_ARCH)/Makefile_32.cpu \
$(SRCDIR)/arch/$(LINK_ARCH)
test ! -e Rules.make || $(install_file) Rules.make $(SRCDIR)
test ! -e Module.symvers || $(install_file) Module.symvers $(SRCDIR)
$(MAKE) INSTALL_HDR_PATH=$(SRCDIR) headers_install
ifneq ($(strip $(int_follow_symlinks_in_src)),)
-tar cfh - include | (cd $(SRCDIR); umask 000; tar xsf -)
-tar cfh - scripts | (cd $(SRCDIR); umask 000; tar xsf -)
test ! -e arch/powerpc/lib/crtsavres.o || \
tar cfh - arch/powerpc/lib/crtsavres.o | (cd $(SRCDIR); umask 000; tar xsf -)
(cd $(SRCDIR)/include; rm -rf asm; ln -s asm-$(LINK_ARCH) asm)
find . -path './scripts/*' -prune -o -path './Documentation/*' -prune -o \
-path './debian/*' -prune -o -type f \
\( -name Makefile -o -name 'Kconfig*' \) -print | \
cpio -pdL --preserve-modification-time $(SRCDIR);
test ! -d arch/$(LINK_ARCH)/include || find arch/$(LINK_ARCH)/include \
-print | cpio -pdL --preserve-modification-time $(SRCDIR);
test ! -d arch/$(LINK_ARCH)/scripts || find arch/$(LINK_ARCH)/scripts \
-print | cpio -pdL --preserve-modification-time $(SRCDIR);
else
-tar cf - include | (cd $(SRCDIR); umask 000; tar xsf -)
-tar cf - scripts | (cd $(SRCDIR); umask 000; tar xsf -)
test ! -e arch/powerpc/lib/crtsavres.o || \
tar cfh - arch/powerpc/lib/crtsavres.o | (cd $(SRCDIR); umask 000; tar xsf -)
(cd $(SRCDIR)/include; rm -f asm; ln -s asm-$(LINK_ARCH) asm)
find . -path './scripts/*' -prune -o -path './Documentation/*' -prune -o \
-path './debian/*' -prune -o -type f \
\( -name Makefile -o -name 'Kconfig*' \) -print | \
cpio -pd --preserve-modification-time $(SRCDIR);
test ! -d arch/$(LINK_ARCH)/include || find arch/$(LINK_ARCH)/include \
-print | cpio -pd --preserve-modification-time $(SRCDIR);
test ! -d arch/$(LINK_ARCH)/scripts || find arch/$(LINK_ARCH)/scripts \
-print | cpio -pd --preserve-modification-time $(SRCDIR);
endif
ifeq ($(strip $(KERNEL_ARCH)),um)
test ! -e arch/$(LINK_ARCH)/Makefile.cpu || \
$(install_file) arch/$(LINK_ARCH)/Makefile.cpu \
$(SRCDIR)/arch/$(LINK_ARCH)/
test ! -e arch/$(LINK_ARCH)/Makefile_32.cpu || \
$(install_file) arch/$(LINK_ARCH)/Makefile_32.cpu \
$(SRCDIR)/arch/$(LINK_ARCH)/
test ! -s $(SRCDIR)/arch/um || $(make_directory) $(SRCDIR)/arch/um
$(install_file) arch/um/Makefile* $(SRCDIR)/arch/um/
test ! -e arch/um/Kconfig.arch || \
$(install_file) arch/um/Kconfig.arch $(SRCDIR)/arch/um/
endif
test ! -e arch/$(LINK_ARCH)/kernel/asm-offsets.s || \
$(install_file) arch/$(LINK_ARCH)/kernel/asm-offsets.s \
$(SRCDIR)/arch/$(LINK_ARCH)/kernel/asm-offsets.s
for file in $(localversion_files) dummy; do \
test ! -e $$file || $(install_file) $$file $(SRCDIR); \
done
######################################################################
# if the file include/generated/uapi/linux/version.h exists then
# include/linux/version.h must not be added to
# linux-headers-... package.
######################################################################
test ! -e $(SRCDIR)/include/linux/version.h || \
test ! -e $(SRCDIR)/include/generated/uapi/linux/version.h || \
rm -f $(SRCDIR)/include/linux/version.h
(cd $(SRCDIR); find . -type d -name .git -print0 | xargs -0r rm -rf {} \; )
(cd $(SRCDIR); find . -type f -name .gitmodule -print0 | xargs -0r rm -f {} \; )
######################################################################
#### Now add in Debian specific informational stuff
######################################################################
$(install_file) .config $(SRCDIR)/.config
echo $(debian) > $(SRCDIR)/$(INT_STEM)-headers.revision
sed -e 's/=V/$(KERNELRELEASE)/g' -e 's/=IB/$(link_in_boot)/g' \
-e 's/=ST/$(INT_STEM)/g' -e 's/=R/$(reverse_symlink)/g' \
-e 's/=K/$(kimage)/g' \
-e 's/=I/$(INITRD)/g' -e 's,=D,$(IMAGEDIR),g' \
-e 's@=A@$(DEB_HOST_ARCH)@g' \
-e 's@=B@$(LINK_ARCH)@g' \
$(DEBDIR)/pkg/headers/create_link > $(DOCDIR)/examples/create_link
test -d $(SRCDIR)/debian || mkdir $(SRCDIR)/debian
for file in $(DEBIAN_FILES) control changelog; do \
cp -f $(DEBDIR)/$$file $(SRCDIR)/debian/; \
done
for dir in $(DEBIAN_DIRS); do \
cp -af $(DEBDIR)/$$dir $(SRCDIR)/debian/; \
done
######################################################################
#### Now strip any elf objects in the header package
######################################################################
# $(DEBDIR)/pkg/headers/create_link > \
# $(TMPTOP)/etc/kernel/postinst.d/create_link-$(KERNELRELEASE)
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
test ! -d $(SRCDIR)/scripts || find $(SRCDIR)/scripts -type f | while read i; do \
if file -b $$i | egrep -q "^ELF.*executable"; then \
strip --strip-all --remove-section=.comment --remove-section=.note $$i; \
fi; \
done
test ! -d $(SRCDIR)/scripts || find $(SRCDIR)/scripts -type f | while read i; do \
if file -b $$i | egrep -q "^ELF.*shared object"; then \
strip --strip-unneeded --remove-section=.comment --remove-section=.note $$i; \
fi; \
done
endif
@echo done > $@
debian/stamp/binary/$(h_package):
$(REASON)
@echo "This is kernel package version $(kpkg_version)."
$(checkdir)
$(TESTROOT)
@test -d debian/stamp/binary || mkdir debian/stamp/binary
$(make_directory) $(TMPTOP)/DEBIAN
$(eval $(deb_rule))
sed -e 's/=V/$(KERNELRELEASE)/g' -e 's/=IB/$(link_in_boot)/g' \
-e 's/=ST/$(INT_STEM)/g' -e 's/=R/$(reverse_symlink)/g' \
-e 's/=KPV/$(kpkg_version)/g' \
-e 's/=K/$(kimage)/g' \
-e 's/=I/$(INITRD)/g' -e 's,=D,$(IMAGEDIR),g' \
-e 's/=P/$(package)/g' \
-e 's@=A@$(DEB_HOST_ARCH)@g' \
-e 's@=B@$(LINK_ARCH)@g' \
$(DEBDIR)/pkg/headers/postinst > $(TMPTOP)/DEBIAN/preinst
chmod 755 $(TMPTOP)/DEBIAN/preinst
sed -e 's/=V/$(KERNELRELEASE)/g' -e 's/=IB/$(link_in_boot)/g' \
-e 's/=ST/$(INT_STEM)/g' -e 's/=R/$(reverse_symlink)/g' \
-e 's/=KPV/$(kpkg_version)/g' \
-e 's/=K/$(kimage)/g' \
-e 's/=I/$(INITRD)/g' -e 's,=D,$(IMAGEDIR),g' \
-e 's/=P/$(package)/g' \
-e 's@=A@$(DEB_HOST_ARCH)@g' \
-e 's@=B@$(LINK_ARCH)@g' \
$(DEBDIR)/pkg/headers/postinst > $(TMPTOP)/DEBIAN/postinst
chmod 755 $(TMPTOP)/DEBIAN/postinst
sed -e 's/=V/$(KERNELRELEASE)/g' -e 's/=IB/$(link_in_boot)/g' \
-e 's/=ST/$(INT_STEM)/g' -e 's/=R/$(reverse_symlink)/g' \
-e 's/=KPV/$(kpkg_version)/g' \
-e 's/=K/$(kimage)/g' \
-e 's/=I/$(INITRD)/g' -e 's,=D,$(IMAGEDIR),g' \
-e 's/=P/$(package)/g' \
-e 's@=A@$(DEB_HOST_ARCH)@g' \
-e 's@=B@$(LINK_ARCH)@g' \
$(DEBDIR)/pkg/headers/postinst > $(TMPTOP)/DEBIAN/prerm
chmod 755 $(TMPTOP)/DEBIAN/prerm
sed -e 's/=V/$(KERNELRELEASE)/g' -e 's/=IB/$(link_in_boot)/g' \
-e 's/=ST/$(INT_STEM)/g' -e 's/=R/$(reverse_symlink)/g' \
-e 's/=KPV/$(kpkg_version)/g' \
-e 's/=K/$(kimage)/g' \
-e 's/=I/$(INITRD)/g' -e 's,=D,$(IMAGEDIR),g' \
-e 's/=P/$(package)/g' \
-e 's@=A@$(DEB_HOST_ARCH)@g' \
-e 's@=B@$(LINK_ARCH)@g' \
$(DEBDIR)/pkg/headers/postinst > $(TMPTOP)/DEBIAN/postrm
chmod 755 $(TMPTOP)/DEBIAN/postrm
# echo "/etc/kernel/postinst.d/create_link-$(KERNELRELEASE)" > $(TMPTOP)/DEBIAN/conffiles
cp -pf debian/control debian/control.dist
ifneq ($(strip $(header_clean_hook)),)
(cd $(SRCDIR); test -x $(header_clean_hook) && $(header_clean_hook))
endif
k=`find $(TMPTOP) -type f | ( while read i; do \
if file -b $$i | egrep -q "^ELF.*executable.*dynamically linked" ; then \
j="$$j $$i"; \
fi; \
done; echo $$j; )`; test -z "$$k" || dpkg-shlibdeps $$k; \
echo "Elf Files: $$K" > $(DOCDIR)/elffiles; \
test -n "$$k" || perl -pli~ -e 's/\$$\{shlibs:Depends\}\,?//g' debian/control
test ! -e debian/control~ || rm -f debian/control~
dpkg-gencontrol -isp -DArchitecture=$(GENCONTROL_ARCH) -p$(package) \
-P$(TMPTOP)/
$(create_md5sum) $(TMPTOP)
chown -R root:root $(TMPTOP)
chmod -R og=rX $(TMPTOP)
dpkg --build $(TMPTOP) $(DEB_DEST)
cp -pf debian/control.dist debian/control
@echo done > $@
debian/stamp/binary/pre-$(h_package): debian/stamp/install/$(h_package)
$(REASON)
$(checkdir)
@echo "This is kernel package version $(kpkg_version)."
@test -d debian/stamp/binary || mkdir debian/stamp/binary
$(require_root)
$(eval $(deb_rule))
$(root_run_command) debian/stamp/binary/$(h_package)
@echo done > $@
#Local variables:
#mode: makefile
#End:
|