3 KVERREL
= $(patsubst /lib
/modules
/%/build
,%,$(KERNELDIR
))
7 INSTALLDIR
= $(patsubst %/build
,%/extra
,$(KERNELDIR
))
8 ORIGMODDIR
= $(patsubst %/build
,%/kernel
,$(KERNELDIR
))
14 version
= $(shell cd
$(LINUX
); git describe
)
16 _hack
= mv
$1 $1.orig
&& \
17 awk
-v version
=$(version
) -f hack-module.awk
$1.orig \
18 | sed
'/\#include/! s/\blapic\b/l_apic/g' > $1 && rm $1.orig
20 _unifdef
= mv
$1 $1.orig
&& \
21 unifdef
-DCONFIG_X86
$1.orig
> $1; \
22 [ $$?
-le
1 ] && rm $1.orig
24 hack
= $(call _hack
,tmp
/$(strip $1))
25 unifdef
= $(call _unifdef
,tmp
/$(strip $1))
28 $(MAKE
) -C
$(KERNELDIR
) M
=`pwd` "$$@"
32 rsync
--exclude
='*.mod.c' -R \
33 "$(LINUX)"/arch
/x86
/kvm
/.
/*.
[ch
] \
34 "$(LINUX)"/virt
/kvm
/.
/*.
[ch
] \
35 "$(LINUX)"/.
/include/linux
/kvm
*.h \
36 "$(LINUX)"/.
/include/asm-x86
/kvm
*.h \
38 ln
-sf asm-x86
include/asm
40 $(call unifdef
, include/linux
/kvm.h
)
41 $(call unifdef
, include/linux
/kvm_para.h
)
42 $(call unifdef
, include/asm-x86
/kvm.h
)
43 $(call unifdef
, include/asm-x86
/kvm_para.h
)
44 $(call hack
, kvm_main.c
)
50 for i in
$$(find tmp
-type f
-printf
'%P '); \
51 do cmp
-s
$$i tmp
/$$i || cp tmp
/$$i $$i; done
54 mkdir
-p
$(DESTDIR
)/$(INSTALLDIR
)
55 cp
*.ko
$(DESTDIR
)/$(INSTALLDIR
)
56 for i in
$(ORIGMODDIR
)/drivers
/kvm
/*.ko
; do \
57 if
[ -f
"$$i" ]; then mv
"$$i" "$$i.orig"; fi
; \
61 tmpspec
= .tmp.kvm-kmod.spec
63 rpm-topdir
:= $$(pwd
)/..
/rpmtop
65 RPMDIR
= $(rpm-topdir
)/RPMS
68 mkdir
-p
$(rpm-topdir
)/BUILD
$(RPMDIR
)/$$(uname
-i
)
69 sed
's/^Release:.*/Release: $(rpmrelease)/; s/^%define kverrel.*/%define kverrel $(KVERREL)/' \
70 kvm-kmod.spec
> $(tmpspec
)
71 rpmbuild
--define="kverrel $(KVERREL)" \
72 --define="objdir $$(pwd)" \
73 --define="_rpmdir $(RPMDIR)" \
74 --define="_topdir $(rpm-topdir)" \
78 $(MAKE
) -C
$(KERNELDIR
) M
=`pwd` $@
81 svn st | grep
'^\?' | awk
'{print $2}' | xargs
rm -rf