linux-rpm.mk: Use awk to edit EXTRAVERSION

This commit is contained in:
Jan Lindemann 2005-04-25 15:44:15 +00:00 committed by Jan Lindemann
commit d8d2b867fc

View file

@ -15,7 +15,7 @@
# abbreviations
define EXTRAVERSION
$(shell sed '/^ *EXTRAVERSION *=/ !d; s/^ *EXTRAVERSION *= *-*//; s/ *$$//' linux-$(KERNEL_VERSION)/Makefile)
$(shell sed '/^ *EXTRAVERSION *=/ !d; s/^ *EXTRAVERSION *= *-*//; s/ *$$//' linux-$(KERNEL_VERSION)/Makefile 2>/dev/null)
endef
KERNEL_MINOR := $(shell echo $(KERNEL_VERSION) | cut -d\. -f2)
@ -102,9 +102,22 @@ config-$(KERNEL_VERSION):
cvs add $@
cvs commit
toplevel-makefile: unpack.done
sed "s/\(^ *EXTRAVERSION *= *[^ ]*\) *$$/\\1$(shell echo _$(KERNEL_RELEASE) | sed 's/^_/-/')/" \
linux-$(KERNEL_VERSION)/Makefile >$@
# if ($$0 ~ "^ *EXTRAVERSION *= [0-9]*.[0-9]*.[0-9]") { \
toplevel-makefile: patches.done
awk -v release=$(KERNEL_RELEASE) '{ \
if ($$0 ~ /EXTRAVERSION *= *-/) { \
oldextra=$$3; \
gsub(/-/,_,oldextra); \
printf "EXTRAVERSION = -%s_%s \n", release, oldextra \
} else if ($$0 ~ /EXTRAVERSION *= *$$/) { \
printf "EXTRAVERSION = -%s\n",release \
} else { \
print $$0 \
} \
}' linux-$(KERNEL_VERSION)/Makefile >$@
# sed "s/\(^ *EXTRAVERSION *= *[^ ]*\) *$$/\\1$(shell echo _$(KERNEL_RELEASE) | sed 's/^_/-/')/" \
linux-$(KERNEL_VERSION)/Makefile: toplevel-makefile
cp $< $@