2005-05-28 05:24:11 +00:00
|
|
|
#
|
|
|
|
# This Makefile executes the unpack/build/binary targets for a single
|
|
|
|
# subarch, which is passed in the subarch variable. Empty subarch
|
|
|
|
# variable means that we are building for an arch without the subarch.
|
2005-06-24 23:46:18 +00:00
|
|
|
# Additionally, variables version, abiname and ltver are
|
2005-05-28 05:24:11 +00:00
|
|
|
# expected to be available (need to be exported from the parent process).
|
|
|
|
# It is possible to override the flavours by setting the flavours
|
2005-05-29 04:46:18 +00:00
|
|
|
# variable. It will also be passed a list of source files
|
2005-05-28 05:24:11 +00:00
|
|
|
#
|
2005-05-29 04:46:18 +00:00
|
|
|
# This Makefile is run from the debian subdir.
|
2005-05-28 05:24:11 +00:00
|
|
|
#
|
|
|
|
SHELL := sh -e
|
|
|
|
debver := $(version)-$(abiname)
|
|
|
|
debnum := -$(abiname)
|
2005-05-29 04:46:18 +00:00
|
|
|
#
|
|
|
|
# These variables control the behaviour of make-kpkg
|
|
|
|
#
|
2005-08-02 09:58:49 +00:00
|
|
|
# enable cross-compiling for m68k
|
|
|
|
#DEB_HOST_ARCH := m68k
|
|
|
|
#
|
2005-05-28 05:24:11 +00:00
|
|
|
DEBIAN_UPSTREAM_VERSION := $(version)
|
|
|
|
ifeq (,$(DEB_HOST_ARCH))
|
|
|
|
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
|
|
|
|
DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
|
|
|
|
endif
|
2005-08-02 09:58:49 +00:00
|
|
|
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
|
|
|
|
cross_compile := $(DEB_HOST_ARCH)
|
|
|
|
endif
|
2005-05-29 04:46:18 +00:00
|
|
|
export version debnum DEBIAN_UPSTREAM_VERSION DEBIAN_STEM
|
2005-05-28 05:24:11 +00:00
|
|
|
|
|
|
|
karch := $(DEB_HOST_ARCH)
|
|
|
|
#
|
|
|
|
# Build the list of common config files to be included
|
|
|
|
#
|
|
|
|
ifeq ($(subarch),none)
|
|
|
|
basedir := arch/$(karch)
|
|
|
|
append :=
|
|
|
|
else
|
|
|
|
basedir := arch/$(karch)/$(subarch)
|
2005-05-29 04:46:18 +00:00
|
|
|
append := $(subarch)-
|
2005-05-28 05:24:11 +00:00
|
|
|
endif
|
2005-05-29 04:46:18 +00:00
|
|
|
|
2005-05-28 05:24:11 +00:00
|
|
|
configs := $(notdir $(wildcard $(basedir)/config.*))
|
2005-07-19 19:09:39 +00:00
|
|
|
configs := $(filter-out config, $(configs))
|
2005-05-31 15:28:57 +00:00
|
|
|
tkdir := linux-source-$(version)
|
|
|
|
kdir := linux-source-$(version)-$(subarch)
|
2005-05-28 05:24:11 +00:00
|
|
|
ifndef flavours
|
|
|
|
flavours := $(patsubst config.%,%,$(configs))
|
|
|
|
endif
|
2005-05-29 04:46:18 +00:00
|
|
|
controls := templates/control.source.in templates/control.headers.in
|
|
|
|
controls += $(basedir)/control.in
|
2005-05-28 05:24:11 +00:00
|
|
|
|
|
|
|
-include $(basedir)/Makefile.inc
|
|
|
|
|
|
|
|
#
|
|
|
|
# Here we construct the command lines for different make-kpkg
|
2005-05-31 15:28:57 +00:00
|
|
|
# calls (build, linux-image, linux-headers) based on the values
|
2005-05-28 05:24:11 +00:00
|
|
|
# of variables defined so far and provided by the arch/subarch
|
|
|
|
# in Makefile.inc. @flavour@ in the expressions is going to be
|
|
|
|
# replaced by the flavour for which the command is run.
|
|
|
|
#
|
|
|
|
kpkg_headers_cmd := HEADER_CLEAN_HOOK='$(CURDIR)/header-install-$(subarch)'
|
2005-05-29 04:46:18 +00:00
|
|
|
kpkg_headers_cmd += make-kpkg --append-to-version $(append)$(debnum)
|
2005-07-19 20:53:53 +00:00
|
|
|
kpkg_headers_cmd += --stem linux --config defconfig
|
2005-05-29 04:46:18 +00:00
|
|
|
kpkg_build_cmd := make-kpkg --append-to-version $(debnum)-@flavour@
|
|
|
|
kpkg_build_cmd += --stem linux
|
2005-05-28 05:24:11 +00:00
|
|
|
ifdef build_subarch
|
|
|
|
kpkg_build_cmd += --subarch $(build_subarch)
|
|
|
|
endif
|
2005-08-05 20:08:32 +00:00
|
|
|
# XXX: Instead of special-casing m68k here, we could make --arch and
|
|
|
|
# --cross_compile options supported in Makefile.inc, and use them if
|
|
|
|
# DEB_HOST_ARCH != DEB_BUILD_ARCH.. -dil
|
2005-08-02 09:58:49 +00:00
|
|
|
ifeq ($(cross_compile),m68k)
|
|
|
|
kpkg_headers_cmd += --arch m68k --cross_compile m68k-linux
|
|
|
|
kpkg_build_cmd += --arch m68k --cross_compile m68k-linux
|
|
|
|
endif
|
2005-05-28 05:24:11 +00:00
|
|
|
ifdef headers_subarch
|
|
|
|
kpkg_headers_cmd += --subarch $(headers_subarch)
|
|
|
|
endif
|
|
|
|
ifdef build_makeflags
|
2005-07-12 00:35:00 +00:00
|
|
|
export_makeflags := export MAKEFLAGS=$(build_makeflags)
|
|
|
|
else
|
|
|
|
export_makeflags := true
|
2005-05-28 05:24:11 +00:00
|
|
|
endif
|
|
|
|
#
|
|
|
|
# Note that next variable (kpkg_image_pre) is not going to be evaluated
|
|
|
|
# immediately. When referenced, the variable $* will have the current
|
|
|
|
# flavour for which the command is executed. So if this flavour will
|
|
|
|
# happen to be in the image_prefix_flavours list, the call to make-kpkg
|
|
|
|
# will be prepended with contents if image_prefix.
|
|
|
|
#
|
|
|
|
kpkg_image_pre = $(if $(filter $*,$(image_prefix_flavours)),$(image_prefix))
|
|
|
|
kpkg_image_cmd := $(kpkg_build_cmd) --initrd kernel_image
|
|
|
|
kpkg_build_cmd += build
|
|
|
|
kpkg_headers_cmd += kernel-headers
|
|
|
|
ifndef headers_dirs
|
|
|
|
headers_dirs = $(karch)
|
|
|
|
endif
|
2005-07-18 21:46:09 +00:00
|
|
|
ccommon = arch/config arch/$(karch)/config arch/$(karch)/$(subarch)/config
|
2005-05-28 05:24:11 +00:00
|
|
|
#
|
|
|
|
# Here we build lists of directories and stamps which we will depend on.
|
|
|
|
# For each class of such targets there is a pattern rule which will catch
|
|
|
|
# it and do the right thing.
|
|
|
|
#
|
|
|
|
bdirs := $(addprefix build-$(subarch)-, $(flavours))
|
|
|
|
bstamps := $(addprefix build-stamp-$(subarch)-, $(flavours))
|
|
|
|
istamps := $(addprefix install-stamp-$(subarch)-, $(flavours))
|
2005-06-24 23:46:18 +00:00
|
|
|
|
2005-05-28 05:24:11 +00:00
|
|
|
#
|
|
|
|
# Targets
|
|
|
|
#
|
|
|
|
unpack: unpack-stamp-$(subarch)
|
|
|
|
unpack-stamp-$(subarch): $(configs) header-install-$(subarch) $(bdirs)
|
|
|
|
touch unpack-stamp-$(subarch)
|
|
|
|
|
|
|
|
build: build-stamp-$(subarch)
|
|
|
|
build-stamp-$(subarch): unpack-stamp-$(subarch) $(bstamps)
|
|
|
|
touch build-stamp-$(subarch)
|
|
|
|
|
|
|
|
binary-indep: build
|
|
|
|
binary-arch: build headers-stamp $(istamps)
|
|
|
|
mv *.deb ../..
|
|
|
|
|
|
|
|
install-stamp-$(subarch)-%: build-$(subarch)-% build-stamp-$(subarch)-%
|
|
|
|
cp -al $< install-$*;
|
2005-07-12 00:35:00 +00:00
|
|
|
cd install-$*; \
|
|
|
|
$(export_makeflags); \
|
2005-05-28 05:24:11 +00:00
|
|
|
$(strip $(kpkg_image_pre) $(subst @flavour@,$*,$(kpkg_image_cmd)))
|
|
|
|
cat install-$*/debian/files >> files;
|
|
|
|
rm -rf install-$*;
|
|
|
|
touch install-stamp-$(subarch)-$*
|
|
|
|
|
2005-07-18 21:51:19 +00:00
|
|
|
headers-stamp: $(kdir)
|
2005-07-19 19:09:39 +00:00
|
|
|
# The headers config is now automatically generated via the kernel's
|
|
|
|
# defconfig target. Woo!
|
|
|
|
cd $(kdir); $(kpkg_headers_cmd)
|
2005-05-28 05:24:11 +00:00
|
|
|
cat $(kdir)/debian/files >> files
|
|
|
|
touch headers-stamp
|
|
|
|
|
|
|
|
binary: binary-indep binary-arch
|
|
|
|
|
|
|
|
header-install-$(subarch): templates/header-install.in
|
|
|
|
sed -e 's,@kbpkg@,$(kbpkg),g' \
|
|
|
|
-e 's,@ksource_dir@,$(CURDIR)/$(kdir),g' \
|
2005-08-08 06:59:19 +00:00
|
|
|
-e 's,@flavours@,$(flavours),g' \
|
2005-05-28 05:24:11 +00:00
|
|
|
-e 's,@headers_dirs@,$(headers_dirs),g' \
|
|
|
|
templates/header-install.in > header-install-$(subarch)
|
|
|
|
chmod u+x header-install-$(subarch)
|
|
|
|
#
|
|
|
|
# The way to make the correct package names is to make a
|
|
|
|
# subarch-specific post-install script...
|
|
|
|
#
|
2005-07-16 05:23:49 +00:00
|
|
|
ifdef extra_postinstall_command
|
|
|
|
extra_command := $(extra_postinstall_command)
|
|
|
|
else
|
|
|
|
extra_command := true
|
|
|
|
endif
|
2005-05-28 05:24:11 +00:00
|
|
|
post-install-$(subarch): templates/post-install.in
|
2005-07-16 05:23:49 +00:00
|
|
|
sed -e 's,@initrd_modules@,$(initrd_modules),' \
|
|
|
|
-e 's,@append_subarch@,$(append),' \
|
|
|
|
-e 's,@extra_postinstall_command@,$(extra_command),' \
|
2005-05-28 05:24:11 +00:00
|
|
|
templates/post-install.in > post-install-$(subarch)
|
|
|
|
#
|
|
|
|
# Generates the kernel config file for a subarch by merging
|
2005-07-16 01:56:00 +00:00
|
|
|
# the arch-independent config file (arch/config),
|
|
|
|
# arch-specific config file (arch/$(karch)/config),
|
|
|
|
# and subarch specific one (arch/$(karch)/$(subarch)/config).
|
2005-05-28 05:24:11 +00:00
|
|
|
# It is possible to avoid the inclusion of the arch-indep
|
|
|
|
# config file by setting include_common_config = no in the
|
|
|
|
# arch/$(karch)/Makefile.inc.
|
|
|
|
#
|
|
|
|
config.%:
|
|
|
|
@echo "configs=$(configs)"
|
|
|
|
@echo "Generating configuration file $@:"
|
|
|
|
rm -f $@
|
|
|
|
for i in $(ccommon); do \
|
|
|
|
if [ -f $${i} ]; then \
|
|
|
|
cat $${i} >> $@; \
|
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
# Flavour config file must be present
|
|
|
|
cat $(basedir)/$@ >> $@
|
|
|
|
|
2005-05-29 04:46:18 +00:00
|
|
|
srcfiles := $(filter-out ../debian ../linux-source-$(version), $(shell echo ../*))
|
2005-06-26 21:20:23 +00:00
|
|
|
patches := $(wildcard patches-arch/$(subarch).*)
|
|
|
|
patches += $(wildcard patches-arch/$(subarch)_*)
|
|
|
|
patches += $(wildcard patches-arch/$(karch).*)
|
|
|
|
patches += $(wildcard patches-arch/$(karch)_*)
|
2005-05-31 01:17:23 +00:00
|
|
|
patches := $(strip $(patches))
|
2005-07-12 08:57:24 +00:00
|
|
|
# substitute() and friends is duplicated in debian/rules; this should
|
|
|
|
# be cleaned up in the long term. watch out for relative paths, as
|
|
|
|
# debian/rules runs in the top level directory, while debian/Makefile
|
|
|
|
# runs from the debian directory!
|
2005-07-12 08:36:08 +00:00
|
|
|
$(kdir): post-install-$(subarch) $(wildcard templates/control.*.in)
|
2005-05-29 04:46:18 +00:00
|
|
|
mkdir -p $(tkdir)
|
|
|
|
cp -al $(srcfiles) $(tkdir)
|
2005-05-28 05:24:11 +00:00
|
|
|
mkdir -p $(tkdir)/debian
|
2005-05-29 04:46:18 +00:00
|
|
|
cp changelog $(tkdir)/debian
|
|
|
|
cp copyright $(tkdir)/debian
|
* Rewrite gencontrol.
* Use debian/arch/defines, debian/arch/$arch/defines,
debian/arch/$arch/$subarch/defines and
debian/arch/$arch/$subarch/defines.$flavour to gather values.
* Remove fdutils from global Suggests.
r3646: waldi | 2005-07-31 18:48:39 +0000
* debian/bin/gencontrol.py: Add.
* debian/bin/gencontrol: Remove.
* debian/rules
- Use new gencontrol.
- Remove makevars.
* debian/templates/control.headers.in
* debian/templates/control.headers.subarch.in: Add.
* debian/templates/control.image.in: Update.
* debian/templates/control.main.in: Remove kernel-tree entry.
* debian/templates/control.tree.in: Move kernel-tree entry from control.main.in.
* debian/arch/defines, debian/arch/s390/defines, debian/arch/s390/defines.s390,
debian/arch/s390/defines.s390x: Add.
* debian/arch/s390/desc.s390,debian/arch/s390/desc.s390x: Remove.
r3647: waldi | 2005-07-31 18:57:21 +0000
* debian/bin/gencontrol.py: Support desc keyword.
r3648: waldi | 2005-07-31 19:06:30 +0000
* debian/arch/alpha/defines, debian/arch/amd64/defines,
debian/arch/i386/defines, debian/arch/i386/defines.686,
debian/arch/i386/defines.686-smp, debian/arch/i386/defines.k7,
debian/arch/i386/defines.k7-smp, debian/arch/ia64/defines,
debian/arch/m68k/defines, debian/arch/powerpc/defines,
debian/arch/sparc/defines, debian/arch/sparc/defines.sparc64,
debian/arch/sparc/defines.sparc64-smp: Add.
* debian/arch/i386/desc.686, debian/arch/i386/desc.686-smp,
debian/arch/i386/desc.k7, debian/arch/i386/desc.k7-smp,
debian/arch/sparc/desc.sparc64, debian/arch/sparc/desc.sparc64-smp:
Remove
r3649: waldi | 2005-07-31 19:12:49 +0000
* debian/templates/control.image.in: Remove fdutils from Suggests.
* debian/arch/arm/defines: Add.
* debian/arch/alpha/defines, debian/arch/amd64/defines,
debian/arch/i386/defines, debian/arch/ia64/defines,
debian/arch/m68k/defines, debian/arch/powerpc/defines,
debian/arch/sparc/defines: Update.
r3650: waldi | 2005-07-31 19:44:25 +0000
* debian/bin/gencontrol.py, debian/templates/control.headers.in:
Update.
r3680: waldi | 2005-08-03 18:12:37 +0000
* debian/bin/gencontrol.py: Update.
* debian/arch/i386/defines, debian/arch/s390/defines,
debian/arch/sparc/defines: Move settings.
* debian/arch/i386/defines.686, debian/arch/i386/defines.686-smp,
debian/arch/i386/defines.k7, debian/arch/i386/defines.k7-smp,
debian/arch/s390/defines.s390, debian/arch/s390/defines.s390x,
debian/arch/sparc/defines.sparc64, adebian/rch/sparc/defines.sparc64-smp:
Delete.
r3682: waldi | 2005-08-03 22:38:45 +0000
* debian/arch/ia64/defines: Add class definition.s
* debian/arch/ia64/desc.itanium-smp, debian/arch/ia64/desc.itanium
debian/arch/ia64/desc.mckinley-smp, debian/arch/ia64/desc.mckinley:
Delete.
r3687: waldi | 2005-08-05 09:11:10 +0000
* debian/Makefile: Copy control file.
r3689: waldi | 2005-08-05 15:36:24 +0000
* debian/rules: Make debian/changelog a prequisite of debian/control.
svn path=/trunk/kernel/source/linux-2.6/; revision=3691
2005-08-05 16:38:58 +00:00
|
|
|
cp control $(tkdir)/debian/control
|
2005-06-02 00:22:13 +00:00
|
|
|
touch $(tkdir)/debian/official
|
2005-05-31 01:17:23 +00:00
|
|
|
if [ -n '$(patches)' ]; then \
|
|
|
|
cd $(tkdir); \
|
|
|
|
cat $(addprefix ../,$(patches)) | patch -p1; \
|
|
|
|
fi
|
2005-05-28 05:24:11 +00:00
|
|
|
install post-install-$(subarch) $(tkdir)/debian/post-install
|
|
|
|
mv $(tkdir) $@
|
|
|
|
#
|
|
|
|
# This target performs a build for a particular flavour. Note
|
|
|
|
# that in this file it should be always placed *before* the
|
|
|
|
# build-$(subarch)-% target, which creates the build directory.
|
|
|
|
#
|
|
|
|
# Some arches have extra arch/${ARCH}/kernel/asm-offsets.s files
|
2005-05-31 15:28:57 +00:00
|
|
|
# which have to be included in linux-headers. The problem is that
|
2005-05-28 05:24:11 +00:00
|
|
|
# they are only generated during build and we never performed a
|
2005-05-31 15:28:57 +00:00
|
|
|
# full build in the directory $(kdir) where linux-headers are
|
2005-05-28 05:24:11 +00:00
|
|
|
# built. So, after build we check whether current build arch has
|
2005-05-31 15:28:57 +00:00
|
|
|
# such a file and symlink it into the $(kdir) if necessary. It will
|
|
|
|
# then be picked up and included into the linux-headers package
|
|
|
|
# by the headers-install script.
|
2005-05-28 05:24:11 +00:00
|
|
|
#
|
|
|
|
build-stamp-$(subarch)-%: build-$(subarch)-%
|
|
|
|
PATH=$$PWD/bin:$$PATH; \
|
|
|
|
cd $<; \
|
2005-07-12 00:35:00 +00:00
|
|
|
$(export_makeflags); \
|
2005-05-28 05:24:11 +00:00
|
|
|
$(subst @flavour@,$*,$(kpkg_build_cmd)); \
|
|
|
|
$(if $(image_postproc),$(image_postproc),true); \
|
|
|
|
arch=$$(basename $$(readlink include/asm)); \
|
|
|
|
arch="$${arch#asm-}"; \
|
|
|
|
src="arch/$${arch}/kernel/asm-offsets.s"; \
|
|
|
|
dst="../$(kdir)/$${src}"; \
|
|
|
|
if [ -f "$${src}" ] && [ ! -e "$${dst}" ]; then \
|
2005-05-31 23:38:14 +00:00
|
|
|
cp -a "$$(pwd)/$${src}" "$${dst}"; \
|
2005-05-31 03:05:58 +00:00
|
|
|
fi
|
2005-05-28 05:24:11 +00:00
|
|
|
touch build-stamp-$(subarch)-$*
|
|
|
|
#
|
|
|
|
# Creates a build directory for a particular flavour
|
|
|
|
#
|
|
|
|
build-$(subarch)-%: $(kdir) config.%
|
|
|
|
if [ ! -d $@ ]; then \
|
|
|
|
cp -al $(kdir) $@; \
|
|
|
|
cp config.$* $@/.config; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
.PHONY: build unpack binary-indep binary-arch binary
|