/usr/share/modass/include/generic.make is in module-assistant 0.11.9.
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 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | # generic code for modules packages
# (c) Eduard Bloch <blade@debian.org>, 2003..2007
#
# to be sourced by rules files
#
# needed vars:
# PACKAGE (eg. "bcm4567-module")
# fixme optional var:
# fixme DIRDEPTH (empty or "../" chain for each level that needs to be
# ascended if the Debian dir is in subdirectories
#
# Some parts ripped from:
# alsa-source:
# Written by Steve Kowalik <stevenk@debian.org> for the New Alsa-Source.
# Loosely based on the rules file from pcmcia-cs and the old alsa-source.
ifeq ($(KSRC),)
KSRC = /usr/src/linux
endif
ifeq ($(KVERS),)
KVERS = unknown
endif
package = $(PACKAGE)
PKGARCH = $(shell dpkg --print-architecture)
ifeq ($(ARCH),)
SPARCH=$(shell grep 'CONFIG_SPARC..=y' "$(KSRC)/.config" 2>/dev/null| cut -d= -f1)
#maybe a different ARCH on sparc
ifeq (CONFIG_SPARC32,$(SPARCH))
ARCH :=sparc
export ARCH
endif
ifeq (CONFIG_SPARC64,$(SPARCH))
ARCH :=sparc64
export ARCH
endif
endif
# See if we can work out the compiler used
ifeq ($(origin CC),default)
ifneq "$(wildcard $(KSRC)/include/linux/compile.h)" ""
CC = gcc-$(shell grep LINUX_COMPILER $(KSRC)/include/linux/compile.h | sed 's/.* \([0-9]\+\.[0-9]\+\).*/\1/')
else
CC = gcc
endif
endif
# Special case gcc 2.7.2
ifeq ($(CC),gcc-2.7)
CC = gcc272
endif
export CC
PATH :=/usr/share/modass/$(CC):$(PATH)
export PATH
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
# If they didn't set $(KVERS), see if we can do it for them.
ifeq ($(KVERS),unknown)
ifneq "$(wildcard $(KSRC)/include/generated/utsrelease.h)" ""
KVERS = $(shell head -1 $(KSRC)/include/generated/utsrelease.h | sed 's/.*"\(.*\)"$$/\1/')
else
ifneq "$(wildcard $(KSRC)/include/linux/utsrelease.h)" ""
KVERS = $(shell head -1 $(KSRC)/include/linux/utsrelease.h | sed 's/.*"\(.*\)"$$/\1/')
else
ifneq "$(wildcard $(KSRC)/include/linux/version.h)" ""
KVERS = $(shell head -1 $(KSRC)/include/linux/version.h | sed 's/.*"\(.*\)"$$/\1/')
else
# the last resort, version hocus pocus
#
# do we have unconfigured kernel source?
kversion :=$(shell egrep '^VERSION +=' $(KSRC)/Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
kplevel :=$(shell egrep '^PATCHLEVEL +=' $(KSRC)/Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
ksublevel:=$(shell egrep '^SUBLEVEL +=' $(KSRC)/Makefile 2>/dev/null | \
sed -e 's/[^0-9]*\([0-9]*\)/\1/')
EXTRA_VERSION:=$(shell egrep '^EXTRAVERSION +=' $(KSRC)/Makefile 2>/dev/null | \
sed -e 's/EXTRAVERSION[\t ]*=[\t ]*\(.*\)/\1/')
kextra:=$(strip $(EXTRA_VERSION))
HAVE_NEW_MODLIB:=$(shell egrep '\(INSTALL_MOD_PATH\)' \
$(KSRC)/Makefile 2>/dev/null )
# If you want to have more than one kernel configuration per kernel
# version, set FLAVOUR in the top level kernel Makefile *before*
# invoking make-kpkg -- it will be appended to UTS_RELEASE in
# version.h (separated by a hyphen). This affects everything -- the
# names and versions of the image, source, headers, and doc packages,
# and where the modules are searched for in /lib/modules.
FLAVOUR:=$(shell grep ^FLAVOUR $(KSRC)/Makefile 2>/dev/null | \
perl -ple 's/FLAVOUR[\s:=]+//g')
ifneq ($(strip $(FLAVOUR)),)
INT_FLAV := -$(FLAVOUR)
FLAV_ARG := FLAVOUR=$(FLAVOUR)
else
INT_FLAV :=
FLAV_ARG :=
endif
## This is the replacement for FLAVOUR
ifneq ($(strip $(APPEND_TO_VERSION)),)
iatv := $(strip $(APPEND_TO_VERSION))
EXTRAV_ARG := EXTRAVERSION=${EXTRA_VERSION}${iatv}
else
iatv :=
EXTRAV_ARG :=
endif
KVERS = $(kversion).$(kplevel).$(ksublevel)$(kextra)$(iatv)$(INT_FLAV)
endif
endif
endif
endif
# end of hocus pocus
#
# workarounds for possible misdetected things:
ifeq ($(KVERS),..)
KVERS=unknown
endif
# Clear root command if already root
ifeq ($(shell id -u),0)
ROOT_CMD=
endif
ifneq ($(CONCURRENCY_LEVEL),)
MAKE_OPT += -j $(CONCURRENCY_LEVEL)
endif
VERSION ?= $(shell dpkg-parsechangelog | grep ^Vers | cut -d\ -f2)
# remove the epoch number and append later
ifeq ($(findstring :,$(VERSION)),:)
VERSIONEPOCH:=$(firstword $(subst :, ,$(VERSION)))
VERSION:=$(word 2,$(subst :, ,$(VERSION)))
endif
ifneq ($(KDREV),)
ifeq ($(findstring :,$(KDREV)),:)
VERSION := $(subst :,:$(VERSION)+,$(KDREV))
else
VERSION := $(VERSION)+$(KDREV)
endif
endif
# cosmetic version for filenames, strip ANY epoch numbers. Also add
# epoch from version if needed
ifeq ($(findstring :,$(VERSION)),:)
VERSION := $(VERSIONEPOCH)$(VERSION)
else
ifneq ($(VERSIONEPOCH),)
VERSION := $(VERSIONEPOCH):$(VERSION)
endif
endif
ifeq ($(findstring :,$(VERSION)),:)
CVERSION:=$(word 2,$(subst :, ,$(VERSION)))
else
CVERSION:=$(VERSION)
endif
PKGNAME := $(PACKAGE)-$(KVERS)
echo-vars:
@test -e "$(KSRC)" || echo Warning! Kernel source directory is not accessible.
@echo "I've been configured using:"
@echo " - Kernel source of $(KSRC)"
@echo " - Kernel version of $(KVERS)"
@echo " - Kernel revision of $(KDREV)"
@echo " - C compiler of $(CC)"
@test "$$ARCH" && echo " - Target kernel ARCH is $(ARCH)" || true
@test "$$PKGARCH" && echo " - Target package ARCH is $(PKGARCH)" || true
@echo " - Make options of $(MAKE_OPT)"
@echo " - Version is $(VERSION)"
@echo " - Cosmetic version is $(CVERSION)"
@echo ' - Maintainer is $(MAINT)'
@echo ' - Package name is $(PKGNAME)'
@echo ' - Target directory is $(DEB_DESTDIR)'
#ifdef KDREV
#FULLVER := $(shell dpkg-parsechangelog |grep ^Version | cut -f2 -d' ')+$(KDREV)
## BE WARNED! Using KDREV (and so DEBDEP) in control files is evil
#DEBDEP := (= $(KDREV))
#else
#FULLVER := $(shell dpkg-parsechangelog |grep ^Version | cut -f2 -d' ')
#DEBDEP :=
#endif
# your configure rule may depend on this
ifeq ($(shell which $(CC)),)
# the compiler isn't there
ifdef IGNORE_CC_MISMATCH
CC=gcc
configure-checks:
echo "WARNING: using wrong compiler version!"
else
configure-checks:
echo "You don't have the compiler that your kernel was built with."
echo "Maybe needed package: $(CC)"
exit 1
endif
endif
#control-munge:
# for i in control postinst postrm ; do \
# cp debian/$$i debian/$$i.old; \
# cat debian/$$i.mod | sed -e 's/_KVERS_/$(KVERS)/g' > debian/$$i; \
# done
# touch control-munge
#clean-control-munge:
# for i in control postinst postrm ; do \
# if [ -f debian/$$i.old ]; then \
# mv debian/$$i.old debian/$$i; \
# fi; \
# done
# -$(RM) control-munge
ifeq "$(origin KPKG_DEST_DIR)" "undefined"
#ifeq "$(origin KMAINT)" "undefined"
#DEB_DESTDIR=$(CURDIR)/..
#else
DEB_DESTDIR=$(KSRC)/..
#endif
else
DEB_DESTDIR=$(KPKG_DEST_DIR)
endif
CDBS_SAFE_DEB_DESTDIR=$(DEB_DESTDIR)
CHFILE := $(DEB_DESTDIR)/$(PKGNAME)_$(CVERSION)_$(PKGARCH).changes
#
echo-changes:
@echo $(CHFILE)
echo-deb:
@echo $(PKGNAME)
echo-debfile:
@echo $(DEB_DESTDIR)/$(PKGNAME)_$(CVERSION)_$(PKGARCH).deb
# That is a matter of taste (of the maintainer)
# Targets that kernel-package uses.
#kdist_configure: configure-stamp
#kdist_config: configure-stamp
#kdist_image:
# $(ROOT_CMD) $(MAKE) -f debian/rules binary-modules
# $(ROOT_CMD) $(MAKE) -f debian/rules clean
#kdist_clean: clean
#kdist:
# $(ROOT_CMD) $(MAKE) -f debian/rules binary-modules
# from genchanges.sh
#
ifdef KMAINT
DEB_NAME = $(KMAINT)
else
ifdef DEBFULLNAME
DEB_NAME = $(DEBFULLNAME)
else
ifdef DEBNAME
DEB_NAME = $(DEBNAME)
endif
endif
endif
#MYNAME = $(shell for name in "$$KMAINT" "$$DEBFULLNAME" "$$DEBNAME" ; \
# do test -n "$$name" && break; done ; echo "$$name")
ifdef KEMAIL
DEB_MAIL = $(KEMAIL)
else
ifdef DEBEMAIL
DEB_MAIL = $(DEBEMAIL)
endif
endif
#DEB_MAIL = $(shell for email in "$$KEMAIL" "$$DEBEMAIL" ; do \
# test -n "$$email" && break; done ; echo "$$name")
ifneq ($(DEB_MAIL),)
ifneq ($(DEB_NAME),)
MAINT := $(DEB_NAME) <$(DEB_MAIL)>
else
MAINT := $(DEB_MAIL)
endif
else
MAINT := $(LOGNAME)@$(shell hostname -f)
endif
genchanges:
(head -2 debian/changelog ; echo " * Built for kernel-image-$(KVERS)." ; \
echo ; sed -ne '/^ -- / { p; q; }' debian/changelog ) > debian/changelog.tmp
dpkg-genchanges -b -m'$(MAINT)' -e'$(MAINT)' -u'$(DEB_DESTDIR)' -ldebian/changelog.tmp > "$(CHFILE)"
- if [ "$$SIGNCHANGES" ] ; then \
if test -e "`which $${DEBSIGNCOMMAND:-debsign}`" ; then \
$${DEBSIGNCOMMAND:-debsign} "$(CHFILE)" ; else \
if test -e "$${GNUPGHOME:-$$HOME/.gnupg/secring.gpg}"; then \
gpg -ast "$(DEB_MAIL)" --clearsign $(CHFILE) && mv $(CHFILE).asc $(CHFILE) ; else \
pgp -ast -u "$(DEB_MAIL)" +clearsig=on rgb.txt ; \
fi \
fi \
fi
# generic rewrite rule for the template files. First, copy files in
# debian/foo-KVERS_bar to the names with KVERS replaced. Then edit all
# files named with debian/NAME.modules.in and substitue _KVERS_ and _KDREV_,
# dumping the output into debian/NAME.
#
prep-deb-files:
@if test -z "$$RELAX_CC_CHECK" ; then which $(CC)>/dev/null || ( echo; echo; echo "The required compiler $(CC) is not installed, won't continue!" ; echo "Set RELAX_CC_CHECK variable to skip plausibility checks." ; sleep 5 ; exit 1) ; fi
for templ in $(wildcard $(CURDIR)/debian/*_KVERS_*); do \
cp $$templ `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g'` ; \
done
for templ in `ls debian/*.modules.in` ; do \
test -e $${templ%.modules.in}.backup || cp $${templ%.modules.in} $${templ%.modules.in}.backup 2>/dev/null || true; \
sed -e 's/##KVERS##/$(KVERS)/g ;s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ' < $$templ > $${templ%.modules.in}; \
done
.PHONY: kdist_configure kdist_config kdist_image kdist_clean kdist genchanges echo-deb echo-changes echo-vars echo-debfile
|