/[kernel]/branches/kernel-image-2.6.11/Makefile
ViewVC logotype

Contents of /branches/kernel-image-2.6.11/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3203 - (hide annotations) (download)
Fri May 20 23:45:33 2005 UTC (7 years, 11 months ago) by jurij-guest
Original Path: branches/kernel-image-2.6.11/debian/rules.subarch
File size: 6143 byte(s)
Corrected the naming, which is RFC-compliant now.
Tested subarch and no-subarch builds on i386.
1 jurij-guest 3146 #
2     # This Makefile executes the unpack/build/binary targets for a single
3     # subarch, which is passed in the subarch variable. Empty subarch
4     # variable means that we are building for an arch without the subarch.
5     # Additionally, variables version, abiname and ktver are
6     # expected to be available (need to be exported from the parent process).
7     # It is possible to override the flavours by setting the flavours
8     # variable.
9     #
10     SHELL := sh -e
11     debver := $(version)-$(abiname)
12     uver := $(subst .,_,$(version))
13     debnum := -$(abiname)
14     kbpkg := kernel-kbuild-$(version)-$(abiname)
15     kpatch := /usr/src/kernel-patches/all/$(version)/apply/debian $(version)-$(ktver)
16     DEBIAN_UPSTREAM_VERSION := $(version)
17     ifeq (,$(DEB_HOST_ARCH))
18     DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
19     DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
20     endif
21     export version debnum DEBIAN_UPSTREAM_VERSION
22    
23 jurij-guest 3198 karch := $(DEB_HOST_ARCH)
24     #
25     # Build the list of common config files to be included
26     #
27 jurij-guest 3146 ifeq ($(subarch),none)
28     basedir := arch/$(karch)
29 jurij-guest 3203 append :=
30 jurij-guest 3146 else
31     basedir := arch/$(karch)/$(subarch)
32 jurij-guest 3203 append := -$(subarch)
33 jurij-guest 3146 endif
34 jurij-guest 3198 default := $(basedir)/config.default
35     configs := $(notdir $(wildcard $(basedir)/config.*))
36     configs := $(filter-out config.common config.default, $(configs))
37     tkdir := kernel-source-$(version)
38     kdir := kernel-source-$(version)-$(subarch)
39 jurij-guest 3146 ifndef flavours
40     flavours := $(patsubst config.%,%,$(configs))
41     endif
42     build_prefix := build-$(subarch)-
43 jurij-guest 3203
44 jurij-guest 3146 -include $(basedir)/Makefile.inc
45 jurij-guest 3203
46 jurij-guest 3146 #
47     # Here we construct the command lines for different make-kpkg
48     # calls (build, kernel-image, kernel-headers) based on the values
49     # of variables defined so far and provided by the arch/subarch
50     # in Makefile.inc. Note that $$i in these expressions is going to
51     # become a reference to the shell variable $i, which is expected
52     # to have the current flavour. This is slightly evil, but saves
53     # a lot of grief.
54     #
55     kpkg_headers_cmd := HEADER_CLEAN_HOOK='$(CURDIR)/header-install-$(subarch)'
56 jurij-guest 3203 kpkg_headers_cmd += make-kpkg --append-to-version $(debnum)$(append)
57 jurij-guest 3146 kpkg_build_cmd := make-kpkg --append-to-version $(debnum)-$$i
58     ifdef added_patches
59     kpkg_headers_cmd += --added_patches $(subst @uver@,$(uver),$(added_patches))
60     kpkg_build_cmd += --added_patches $(subst @uver@,$(uver),$(added_patches))
61     endif
62     ifdef build_subarch
63     kpkg_build_cmd += --subarch $$i
64     endif
65     ifdef headers_subarch
66     kpkg_headers_cmd += --subarch $(headers_subarch)
67     endif
68     ifdef build_makeflags
69     kpkg_build_cmd := MAKEFLAGS=$(build_makeflags) $(kpkg_build_cmd)
70     endif
71     kpkg_image_cmd := $(kpkg_build_cmd) --initrd kernel_image
72     kpkg_build_cmd += build
73     kpkg_headers_cmd += kernel-headers
74     ifndef headers_dirs
75     headers_dirs = $(karch)
76     endif
77 jurij-guest 3198 ifneq (no,$(include_common_config))
78     ccommon := arch/config.common
79     endif
80     ccommon += arch/$(karch)/config.common arch/$(karch)/$(subarch)/config.common
81 jurij-guest 3201 bdirs := $(addprefix build-$(subarch)-, $(flavours))
82 jurij-guest 3146 #
83     # TODO:
84     # * Check that make oldconfig does not actually
85     # change the config file. If it does, something
86     # is wrong (missing/extra options, etc).
87     #
88     unpack: unpack-stamp-$(subarch)
89 jurij-guest 3201 unpack-stamp-$(subarch): $(configs) header-install-$(subarch) $(bdirs)
90     # We remove the configs just in case
91 jurij-guest 3146 rm -f $(configs)
92     touch unpack-stamp-$(subarch)
93     #
94     # TODO:
95     # * Implement optional stripping of the kernel
96     # (for sparc).
97     # * Check that it is really ok to call --subarch
98     # with the name of the flavour. For mips which
99     # is another --subarch user it should be fine.
100     #
101     build: build-stamp-$(subarch)
102     build-stamp-$(subarch): unpack-stamp-$(subarch)
103     dh_testdir
104     PATH=$$PWD/bin:$$PATH; \
105     for i in $(flavours); do \
106     cd build-$(subarch)-$$i; \
107     $(kpkg_build_cmd); \
108     cd ..; \
109     done
110     touch build-stamp-$(subarch)
111    
112     binary-indep: build
113     binary-arch: build
114     dh_testdir
115     dh_clean -k
116     dh_installdirs
117    
118     cd $(kdir); $(kpkg_headers_cmd)
119     #
120     # Hmm, is it right to just cat all the debian/files
121     # together? Need to check it out...
122     #
123     cat $(kdir)/debian/files >> debian/files
124    
125     for i in $(flavours); do \
126     cp -al build-$(subarch)-$$i install-$$i; \
127     cd install-$$i; \
128     $(kpkg_image_cmd); \
129     cd ..; \
130     cat install-$$i/debian/files >> debian/files; \
131     rm -rf install-$$i ; \
132     done
133     mv *.deb ..
134    
135     binary: binary-indep binary-arch
136    
137     header-install-$(subarch): header-install.in
138     sed -e 's,@kbpkg@,$(kbpkg),g' \
139     -e 's,@ksource_dir@,$(CURDIR)/$(kdir),g' \
140     -e 's,@headers_dirs@,$(headers_dirs),g' \
141     -e 's,@headers_extra@,$(headers_extra),g' \
142     header-install.in > header-install-$(subarch)
143     chmod u+x header-install-$(subarch)
144 jurij-guest 3198 #
145     # The way to make the correct package names is to make a
146     # subarch-specific post-install script...
147     #
148 jurij-guest 3203 post-install-$(subarch): post-install.in
149 jurij-guest 3146 sed -e 's,@initrd_modules@,$(initrd_modules),' \
150 jurij-guest 3203 -e 's,@append_subarch@,$(append),' \
151     post-install.in > post-install-$(subarch)
152 jurij-guest 3146 #
153     # Generates the kernel config file for a subarch by merging
154     # the arch-independent config file (arch/config.common),
155     # arch-specific config file (arch/$(karch)/config.common),
156     # and subarch specific one (arch/$(karch)/config.subarch).
157     # It is possible to avoid the inclusion of the arch-indep
158     # config file by setting include_common_config = no in the
159 jurij-guest 3198 # arch/$(karch)/Makefile.inc.
160 jurij-guest 3146 #
161     config.%:
162 jurij-guest 3198 @echo "Generating configuration file $@:"
163     rm -f $@
164     for i in $(ccommon); do \
165     if [ -f $${i} ]; then \
166     cat $${i} >> $@; \
167     fi; \
168     done
169     # Flavour config file must be present
170     cat $(basedir)/$@ >> $@
171 jurij-guest 3146 #
172     # TODO: subarch specific patches
173     #
174 jurij-guest 3203 $(kdir): post-install-$(subarch)
175 jurij-guest 3146 dh_testdir
176     tar jxf /usr/src/$(tkdir).tar.bz2
177     mkdir -p $(tkdir)/debian
178     cp debian/changelog $(tkdir)/debian
179     cp debian/control $(tkdir)/debian
180     cp debian/copyright $(tkdir)/debian
181     cp $(default) $(tkdir)/.config
182     touch $(tkdir)/debian/official
183 jurij-guest 3203 install post-install-$(subarch) $(tkdir)/debian/post-install
184 jurij-guest 3146 cd $(tkdir) && $(kpatch)
185     # Here we need to do the subarch-specific patching
186     mv $(tkdir) $@
187    
188 jurij-guest 3201 build-%: $(kdir)
189     if [ ! -d $@ ]; then \
190     cp -al $(kdir) $@; \
191     cp config.$(subst build-$(subarch)-,,$@) $@/.config; \
192     fi
193    
194 jurij-guest 3146 .PHONY: build unpack binary-indep binary-arch binary

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5