Fix userspace kernel/Makefile header-sync target build failures
PATCH 1/1 Fix userspace kernel/Makefile header-sync target build failures
This patch fixes problems using the kernel/Makefile header-sync target.
1. If unifdef modifies a header file it returns 1, which caused make to exit, thinking it was an error.
2. Allow rsync to de-reference symbolic links when syncing the include headers.
This supports both distro-specific header aliases (e.g. Ubuntu) and developer working-directory structures.
It allows, for example:
./configure --prefix=/usr --with-patched-kernel
make LINUX=../../kvm
to build in userspace repository using headers from sibling directory containing the kvm repository:
dev/kvm/.git
dev/userspace/.git
Signed-off-by TJ <[email protected]>
--- kernel/Makefile | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
kernel/Makefile +6 -6
@@ -23,7 +23,7 @@ _hack = mv $1 $1.orig && \ | sed '/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig unifdef = mv $1 $1.orig && \ - unifdef -DCONFIG_$(ARCH_CONFIG) $1.orig > $1; \ + unifdef -DCONFIG_$(ARCH_CONFIG) $1.orig > $1 && true; \ [ $$? -le 1 ] && rm $1.orig hack = $(call _hack,$T/$(strip $1))
@@ -52,15 +52,15 @@ T = $(subst -sync,,$@)-tmp header-sync: rm -rf $T - rsync -R \ + rsync -LR \ "$(LINUX)"/./include/linux/kvm*.h \ "$(LINUX)"/./include/asm-*/kvm*.h \ $T/ - -rsync -R \ + -rsync -LR \ "$(LINUX)"/arch/$(ARCH_DIR)/include/asm/./kvm*.h \ $T/include/asm-$(ARCH_DIR)/ - set -e && for i in $(find $T -name '*.h'); do \ + set -e && for i in $$(find $T -name '*.h'); do \ $(call unifdef,$$i); done $(call hack, include/linux/kvm.h) set -e && for i in $$(find $T -type f -printf '%P '); \
@@ -69,12 +69,12 @@ header-sync: source-sync: rm -rf $T - rsync --exclude='*.mod.c' -R \ + rsync --exclude='*.mod.c' -LR \ "$(LINUX)"/arch/$(ARCH_DIR)/kvm/./*.[cSh] \ "$(LINUX)"/virt/kvm/./*.[cSh] \ $T/ - set -e && for i in $(find $T -name '*.c'); do \ + set -e && for i in $$(find $T -name '*.c'); do \ $(call unifdef,$$i); done for i in $(hack-files); \
Signature · 1 line
1.5.4.3