| 1 |
# Makefile for source rpm: kernel
|
| 2 |
# $Id: Makefile,v 1.117 2009/11/04 17:03:24 kyle Exp $
|
| 3 |
NAME := kernel
|
| 4 |
SPECFILE := kernel.spec
|
| 5 |
|
| 6 |
# use noarch for make prep instead of the current CPU
|
| 7 |
# noarch creates and checks all config files not just the current one,
|
| 8 |
# in addition "i386" isn't a valid kernel target
|
| 9 |
PREPARCH = noarch
|
| 10 |
|
| 11 |
# we only check the .sign signatures
|
| 12 |
UPSTREAM_CHECKS = sign
|
| 13 |
|
| 14 |
# local targets we need to carry around in addition to the default sources
|
| 15 |
TARGETS = download
|
| 16 |
|
| 17 |
define find-makefile-common
|
| 18 |
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
| 19 |
endef
|
| 20 |
|
| 21 |
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
| 22 |
|
| 23 |
ifeq ($(MAKEFILE_COMMON),)
|
| 24 |
# attept a checkout
|
| 25 |
define checkout-makefile-common
|
| 26 |
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
| 27 |
endef
|
| 28 |
|
| 29 |
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
| 30 |
endif
|
| 31 |
|
| 32 |
include $(MAKEFILE_COMMON)
|
| 33 |
include Makefile.config
|
| 34 |
|
| 35 |
ifndef KVERSION
|
| 36 |
KVERSION := $(shell awk '$$1 == "%define" && $$2 == "base_sublevel" { \
|
| 37 |
print "2.6." $$3 \
|
| 38 |
}' $(SPECFILE))
|
| 39 |
endif
|
| 40 |
|
| 41 |
extremedebug:
|
| 42 |
@perl -pi -e 's/# CONFIG_DEBUG_PAGEALLOC is not set/CONFIG_DEBUG_PAGEALLOC=y/' config-nodebug
|
| 43 |
|
| 44 |
debug:
|
| 45 |
@perl -pi -e 's/# CONFIG_SLUB_DEBUG_ON is not set/CONFIG_SLUB_DEBUG_ON=y/' config-nodebug
|
| 46 |
@perl -pi -e 's/# CONFIG_LOCK_STAT is not set/CONFIG_LOCK_STAT=y/' config-nodebug
|
| 47 |
@perl -pi -e 's/# CONFIG_DEBUG_STACK_USAGE is not set/CONFIG_DEBUG_STACK_USAGE=y/' config-nodebug
|
| 48 |
@perl -pi -e 's/# CONFIG_DEBUG_SLAB is not set/CONFIG_DEBUG_SLAB=y/' config-nodebug
|
| 49 |
@perl -pi -e 's/# CONFIG_DEBUG_MUTEXES is not set/CONFIG_DEBUG_MUTEXES=y/' config-nodebug
|
| 50 |
@perl -pi -e 's/# CONFIG_DEBUG_RT_MUTEXES is not set/CONFIG_DEBUG_RT_MUTEXES=y/' config-nodebug
|
| 51 |
@perl -pi -e 's/# CONFIG_DEBUG_RWSEMS is not set/CONFIG_DEBUG_RWSEMS=y/' config-nodebug
|
| 52 |
@perl -pi -e 's/# CONFIG_DEBUG_LOCK_ALLOC is not set/CONFIG_DEBUG_LOCK_ALLOC=y/' config-nodebug
|
| 53 |
@perl -pi -e 's/# CONFIG_PROVE_LOCKING is not set/CONFIG_PROVE_LOCKING=y/' config-nodebug
|
| 54 |
@perl -pi -e 's/# CONFIG_DEBUG_SPINLOCK is not set/CONFIG_DEBUG_SPINLOCK=y/' config-nodebug
|
| 55 |
@perl -pi -e 's/# CONFIG_DEBUG_VM is not set/CONFIG_DEBUG_VM=y/' config-nodebug
|
| 56 |
@perl -pi -e 's/# CONFIG_DEBUG_SLEEP_IN_IRQ is not set/CONFIG_DEBUG_SLEEP_IN_IRQ=y/' config-nodebug
|
| 57 |
@perl -pi -e 's/# CONFIG_FAULT_INJECTION is not set/CONFIG_FAULT_INJECTION=y/' config-nodebug
|
| 58 |
@perl -pi -e 's/# CONFIG_FAILSLAB is not set/CONFIG_FAILSLAB=y/' config-nodebug
|
| 59 |
@perl -pi -e 's/# CONFIG_FAIL_PAGE_ALLOC is not set/CONFIG_FAIL_PAGE_ALLOC=y/' config-nodebug
|
| 60 |
@perl -pi -e 's/# CONFIG_FAIL_IO_TIMEOUT is not set/CONFIG_FAIL_IO_TIMEOUT=y/' config-nodebug
|
| 61 |
@perl -pi -e 's/# CONFIG_FAIL_MAKE_REQUEST is not set/CONFIG_FAIL_MAKE_REQUEST=y/' config-nodebug
|
| 62 |
@perl -pi -e 's/# CONFIG_FAULT_INJECTION_DEBUG_FS is not set/CONFIG_FAULT_INJECTION_DEBUG_FS=y/' config-nodebug
|
| 63 |
@perl -pi -e 's/# CONFIG_FAULT_INJECTION_STACKTRACE_FILTER is not set/CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y/' config-nodebug
|
| 64 |
@perl -pi -e 's/# CONFIG_DEBUG_SG is not set/CONFIG_DEBUG_SG=y/' config-nodebug
|
| 65 |
@perl -pi -e 's/# CONFIG_DEBUG_WRITECOUNT is not set/CONFIG_DEBUG_WRITECOUNT=y/' config-nodebug
|
| 66 |
@perl -pi -e 's/# CONFIG_DEBUG_OBJECTS is not set/CONFIG_DEBUG_OBJECTS=y/' config-nodebug
|
| 67 |
@perl -pi -e 's/# CONFIG_DEBUG_OBJECTS_FREE is not set/CONFIG_DEBUG_OBJECTS_FREE=y/' config-nodebug
|
| 68 |
@perl -pi -e 's/# CONFIG_DEBUG_OBJECTS_TIMERS is not set/CONFIG_DEBUG_OBJECTS_TIMERS=y/' config-nodebug
|
| 69 |
@perl -pi -e 's/# CONFIG_X86_PTDUMP is not set/CONFIG_X86_PTDUMP=y/' config-nodebug
|
| 70 |
@perl -pi -e 's/# CONFIG_CAN_DEBUG_DEVICES is not set/CONFIG_CAN_DEBUG_DEVICES=y/' config-nodebug
|
| 71 |
@perl -pi -e 's/# CONFIG_MODULE_FORCE_UNLOAD is not set/CONFIG_MODULE_FORCE_UNLOAD=y/' config-nodebug
|
| 72 |
@perl -pi -e 's/# CONFIG_SYSCTL_SYSCALL_CHECK is not set/CONFIG_SYSCTL_SYSCALL_CHECK=y/' config-nodebug
|
| 73 |
@perl -pi -e 's/# CONFIG_DEBUG_NOTIFIERS is not set/CONFIG_DEBUG_NOTIFIERS=y/' config-nodebug
|
| 74 |
@perl -pi -e 's/# CONFIG_DMA_API_DEBUG is not set/CONFIG_DMA_API_DEBUG=y/' config-nodebug
|
| 75 |
@perl -pi -e 's/# CONFIG_PM_TEST_SUSPEND is not set/CONFIG_PM_TEST_SUSPEND=y/' config-generic
|
| 76 |
@perl -pi -e 's/# CONFIG_BOOT_TRACER is not set/CONFIG_BOOT_TRACER=y/' config-generic
|
| 77 |
@perl -pi -e 's/# CONFIG_B43_DEBUG is not set/CONFIG_B43_DEBUG=y/' config-generic
|
| 78 |
@perl -pi -e 's/# CONFIG_B43LEGACY_DEBUG is not set/CONFIG_B43LEGACY_DEBUG=y/' config-generic
|
| 79 |
@perl -pi -e 's/# CONFIG_MMIOTRACE is not set/CONFIG_MMIOTRACE=y/' config-nodebug
|
| 80 |
@perl -pi -e 's/CONFIG_STRIP_ASM_SYMS=y/# CONFIG_STRIP_ASM_SYMS is not set/' config-nodebug
|
| 81 |
@perl -pi -e 's/# CONFIG_DEBUG_CREDENTIALS is not set/CONFIG_DEBUG_CREDENTIALS=y/' config-nodebug
|
| 82 |
@perl -pi -e 's/# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set/CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y/' config-nodebug
|
| 83 |
@perl -pi -e 's/# CONFIG_ACPI_DEBUG is not set/CONFIG_ACPI_DEBUG=y/' config-nodebug
|
| 84 |
@perl -pi -e 's/# CONFIG_EXT4_DEBUG is not set/CONFIG_EXT4_DEBUG=y/' config-nodebug
|
| 85 |
@perl -pi -e 's/# CONFIG_DEBUG_PERF_USE_VMALLOC is not set/CONFIG_DEBUG_PERF_USE_VMALLOC=y/' config-nodebug
|
| 86 |
@perl -pi -e 's/# CONFIG_JBD2_DEBUG is not set/CONFIG_JBD2_DEBUG=y/' config-nodebug
|
| 87 |
|
| 88 |
@# just in case we're going from extremedebug -> debug
|
| 89 |
@perl -pi -e 's/CONFIG_DEBUG_PAGEALLOC=y/# CONFIG_DEBUG_PAGEALLOC is not set/' config-nodebug
|
| 90 |
|
| 91 |
@perl -pi -e 's/CONFIG_NR_CPUS=64/CONFIG_NR_CPUS=512/' config-x86_64-generic
|
| 92 |
|
| 93 |
@perl -pi -e 's/^%define debugbuildsenabled 1/%define debugbuildsenabled 0/' kernel.spec
|
| 94 |
@perl -pi -e 's/^%define rawhide_skip_docs 0/%define rawhide_skip_docs 1/' kernel.spec
|
| 95 |
|
| 96 |
release:
|
| 97 |
@perl -pi -e 's/CONFIG_SLUB_DEBUG_ON=y/# CONFIG_SLUB_DEBUG_ON is not set/' config-nodebug
|
| 98 |
@perl -pi -e 's/CONFIG_LOCK_STAT=y/# CONFIG_LOCK_STAT is not set/' config-nodebug
|
| 99 |
@perl -pi -e 's/CONFIG_DEBUG_STACK_USAGE=y/# CONFIG_DEBUG_STACK_USAGE is not set/' config-nodebug
|
| 100 |
@perl -pi -e 's/CONFIG_DEBUG_SLAB=y/# CONFIG_DEBUG_SLAB is not set/' config-nodebug
|
| 101 |
@perl -pi -e 's/CONFIG_DEBUG_MUTEXES=y/# CONFIG_DEBUG_MUTEXES is not set/' config-nodebug
|
| 102 |
@perl -pi -e 's/CONFIG_DEBUG_RT_MUTEXES=y/# CONFIG_DEBUG_RT_MUTEXES is not set/' config-nodebug
|
| 103 |
@perl -pi -e 's/CONFIG_DEBUG_RWSEMS=y/# CONFIG_DEBUG_RWSEMS is not set/' config-nodebug
|
| 104 |
@perl -pi -e 's/CONFIG_DEBUG_LOCK_ALLOC=y/# CONFIG_DEBUG_LOCK_ALLOC is not set/' config-nodebug
|
| 105 |
@perl -pi -e 's/CONFIG_PROVE_LOCKING=y/# CONFIG_PROVE_LOCKING is not set/' config-nodebug
|
| 106 |
@perl -pi -e 's/CONFIG_DEBUG_SPINLOCK=y/# CONFIG_DEBUG_SPINLOCK is not set/' config-nodebug
|
| 107 |
@perl -pi -e 's/CONFIG_DEBUG_VM=y/# CONFIG_DEBUG_VM is not set/' config-nodebug
|
| 108 |
@perl -pi -e 's/CONFIG_DEBUG_SLEEP_IN_IRQ=y/# CONFIG_DEBUG_SLEEP_IN_IRQ is not set/' config-nodebug
|
| 109 |
@perl -pi -e 's/CONFIG_FAULT_INJECTION=y/# CONFIG_FAULT_INJECTION is not set/' config-nodebug
|
| 110 |
@perl -pi -e 's/CONFIG_FAILSLAB=y/# CONFIG_FAILSLAB is not set/' config-nodebug
|
| 111 |
@perl -pi -e 's/CONFIG_FAIL_PAGE_ALLOC=y/# CONFIG_FAIL_PAGE_ALLOC is not set/' config-nodebug
|
| 112 |
@perl -pi -e 's/CONFIG_FAIL_IO_TIMEOUT=y/# CONFIG_FAIL_IO_TIMEOUT is not set/' config-nodebug
|
| 113 |
@perl -pi -e 's/CONFIG_FAIL_MAKE_REQUEST=y/# CONFIG_FAIL_MAKE_REQUEST is not set/' config-nodebug
|
| 114 |
@perl -pi -e 's/CONFIG_FAULT_INJECTION_DEBUG_FS=y/# CONFIG_FAULT_INJECTION_DEBUG_FS is not set/' config-nodebug
|
| 115 |
@perl -pi -e 's/CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y/# CONFIG_FAULT_INJECTION_STACKTRACE_FILTER is not set/' config-nodebug
|
| 116 |
@perl -pi -e 's/CONFIG_DEBUG_SG=y/# CONFIG_DEBUG_SG is not set/' config-nodebug
|
| 117 |
@perl -pi -e 's/CONFIG_DEBUG_WRITECOUNT=y/# CONFIG_DEBUG_WRITECOUNT is not set/' config-nodebug
|
| 118 |
@perl -pi -e 's/CONFIG_DEBUG_OBJECTS=y/# CONFIG_DEBUG_OBJECTS is not set/' config-nodebug
|
| 119 |
@perl -pi -e 's/CONFIG_DEBUG_OBJECTS_FREE=y/# CONFIG_DEBUG_OBJECTS_FREE is not set/' config-nodebug
|
| 120 |
@perl -pi -e 's/CONFIG_DEBUG_OBJECTS_TIMERS=y/# CONFIG_DEBUG_OBJECTS_TIMERS is not set/' config-nodebug
|
| 121 |
@perl -pi -e 's/CONFIG_X86_PTDUMP=y/# CONFIG_X86_PTDUMP is not set/' config-nodebug
|
| 122 |
@perl -pi -e 's/CONFIG_CAN_DEBUG_DEVICES=y/# CONFIG_CAN_DEBUG_DEVICES is not set/' config-nodebug
|
| 123 |
@perl -pi -e 's/CONFIG_MODULE_FORCE_UNLOAD=y/# CONFIG_MODULE_FORCE_UNLOAD is not set/' config-nodebug
|
| 124 |
@perl -pi -e 's/CONFIG_SYSCTL_SYSCALL_CHECK=y/# CONFIG_SYSCTL_SYSCALL_CHECK is not set/' config-nodebug
|
| 125 |
@perl -pi -e 's/CONFIG_DEBUG_NOTIFIERS=y/# CONFIG_DEBUG_NOTIFIERS is not set/' config-nodebug
|
| 126 |
@perl -pi -e 's/CONFIG_DMA_API_DEBUG=y/# CONFIG_DMA_API_DEBUG is not set/' config-nodebug
|
| 127 |
@perl -pi -e 's/CONFIG_PM_TEST_SUSPEND=y/#\ CONFIG_PM_TEST_SUSPEND\ is\ not\ set/' config-generic
|
| 128 |
@perl -pi -e 's/CONFIG_BOOT_TRACER=y/#\ CONFIG_BOOT_TRACER\ is\ not\ set/' config-generic
|
| 129 |
@perl -pi -e 's/CONFIG_B43_DEBUG=y/# CONFIG_B43_DEBUG is not set/' config-generic
|
| 130 |
@perl -pi -e 's/CONFIG_B43LEGACY_DEBUG=y/# CONFIG_B43LEGACY_DEBUG is not set/' config-generic
|
| 131 |
@perl -pi -e 's/CONFIG_MMIOTRACE=y/# CONFIG_MMIOTRACE is not set/' config-nodebug
|
| 132 |
@perl -pi -e 's/# CONFIG_STRIP_ASM_SYMS is not set/CONFIG_STRIP_ASM_SYMS=y/' config-nodebug
|
| 133 |
@perl -pi -e 's/CONFIG_DEBUG_CREDENTIALS=y/# CONFIG_DEBUG_CREDENTIALS is not set/' config-nodebug
|
| 134 |
@perl -pi -e 's/CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y/# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set/' config-nodebug
|
| 135 |
@perl -pi -e 's/CONFIG_ACPI_DEBUG=y/# CONFIG_ACPI_DEBUG is not set/' config-nodebug
|
| 136 |
@perl -pi -e 's/CONFIG_EXT4_DEBUG=y/# CONFIG_EXT4_DEBUG is not set/' config-nodebug
|
| 137 |
@perl -pi -e 's/CONFIG_DEBUG_PERF_USE_VMALLOC=y/# CONFIG_DEBUG_PERF_USE_VMALLOC is not set/' config-nodebug
|
| 138 |
@perl -pi -e 's/CONFIG_JBD2_DEBUG=y/# CONFIG_JBD2_DEBUG is not set/' config-nodebug
|
| 139 |
|
| 140 |
@perl -pi -e 's/CONFIG_DEBUG_PAGEALLOC=y/# CONFIG_DEBUG_PAGEALLOC is not set/' config-debug
|
| 141 |
@perl -pi -e 's/CONFIG_DEBUG_PAGEALLOC=y/# CONFIG_DEBUG_PAGEALLOC is not set/' config-nodebug
|
| 142 |
|
| 143 |
@perl -pi -e 's/CONFIG_NR_CPUS=512/CONFIG_NR_CPUS=64/' config-x86_64-generic
|
| 144 |
|
| 145 |
@perl -pi -e 's/^%define debugbuildsenabled 0/%define debugbuildsenabled 1/' kernel.spec
|
| 146 |
@perl -pi -e 's/^%define rawhide_skip_docs 1/%define rawhide_skip_docs 0/' kernel.spec
|
| 147 |
|
| 148 |
rhel:
|
| 149 |
@perl -pi -e 's/# CONFIG_PPC_64K_PAGES is not set/CONFIG_PPC_64K_PAGES=y/' config-powerpc64
|
| 150 |
@perl -pi -e 's/CONFIG_NR_CPUS=64/CONFIG_NR_CPUS=512/' config-x86_64-generic
|
| 151 |
|
| 152 |
reconfig:
|
| 153 |
@rm -f kernel-*-config
|
| 154 |
@VERSION=$(KVERSION) make -f Makefile.config configs
|
| 155 |
@scripts/reconfig.sh
|
| 156 |
|
| 157 |
force-tag: $(SPECFILE) $(COMMON_DIR)/branches
|
| 158 |
@$(MAKE) tag TAG_OPTS="-F $(TAG_OPTS)"
|
| 159 |
|
| 160 |
unused-kernel-patches:
|
| 161 |
@for f in *.patch; do if [ -e $$f ]; then (egrep -q "^Patch[[:digit:]]+:[[:space:]]+$$f" $(SPECFILE) || echo "Unused: $$f") && egrep -q "^ApplyPatch[[:space:]]+$$f|^ApplyOptionalPatch[[:space:]]+$$f" $(SPECFILE) || echo "Unapplied: $$f"; fi; done
|
| 162 |
|
| 163 |
# since i386 isn't a target...
|
| 164 |
compile compile-short: DIST_DEFINES += --target $(shell uname -m)
|
| 165 |
|
| 166 |
# 'make local' also needs to build the noarch firmware package
|
| 167 |
local: noarch
|
| 168 |
|
| 169 |
#
|
| 170 |
# Hacks for building vanilla (unpatched) kernel rpms.
|
| 171 |
# Use "make vanilla-TARGET" like "make TARGET" (make vanilla-scratch-build).
|
| 172 |
#
|
| 173 |
vanilla-%: $(SPECFILE:.spec=-vanilla.spec)
|
| 174 |
@$(MAKE) $* SPECFILE=$<
|
| 175 |
|
| 176 |
$(SPECFILE:.spec=-vanilla.spec): $(SPECFILE)
|
| 177 |
@rm -f $@
|
| 178 |
(echo %define nopatches 1; cat $<) > $@
|
| 179 |
|
| 180 |
#scratch-build: NAME = $(shell rpm $(RPM_DEFINES) $(DIST_DEFINES) -q --qf "%{NAME}\n" --specfile $(SPECFILE)| head -1)
|
| 181 |
#scratch-build: test-srpm
|
| 182 |
# $(BUILD_CLIENT) build $(BUILD_FLAGS) --scratch $(TARGET) \
|
| 183 |
# $(SRCRPMDIR)/$(NAME)-$(VERSION)-$(RELEASE).src.rpm
|
| 184 |
|
| 185 |
# Dismal kludge for building via brew from cvs after "make vanilla-tag".
|
| 186 |
ifdef BEEHIVE_SRPM_BUILD
|
| 187 |
export CHECKOUT_TAG ?= $(shell sed s/^.// CVS/Tag)
|
| 188 |
tag-pattern = $(TAG_NAME)-$(TAG_VERSION)-0_%_$(TAG_RELEASE)
|
| 189 |
ifeq (,$(filter-out $(tag-pattern),$(CHECKOUT_TAG)))
|
| 190 |
variant := $(patsubst $(tag-pattern),%,$(CHECKOUT_TAG))
|
| 191 |
srpm: SPECFILE := $(wildcard $(SPECFILE:.spec=-$(variant).spec) \
|
| 192 |
$(SPECFILE:.spec=.t.$(variant).spec))
|
| 193 |
srpm beehive-sprm: RELEASE := 0.$(variant).$(RELEASE)
|
| 194 |
endif
|
| 195 |
endif
|
| 196 |
|
| 197 |
#
|
| 198 |
# Hacks for building kernel rpms from upstream code plus local GIT branches.
|
| 199 |
# Use "make git/BRANCH/TARGET" like "make TARGET".
|
| 200 |
# Use "make git/BRANCH-fedora/TARGET" to include Fedora patches on top.
|
| 201 |
#
|
| 202 |
ifndef GIT_SPEC
|
| 203 |
git/%:
|
| 204 |
@$(MAKE) GIT_SPEC=$(subst /,-,$(*D)) git-$(*F)
|
| 205 |
else
|
| 206 |
git-%: $(SPECFILE:.spec=.t.$(GIT_SPEC).spec)
|
| 207 |
@$(MAKE) GIT_SPEC= $* SPECFILE=$<
|
| 208 |
endif
|
| 209 |
|
| 210 |
#
|
| 211 |
# Your git-branches.mk file can define GIT_DIR, e.g.:
|
| 212 |
# GIT_DIR = ${HOME}/kernel/.git
|
| 213 |
# Make sure GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are also set
|
| 214 |
# or your rpm changelogs will look like crap.
|
| 215 |
#
|
| 216 |
# For each branch it can define a variable branch-BRANCH or tag-BRANCH
|
| 217 |
# giving the parent of BRANCH to diff against in a separate patch. If
|
| 218 |
# the parent is unknown, it will use $(branch-upstream) defaulting to
|
| 219 |
# "refs/remotes/upstream/master".
|
| 220 |
#
|
| 221 |
# Defining tag-BRANCH means the tag corresponds to an upstream patch in
|
| 222 |
# the sources file, so that is used instead of generating a patch with
|
| 223 |
# git. If there is no tag-upstream defined, it will figure out a vNNN
|
| 224 |
# tag or vNNN-gitN pseudo-tag from the last patch in the sources file.
|
| 225 |
# For example:
|
| 226 |
# tag-some-hacks = v2.6.21-rc5
|
| 227 |
# branch-more-hacks = some-hacks
|
| 228 |
# Leads to patches:
|
| 229 |
# git diff v2.6.21-rc5..more-hacks > linux-2.6.21-rc5-some-hacks.patch
|
| 230 |
# git diff some-hacks..more-hacks > linux-2.6.21-rc5-more-hacks.patch
|
| 231 |
# Whereas having no git-branches.mk at all but doing
|
| 232 |
# "make GIT_DIR=... git/mybranch/test-srpm" does:
|
| 233 |
# id=`cat patch-2.6.21-rc5-git4.id` # auto-fetched via upstream file
|
| 234 |
# git diff $id..upstream > linux-2.6.21-rc5-git4-upstream.patch
|
| 235 |
# git diff upstream..mybranch > linux-2.6.21-rc5-git4-mybranch.patch
|
| 236 |
# If the upstream patch (or any branch patch) is empty it's left out.
|
| 237 |
#
|
| 238 |
git-branches.mk:;
|
| 239 |
-include git-branches.mk
|
| 240 |
|
| 241 |
branch-upstream ?= refs/remotes/upstream/master
|
| 242 |
|
| 243 |
ifdef GIT_DIR
|
| 244 |
export GIT_DIR
|
| 245 |
export GIT_AUTHOR_NAME
|
| 246 |
export GIT_AUTHOR_EMAIL
|
| 247 |
gen-patches ?= gen-patches
|
| 248 |
|
| 249 |
ifndef havespec
|
| 250 |
$(SPECFILE:.spec=.t.%-fedora.spec): $(SPECFILE) $(gen-patches) FORCE
|
| 251 |
./$(gen-patches) --fedora < $< > $@ $(gen-patches-args)
|
| 252 |
$(SPECFILE:.spec=.t.%.spec): $(SPECFILE) $(gen-patches) FORCE
|
| 253 |
./$(gen-patches) < $< > $@ $(gen-patches-args)
|
| 254 |
.PRECIOUS: $(SPECFILE:.spec=.t.%.spec) $(SPECFILE:.spec=.t.%-fedora.spec)
|
| 255 |
endif
|
| 256 |
|
| 257 |
spec-%: $(SPECFILE:.spec=.t.%.spec) ;
|
| 258 |
$(SPECFILE):;
|
| 259 |
FORCE:;
|
| 260 |
|
| 261 |
branch-of-* = $(firstword $(head-$*) $*)
|
| 262 |
gen-patches-args = --name $* v$(KVERSION) $(call heads,$(branch-of-*))
|
| 263 |
define heads
|
| 264 |
$(if $(tag-$1),$(filter-out v$(KVERSION),$(tag-$1)),\
|
| 265 |
$(call heads,$(firstword $(branch-$1) $(branch-upstream)))) $1
|
| 266 |
endef
|
| 267 |
|
| 268 |
files-%-fedora:
|
| 269 |
@echo $(SPECFILE:.spec=.t.$*-fedora.spec)
|
| 270 |
@$(call list-patches,$(branch-of-*))
|
| 271 |
files-%:
|
| 272 |
@echo $(SPECFILE:.spec=.t.$*.spec)
|
| 273 |
@$(call list-patches,$(branch-of-*))
|
| 274 |
define list-patches
|
| 275 |
$(if $(tag-$1),version=$(patsubst v%,%,$(tag-$1)),\
|
| 276 |
$(call list-patches,$(firstword $(branch-$1) $(branch-upstream)))); \
|
| 277 |
echo linux-$${version}-$(patsubst refs/remotes/%/master,%,$1).patch
|
| 278 |
endef
|
| 279 |
|
| 280 |
ifndef tag-$(branch-upstream)
|
| 281 |
tag-$(branch-upstream) := $(shell \
|
| 282 |
sed -n 's/^.* *//;s/\.bz2$$//;s/patch-/v/;/^v/h;$${g;p}' sources)
|
| 283 |
endif
|
| 284 |
endif
|