File: source.mk

package info (click to toggle)
kernel-package 13.014%2Bnmu1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,804 kB
  • ctags: 603
  • sloc: perl: 2,972; sh: 689; makefile: 204
file content (182 lines) | stat: -rw-r--r-- 9,426 bytes parent folder | download | duplicates (3)
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
######################### -*- Mode: Makefile-Gmake -*- ########################
## source.mk ---
## Author           : Manoj Srivastava ( srivasta@glaurung.internal.golden-gryphon.com )
## Created On       : Mon Oct 31 13:55:32 2005
## Created On Node  : glaurung.internal.golden-gryphon.com
## Last Modified By : Manoj Srivastava
## Last Modified On : Thu Oct  9 22:08:58 2008
## Last Machine Used: anzu.internal.golden-gryphon.com
## Update Count     : 14
## Status           : Unknown, Use with caution!
## HISTORY          :
## Description      : This file is responsible forcreating the kernel-source packages
##
## arch-tag: 1a7fd804-128f-4f9d-9e3d-ce6bdb731823
##
##
## 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
##
###############################################################################


debian/stamp/install/$(s_package):
	$(REASON)
	@echo "This is kernel package version $(kpkg_version)."
	rm -rf $(TMPTOP)
	@test -d debian/stamp/install || mkdir debian/stamp/install
	$(make_directory) $(SRCDIR)
	$(make_directory) $(DOCDIR)
	$(make_directory) $(TMPTOP)/etc/kernel/src_postinst.d
	$(make_directory) $(TMPTOP)/etc/kernel/src_preinst.d
	$(make_directory) $(TMPTOP)/etc/kernel/src_postrm.d
	$(make_directory) $(TMPTOP)/etc/kernel/src_prerm.d
	$(eval $(which_debdir))
######################################################################
#### Add documentation to /usr/share/doc
######################################################################
	$(install_file) README                         $(DOCDIR)/README
	$(install_file) debian/changelog               $(DOCDIR)/changelog.Debian
	$(install_file) $(DEBDIR)/docs/README          $(DOCDIR)/debian.README
	$(install_file) $(DEBDIR)/docs/README.modules  $(DOCDIR)/
	$(install_file) $(DEBDIR)/docs/Rationale       $(DOCDIR)/
	$(install_file) $(DEBDIR)/examples/sample.module.control               \
                                                       $(DOCDIR)/
	if test -f README.Debian ; then                                                 \
           $(install_file) README.Debian                $(DOCDIR)/README.Debian.1st;\
	fi
	gzip -9qfr                                     $(DOCDIR)/
	$(install_file) $(DEBDIR)/pkg/source/copyright $(DOCDIR)/copyright
	echo "This was produced by kernel-package version $(kpkg_version)." >  \
	                                               $(DOCDIR)/Buildinfo
######################################################################
####
######################################################################
ifneq ($(strip $(int_follow_symlinks_in_src)),)
	-tar cfh - $$(echo * | sed -e 's/ debian//g' -e 's/\.deb//g' ) |       \
	(cd $(SRCDIR); umask 000; tar xpsf -)
	(cd $(SRCDIR)/include; rm -rf asm ; )
else
	-tar cf - $$(echo * | sed -e 's/ debian//g' -e 's/\.deb//g' ) |         \
	(cd $(SRCDIR); umask 000; tar xspf -)
	(cd $(SRCDIR)/include; rm -f asm ; )
endif
	$(install_file) debian/changelog      $(SRCDIR)/Debian.src.changelog
	(cd $(SRCDIR);                                                          \
            $(MAKE) $(EXTRAV_ARG) $(CROSS_ARG) ARCH=$(KERNEL_ARCH) distclean)
	(cd $(SRCDIR);         rm -f stamp-building $(STAMPS_TO_CLEAN))
	(cd $(SRCDIR);                                                          \
         [ ! -d scripts/cramfs ]   || make -C scripts/cramfs distclean ; )
	sed -e 's/=V/$(KERNELRELEASE)/g' -e 's/=A/$(DEB_HOST_ARCH)/g'           \
             -e 's/=ST/$(INT_STEM)/g'  -e 's/=B/$(KERNEL_ARCH)/g'               \
                 $(DEBDIR)/pkg/source/README >  $(SRCDIR)/README.Debian ;
	if test -f README.Debian ; then                                         \
           $(install_file) README.Debian        $(DOCDIR)/README.Debian.1st;    \
	   gzip -9qf                            $(DOCDIR)/README.Debian.1st;    \
	fi
	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
	(cd $(SRCDIR); find . -type d -name .arch-ids -print0  | xargs -0r rm -rf {} \; )
	(cd $(SRCDIR); find . -type d -name .git -print0       | xargs -0r rm -rf {} \; )
	(cd $(SRCDIR); find . -type f -name .gitmodule -print0 | xargs -0r rm -f  {} \; )
ifneq ($(strip $(source_clean_hook)),)
	(cd $(SRCDIR); test -x $(source_clean_hook) && $(source_clean_hook))
endif
	(cd $(SRCDIR) && cd .. &&                                            \
           tar $(TAR_COMPRESSION) -cf $(package).tar.$(TAR_SUFFIX) $(package) && \
             rm -rf $(package);)
	@echo done > $@

debian/stamp/binary/$(s_package):
	$(REASON)
	$(checkdir)
	$(TESTROOT)
	@test -d debian/stamp/binary || mkdir debian/stamp/binary
	@echo "This is kernel package version $(kpkg_version)."
	$(eval $(which_debdir))
	$(make_directory) $(TMPTOP)/DEBIAN
	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/=MD/$(initrddep)/g' -e 's/=P/$(package)/g'         \
            -e 's@=MK@$(initrdcmd)@g' -e 's@=A@$(DEB_HOST_ARCH)@g'   \
            -e 's@=M@$(MKIMAGE)@g'    -e 's/=OF/$(AM_OFFICIAL)/g'    \
            -e 's/=S/$(no_symlink)/g'  -e 's@=B@$(LINK_ARCH)@g'    \
		$(DEBDIR)/pkg/source/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/=MD/$(initrddep)/g' -e 's/=P/$(package)/g'         \
            -e 's@=MK@$(initrdcmd)@g' -e 's@=A@$(DEB_HOST_ARCH)@g'   \
            -e 's@=M@$(MKIMAGE)@g'    -e 's/=OF/$(AM_OFFICIAL)/g'    \
            -e 's/=S/$(no_symlink)/g'  -e 's@=B@$(LINK_ARCH)@g'    \
		$(DEBDIR)/pkg/source/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/=MD/$(initrddep)/g' -e 's/=P/$(package)/g'         \
            -e 's@=MK@$(initrdcmd)@g' -e 's@=A@$(DEB_HOST_ARCH)@g'   \
            -e 's@=M@$(MKIMAGE)@g'    -e 's/=OF/$(AM_OFFICIAL)/g'    \
            -e 's/=S/$(no_symlink)/g'  -e 's@=B@$(LINK_ARCH)@g'    \
		$(DEBDIR)/pkg/source/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/=MD/$(initrddep)/g' -e 's/=P/$(package)/g'         \
            -e 's@=MK@$(initrdcmd)@g' -e 's@=A@$(DEB_HOST_ARCH)@g'   \
            -e 's@=M@$(MKIMAGE)@g'    -e 's/=OF/$(AM_OFFICIAL)/g'    \
            -e 's/=S/$(no_symlink)/g'  -e 's@=B@$(LINK_ARCH)@g'    \
		$(DEBDIR)/pkg/source/postinst >        $(TMPTOP)/DEBIAN/postrm
	chmod 755                                       $(TMPTOP)/DEBIAN/postrm
	chmod -R og=rX                               $(TMPTOP)
	chown -R root:root                           $(TMPTOP)
	dpkg-gencontrol -isp -p$(package)          -P$(TMPTOP)/
	$(create_md5sum)                            $(TMPTOP)
	chmod -R og=rX                               $(TMPTOP)
	chown -R root:root                           $(TMPTOP)
	dpkg --build                                 $(TMPTOP) $(DEB_DEST)
	@echo done > $@


debian/stamp/binary/pre-$(s_package): debian/stamp/install/$(s_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/$(s_package)
	@echo done > $@



#Local variables:
#mode: makefile
#End: