Update NEWS entries to reflect new version
[pkg-k5-afs_openafs.git] / debian / module / rules
blob10537885518838b44632554d947ed424f37271e7
1 #!/usr/bin/make -f
3 # Determine whether we're building with optimization. This doesn't really
4 # work at the moment due to upstream problems.
5 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
6 DEBIAN_OPT_FLAGS = --disable-optimize --disable-optimize-lwp
7 DEBIAN_KERN_FLAGS = --disable-optimize-kernel
8 else
9 DEBIAN_OPT_FLAGS =
10 DEBIAN_KERN_FLAGS =
11 endif
13 # Find kernel build information.
14 ifndef KSRC
15 KSRC := /lib/modules/$(shell uname -r)/build
16 endif
17 ifndef KPKG_DEST_DIR
18 KPKG_DEST_DIR = ..
19 endif
20 KVERS := $(shell perl debian/kernel-version $(KSRC))
21 export KSRC
22 export KVERS
23 export KPKG_DEST_DIR
25 SYS_NAME := $(shell KSRC="$(KSRC)" KVERS="$(KVERS)" ARCH="$(ARCH)" \
26 sh debian/sysname)
28 package = openafs
29 modulepkg := openafs-modules-$(KVERS)${INT_SUBARCH}
30 moduledir := debian/$(modulepkg)/lib/modules/$(KVERS)/fs
32 # After building the package, m-a calls debian/rules with the target
33 # echo-debfile. Without this dummy rule, this would trigger the setup
34 # target (by way of the wildcard rule for dh), which re-creates the setup
35 # flag file that we removed during make clean.
37 # Then, if module-assistant unpacks a new version of the source, the setup
38 # file already exists so the setup rule isn't run again. But the
39 # debian/control file is the template from the new source, which doesn't
40 # contain any buildable packages.
42 # Add a dummy target for echo-debfile to ensure that setup isn't run again
43 # after clean. If there are further changes to module-assistant, causing it
44 # to run other targets after clean, more similar dummy rules may need to be
45 # added.
46 echo-debfile:
47 @true
49 # make-kpkg tries to rebuild debian/rules first, so add a dummy target to
50 # avoid our dh wildcard rule and a fatal error.
51 debian/rules ./debian/rules:
52 @true
54 # This setup must be done before running any other target if it hasn't
55 # already been done.
56 setup:
57 @if test x"$(SYS_NAME)" = x"UNKNOWN" ; then exit 1 ; fi
58 @if test x"$(KVERS)" = x ; then \
59 echo 'No version in $(KSRC)/include/linux/version.h' >&2 ; \
60 exit 1 ; \
62 sh debian/prep-modules $(KSRC)
63 touch $@
65 %: setup
66 dh $@
68 override_dh_auto_configure:
69 sh configure --prefix=$(CURDIR)/debian/tmp \
70 --with-afs-sysname=$(SYS_NAME) \
71 --disable-linux-syscall-probing \
72 --with-linux-kernel-headers=$(KSRC) \
73 --with-linux-kernel-packaging \
74 --enable-debug --enable-debug-lwp --enable-debug-kernel \
75 $(DEBIAN_OPT_FLAGS) $(DEBIAN_KERN_FLAGS)
77 override_dh_auto_install:
78 cd src/libafs && make install DESTDIR=$(CURDIR)/debian/tmp
79 install -d -g root -o root -m 755 $(moduledir)
80 install -g root -o root -m 644 \
81 debian/tmp/lib/modules/*/extra/openafs/*o $(moduledir)/
83 override_dh_clean:
84 rm -rf src/libafs/MODLOAD-* *-stamp
85 dh_clean Makefile config.log config.status setup src/libafs/Makefile \
86 src/libafs/Makefile.common src/libafs/asm src/libafs/asm-generic \
87 src/libafs/h src/libafs/linux src/libafs/net src/libafs/netinet \
88 src/libafs/rpc src/libafs/sys
90 override_dh_gencontrol:
91 dh_gencontrol -- -v`cat debian/VERSION`
93 override_dh_builddeb:
94 dh_builddeb --destdir="$(KPKG_DEST_DIR)"
96 kdist_configure: override_dh_auto_configure
98 kdist_image:
99 $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-arch
100 $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
102 kdist:
103 $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-arch
104 KSRC="$(KSRC)" KMAINT="$(KMAINT)" KEMAIL="$(KEMAIL)" \
105 sh -v debian/genchanges
106 $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
108 kdist_clean:
109 $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
111 .PHONY: kdist kdist_clean kdist_configure kdist_image