File: Makefile

package info (click to toggle)
rapiddisk 9.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 952 kB
  • sloc: ansic: 6,760; sh: 1,364; makefile: 325; python: 105
file content (77 lines) | stat: -rw-r--r-- 2,797 bytes parent folder | download | duplicates (2)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copyright © 2011 - 2025 Petros Koutoupis
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; under version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-2.0-only

VERSION = 9.2.0

ifeq ($(KSRC),)
	KSRC := /lib/modules/$(shell uname -r)/build
endif

ifeq ($(KVER),)
	KVER := $(shell uname -r)
endif

MKDIR := mkdir -pv
CP := cp -v
DKMSFILES := rapiddisk.c rapiddisk-cache.c dkms.conf Makefile
DKMSDEST := /usr/src/rapiddisk-$(VERSION)

obj-m += rapiddisk.o
obj-m += rapiddisk-cache.o

all:
	$(MAKE) -C $(KSRC) M=$(CURDIR)

install: all
	$(MKDIR) $(DESTDIR)/lib/modules/$(KVER)/kernel/drivers/block/
	install -o root -g root -m 0755 rapiddisk.ko $(DESTDIR)/lib/modules/$(KVER)/kernel/drivers/block/
	install -o root -g root -m 0755 rapiddisk-cache.ko $(DESTDIR)/lib/modules/$(KVER)/kernel/drivers/block/
	depmod -a

uninstall:
	rm -f $(DESTDIR)/lib/modules/$(KVER)/kernel/drivers/block/rapiddisk.ko
	rm -f $(DESTDIR)/lib/modules/$(KVER)/kernel/drivers/block/rapiddisk-cache.ko
	depmod -a

clean:
	rm -rf *.o *.ko *.symvers *.mod.c .*.cmd Module.markers modules.order *.o.* built-in*
	rm -rf .tmp_versions .rapiddisk.o.d .rapiddisk-cache.o.d *.unsigned *.sdtinfo.c .ctf/ .cache.mk *.mod

dkms-install: clean uninstall
ifeq ($(shell which dkms >/dev/null 2>/dev/null; echo $$?),1)
	$(error No 'dkms' command found)
else ifeq ($(shell dkms status rapiddisk/$(VERSION) -k $(KVER) | grep '$(KVER)' >/dev/null 2>/dev/null; echo $$?),0)
	$(error rapiddisk version $(VERSION) is already installed for kernel $(KVER). Use 'make dkms-uninstall' first)
else
	dkms add . || true
	dkms install rapiddisk/$(VERSION) -k $(KVER)
endif

dkms-uninstall: clean uninstall
ifeq ($(shell which dkms >/dev/null 2>/dev/null; echo $$?),1)
	$(error No 'dkms' command found)
else ifeq ($(shell dkms status rapiddisk/$(VERSION) -k $(KVER) | grep '$(KVER)' >/dev/null 2>/dev/null; echo $$?),0)
	dkms remove rapiddisk/$(VERSION) -k $(KVER)
else
	$(error rapiddisk version $(VERSION) is not installed for kernel $(KVER))
endif

.PHONY: test
run-test: all

.PHONY: install-strip debug tools-strip tools-debug tools-uninstall tools-install-strip tools-install clean-tools tools
install-strip debug tools-strip tools-debug tools-uninstall tools-install-strip tools-install clean-tools tools: