summaryrefslogtreecommitdiff
path: root/debian/rules.modules
blob: 57a7f39f0029e3dd4fbac7148d0073790ed8eb86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/make -f

PACKAGE := sysprof-module
MA_DIR ?= /usr/share/modass
-include $(MA_DIR)/include/generic.make
-include $(MA_DIR)/include/common-rules.make

BASEVERS := $(shell echo $(KVERS) | cut -d. -f-2)

# kernel module filename extension
ifeq ($(BASEVERS),2.6)
        modextension := .ko
else
        modextension := .o
endif

.PHONY: kdist_config
kdist_config: prep-deb-files

.PHONY: binary_modules binary-modules
binary-modules: binary_modules
binary-modules: kdist_config
	dh_testdir
	dh_testroot
	dh_clean -k

	# Build the module
	$(MAKE) -C $(CURDIR) KVERS=$(KVERS) KDIR=$(KSRC)

	# Install the module
	dh_installdirs lib/modules/$(KVERS)/kernel/lib/
	dh_install sysprof-module$(modextension) lib/modules/$(KVERS)/kernel/lib/
	dh_installmodules

	dh_installdocs
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol -- -v$(VERSION)
	dh_md5sums
	dh_builddeb --destdir=$(DEB_DESTDIR)
	dh_clean -k

.PHONY: kdist_clean
kdist_clean:
	dh_testdir
	dh_testroot
	dh_clean
	$(MAKE) -C $(CURDIR) clean