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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5