2 # Based on sample debian/rules that uses debhelper.
3 # GNU copyright 1997 by Joey Hess.
5 # The rules file for the OpenAFS module build.
7 # Uncomment this to turn on verbose mode.
10 # This has to be exported to make some magic below work.
13 # Tell Autoconf the correct system types.
14 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
15 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
16 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
17 SYSTEM = --build $(DEB_HOST_GNU_TYPE)
19 SYSTEM = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
22 # Determine whether we're building with optimization. This doesn't really
23 # work at the moment due to upstream problems.
24 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
25 DEBIAN_OPT_FLAGS = --disable-optimize --disable-lwp-optimize
26 DEBIAN_KERN_FLAGS = --disable-kernel-optimize
32 # Find kernel build information.
39 KVERS := $(shell perl debian/kernel-version $(KSRC))
44 SYS_NAME := $(shell KSRC="$(KSRC)" KVERS="$(KVERS)" sh debian/sysname)
47 modulepkg := openafs-modules-$(KVERS)${INT_SUBARCH}
48 moduledir := debian/$(modulepkg)/lib/modules/$(KVERS)/fs
50 configure: configure-modules-stamp
52 @if test x"$(SYS_NAME)" = x"UNKNOWN" ; then exit 1 ; fi
53 @if test x"$(KVERS)" = x ; then \
54 echo 'No version in $(KSRC)/include/linux/version.h' >&2 ; \
57 sh debian/prep-modules $(KSRC)
58 sh configure --with-afs-sysname=$(SYS_NAME) \
59 --with-linux-kernel-headers=$(KSRC) --prefix=`pwd`/debian/tmp \
60 --enable-debug --enable-lwp-debug --enable-kernel-debug \
61 $(DEBIAN_OPT_FLAGS) $(DEBIAN_KERN_FLAGS)
64 build: build-arch build-indep
65 build-arch: build-arch-stamp
67 build-arch-stamp: configure-stamp
69 touch build-arch-stamp
74 rm -f build-arch-stamp configure-stamp
75 [ ! -f Makefile ] || $(MAKE) distclean
78 install: build-arch-stamp
82 cd src/libafs && make install
83 install -d -g root -o root -m 755 $(moduledir)
84 install -g root -o root -m 755 debian/tmp/lib/openafs/*o $(moduledir)/
85 if test -f $(moduledir)/openafs.o \
86 -a ! -f $(moduledir)/openafs.mp.o ; then \
87 ln $(moduledir)/openafs.o $(moduledir)/openafs.mp.o || exit 1 ; \
90 binary: binary-arch binary-indep
95 dh_installchangelogs NEWS
103 dh_gencontrol -- -v`cat debian/VERSION`
105 dh_builddeb --destdir="$(KPKG_DEST_DIR)"
107 #################### Module package support (make-kpkg) ####################
109 kdist_configure: configure-stamp
111 kdist_image: build-arch-stamp
112 $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-arch
113 $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
115 kdist: build-arch-stamp
116 $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules binary-arch
117 KSRC="$(KSRC)" KMAINT="$(KMAINT)" KEMAIL="$(KEMAIL)" \
118 sh -v debian/genchanges
119 $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
122 $(ROOT_CMD) $(MAKE) $(MFLAGS) -f debian/rules clean
124 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean
125 .PHONY: configure install kdist kdist_clean kdist_configure kdist_image