Pull misc kbuild updates from Michal Marek: "Non-critical kbuild changes: - make coccicheck improvements, but no new semantic patches this time - make rpm improvements - make tar-pkg change to include the architecture in the filename. This is a deliberate incompatibility, but nobody has complained so far and it is useful if you build for different architectures. It also matches what the deb-pkg and rpm-pkg targets produce. - kbuild documentation fix" * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: rpm-pkg: Remove pointless set -e statements rpm-pkg: Always regenerate the specfile rpm-pkg: Do not write to the parent directory rpm-pkg: Do not package the whole source directory buildtar: Add ARCH to the archive name Coccinelle: Fix patch output when coccicheck is used with M= and C= Coccinelle: Add support to the SPFLAGS variable Coccinelle: Cleanup the setting of the FLAGS and OPTIONS variables Coccinelle: Restore coccicheck verbosity in ONLINE mode (C=1 or C=2) scripts/package/Makefile: compare objtree with srctree instead of test KBUILD_OUTPUT doc: change example to existing Makefile fragment scripts/tags.sh: Add magic for OFFSET and DEFINE
Showing the changes to scripts (4 of 7 files). Show all
Unified · Split
| @@ -1,4 +1,4 @@ | ||
| 1 | −#!/bin/sh | |
| 1 | +#!/bin/bash | |
| 2 | 2 | |
| 3 | 3 | SPATCH="`which ${SPATCH:=spatch}`" |
| 4 | 4 | |
| @@ -11,27 +11,32 @@ else · 6 unmodified lines | ||
| 11 | 11 | VERBOSE=0 |
| 12 | 12 | fi |
| 13 | 13 | |
| 14 | +FLAGS="$SPFLAGS -very_quiet" | |
| 15 | + | |
| 16 | +# spatch only allows include directories with the syntax "-I include" | |
| 17 | +# while gcc also allows "-Iinclude" and "-include include" | |
| 18 | +COCCIINCLUDE=${LINUXINCLUDE//-I/-I } | |
| 19 | +COCCIINCLUDE=${COCCIINCLUDE//-include/-I} | |
| 20 | + | |
| 14 | 21 | if [ "$C" = "1" -o "$C" = "2" ]; then |
| 15 | 22 | ONLINE=1 |
| 16 | 23 | |
| 17 | −# This requires Coccinelle >= 0.2.3 | |
| 18 | −# FLAGS="-ignore_unknown_options -very_quiet" | |
| 19 | −# OPTIONS=$* | |
| 20 | − | |
| 21 | −# Workaround for Coccinelle < 0.2.3 | |
| 22 | − FLAGS="-I $srctree/include -very_quiet" | |
| 23 | − shift $(( $# - 1 )) | |
| 24 | − OPTIONS=$1 | |
| 24 | + # Take only the last argument, which is the C file to test | |
| 25 | + shift $(( $# - 1 )) | |
| 26 | + OPTIONS="$COCCIINCLUDE $1" | |
| 25 | 27 | else |
| 26 | 28 | ONLINE=0 |
| 27 | − FLAGS="-very_quiet" | |
| 28 | 29 | if [ "$KBUILD_EXTMOD" = "" ] ; then |
| 29 | − OPTIONS="-dir $srctree" | |
| 30 | + OPTIONS="-dir $srctree $COCCIINCLUDE" | |
| 30 | 31 | else |
| 31 | − OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include" | |
| 32 | + OPTIONS="-dir $KBUILD_EXTMOD $COCCIINCLUDE" | |
| 32 | 33 | fi |
| 33 | 34 | fi |
| 34 | 35 | |
| 36 | +if [ "$KBUILD_EXTMOD" != "" ] ; then | |
| 37 | + OPTIONS="-patch $srctree $OPTIONS" | |
| 38 | +fi | |
| 39 | + | |
| 35 | 40 | if [ ! -x "$SPATCH" ]; then |
| 36 | 41 | echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/' |
| 37 | 42 | exit 1 |
| @@ -72,7 +77,7 @@ coccinelle () { · 34 unmodified lines | ||
| 72 | 77 | # |
| 73 | 78 | # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null |
| 74 | 79 | |
| 75 | − if [ $VERBOSE -ne 0 ] ; then | |
| 80 | + if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then | |
| 76 | 81 | |
| 77 | 82 | FILE=`echo $COCCI | sed "s|$srctree/||"` |
| 78 | 83 | |
| @@ -27,53 +27,44 @@ RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \ · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | # Remove hyphens since they have special meaning in RPM filenames |
| 29 | 29 | KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE)) |
| 30 | +# Include only those top-level files that are needed by make, plus the GPL copy | |
| 31 | +TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \ | |
| 32 | + Kbuild Kconfig COPYING $(wildcard localversion*) | |
| 33 | +TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT)) | |
| 30 | 34 | MKSPEC := $(srctree)/scripts/package/mkspec |
| 31 | −PREV := set -e; cd -P ..; | |
| 32 | 35 | |
| 33 | 36 | # rpm-pkg |
| 34 | 37 | # --------------------------------------------------------------------------- |
| 35 | −$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile | |
| 36 | − $(CONFIG_SHELL) $(MKSPEC) > $@ | |
| 37 | − | |
| 38 | −rpm-pkg rpm: $(objtree)/kernel.spec FORCE | |
| 39 | − @if test -n "$(KBUILD_OUTPUT)"; then \ | |
| 38 | +rpm-pkg rpm: FORCE | |
| 39 | + @if test "$(objtree)" != "$(srctree)"; then \ | |
| 40 | 40 | echo "Building source + binary RPM is not possible outside the"; \ |
| 41 | 41 | echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \ |
| 42 | 42 | echo "binrpm-pkg target instead."; \ |
| 43 | 43 | false; \ |
| 44 | 44 | fi |
| 45 | 45 | $(MAKE) clean |
| 46 | − $(PREV) ln -sf $(srctree) $(KERNELPATH) | |
| 46 | + ln -sf $(srctree) $(KERNELPATH) | |
| 47 | + $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec | |
| 47 | 48 | $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion |
| 48 | − $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. | |
| 49 | − $(PREV) rm $(KERNELPATH) | |
| 49 | + tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(TAR_CONTENT) | |
| 50 | + rm $(KERNELPATH) | |
| 50 | 51 | rm -f $(objtree)/.scmversion |
| 51 | − set -e; \ | |
| 52 | 52 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version |
| 53 | − set -e; \ | |
| 54 | 53 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
| 55 | − | |
| 56 | − $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz | |
| 57 | − rm ../$(KERNELPATH).tar.gz | |
| 58 | − | |
| 59 | −clean-files := $(objtree)/kernel.spec | |
| 54 | + $(RPM) $(RPMOPTS) --target $(UTS_MACHINE) -ta $(KERNELPATH).tar.gz | |
| 55 | + rm $(KERNELPATH).tar.gz kernel.spec | |
| 60 | 56 | |
| 61 | 57 | # binrpm-pkg |
| 62 | 58 | # --------------------------------------------------------------------------- |
| 63 | −$(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile | |
| 64 | − $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@ | |
| 65 | − | |
| 66 | −binrpm-pkg: $(objtree)/binkernel.spec FORCE | |
| 59 | +binrpm-pkg: FORCE | |
| 67 | 60 | $(MAKE) KBUILD_SRC= |
| 68 | − set -e; \ | |
| 61 | + $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec | |
| 69 | 62 | $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version |
| 70 | − set -e; \ | |
| 71 | 63 | mv -f $(objtree)/.tmp_version $(objtree)/.version |
| 72 | 64 | |
| 73 | 65 | $(RPM) $(RPMOPTS) --define "_builddir $(objtree)" --target \ |
| 74 | 66 | $(UTS_MACHINE) -bb $< |
| 75 | − | |
| 76 | −clean-files += $(objtree)/binkernel.spec | |
| 67 | + rm binkernel.spec | |
| 77 | 68 | |
| 78 | 69 | # Deb target |
| 79 | 70 | # --------------------------------------------------------------------------- |
| @@ -16,7 +16,7 @@ set -e · 15 unmodified lines | ||
| 16 | 16 | # Some variables and settings used throughout the script |
| 17 | 17 | # |
| 18 | 18 | tmpdir="${objtree}/tar-install" |
| 19 | −tarball="${objtree}/linux-${KERNELRELEASE}.tar" | |
| 19 | +tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar" | |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | # |
| @@ -199,7 +199,9 @@ exuberant() · 198 unmodified lines | ||
| 199 | 199 | --regex-c='/DEFINE_PER_CPU_SHARED_ALIGNED\(([^,]*,\s*)(\w*).*\)/\2/v/' \ |
| 200 | 200 | --regex-c='/DECLARE_WAIT_QUEUE_HEAD\((\w*)/\1/v/' \ |
| 201 | 201 | --regex-c='/DECLARE_(TASKLET|WORK|DELAYED_WORK)\((\w*)/\2/v/' \ |
| 202 | − --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' | |
| 202 | + --regex-c='/DEFINE_PCI_DEVICE_TABLE\((\w*)/\1/v/' \ | |
| 203 | + --regex-c='/(^\s)OFFSET\((\w*)/\2/v/' \ | |
| 204 | + --regex-c='/(^\s)DEFINE\((\w*)/\2/v/' | |
| 203 | 205 | |
| 204 | 206 | all_kconfigs | xargs $1 -a \ |
| 205 | 207 | --langdef=kconfig --language-force=kconfig \ |