-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (81 loc) · 3.88 KB
/
Makefile
File metadata and controls
95 lines (81 loc) · 3.88 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
prefix ?= /usr
libdir ?= ${prefix}/lib
datadir ?= ${prefix}/share
pkglibdir ?= ${libdir}/kdump
sysconfdir ?= /etc
bindir ?= ${prefix}/bin
sbindir ?= ${prefix}/sbin
mandir ?= ${prefix}/share/man
localstatedir ?= /var
sharedstatedir ?= /var/lib
udevrulesdir ?= ${libdir}/udev/rules.d
systemdsystemunitdir ?= ${libdir}/systemd/system/
ARCH ?= $(shell uname -m)
dracutmoddir = $(DESTDIR)${libdir}/dracut/modules.d
dracut-modules:
mkdir -p $(dracutmoddir)
cp -r dracut/99kdumpbase $(dracutmoddir)
cp -r dracut/99earlykdump $(dracutmoddir)
ifeq ($(ARCH), $(filter ppc64le ppc64,$(ARCH)))
cp -r dracut/99zz-fadumpinit $(dracutmoddir)
endif
kdump-conf: gen-kdump-conf.sh
./gen-kdump-conf.sh $(ARCH) > kdump.conf
kdump-sysconfig: gen-kdump-sysconfig.sh
./gen-kdump-sysconfig.sh $(ARCH) > kdump.sysconfig
format-check-shfmt:
@command -v shfmt &>/dev/null || { echo "Error: shfmt not found. Please install shfmt."; exit 1; }
shfmt -s -d *.sh kdumpctl mk*dumprd kdump-udev-throttler tests/*/*/*.sh dracut/*/*.sh tools/*.sh
format-check-altshfmt:
@command -v altshfmt >/dev/null 2>&1 || { echo "Error: altshfmt not found. Please install it."; exit 1; }
altshfmt -d spec/*_spec.sh
format-check: format-check-shfmt
static-analysis:
@command -v shellcheck >/dev/null 2>&1 || { echo "Error: shellcheck not found. Please install it."; exit 1; }
@# Currently, for kdump-utils, there is need for shellcheck to require
@# the sourced file to give correct warnings about the checked file
shellcheck -x *.sh kdumpctl mk*dumprd kdump-udev-throttler
shellcheck -x dracut/*/*.sh
shellcheck -x tests/*/*/*.sh tools/*.sh
@# disable the follow checks for unit tests
@# - 2317: to use shellspec directives like Context, When and etc.
@# - 2329: to mock functions.
@# - 2288, 2215: to use test data like -o, 'eng.redhat.com:/srv/[nfs]' in parametrized tests
shellcheck -e 2317,2329,2288,2215 -x spec/*.sh
manpages:
install -D -m 644 mkdumprd.8 kdumpctl.8 -t $(DESTDIR)$(mandir)/man8
install -D -m 644 kdump.conf.5 $(DESTDIR)$(mandir)/man5/kdump.conf.5
install: dracut-modules kdump-conf kdump-sysconfig manpages
mkdir -p $(DESTDIR)$(pkglibdir)/dracut.conf.d
mkdir -p -m755 $(DESTDIR)$(sysconfdir)/kdump/pre.d
mkdir -p -m755 $(DESTDIR)$(sysconfdir)/kdump/post.d
mkdir -p -m755 $(DESTDIR)$(sysconfdir)/kdump/emergency.d
mkdir -p -m755 $(DESTDIR)$(localstatedir)/crash
mkdir -p -m755 $(DESTDIR)$(udevrulesdir)
mkdir -p -m755 $(DESTDIR)$(sharedstatedir)/kdump
mkdir -p -m755 $(DESTDIR)$(libdir)/kernel/install.d/
install -D -m 755 kdumpctl $(DESTDIR)$(bindir)/kdumpctl
install -D -m 755 mkdumprd $(DESTDIR)$(sbindir)/mkdumprd
install -D -m 644 kdump.conf $(DESTDIR)$(sysconfdir)
install -D -m 644 kdump.sysconfig $(DESTDIR)$(sysconfdir)/sysconfig/kdump
install -D -m 755 kdump-lib.sh kdump-lib-initramfs.sh kdump-logger.sh -t $(DESTDIR)$(pkglibdir)
install -D -m 644 99-kdump.conf -t $(DESTDIR)$(pkglibdir)/dracut.conf.d
ifeq ($(ARCH), $(filter ppc64le ppc64,$(ARCH)))
install -m 755 mkfadumprd $(DESTDIR)$(sbindir)
install -m 755 kdump-migrate-action.sh kdump-restart.sh -t $(DESTDIR)$(pkglibdir)
install -m 755 60-fadump.install $(DESTDIR)$(libdir)/kernel/install.d/
endif
ifneq ($(ARCH),s390x)
install -m 755 kdump-udev-throttler $(DESTDIR)$(udevrulesdir)/../kdump-udev-throttler
# For s390x the ELF header is created in the kdump kernel and therefore kexec
# udev rules are not required
ifeq ($(ARCH), $(filter ppc64le ppc64,$(ARCH)))
install -m 644 98-kexec.rules.ppc64 $(DESTDIR)$(udevrulesdir)/98-kexec.rules
else
install -m 644 98-kexec.rules $(DESTDIR)$(udevrulesdir)/98-kexec.rules
endif
endif
install -D -m 644 kdump.service $(DESTDIR)$(systemdsystemunitdir)/kdump.service
install -m 755 -D kdump-dep-generator.sh $(DESTDIR)$(libdir)/systemd/system-generators/kdump-dep-generator.sh
install -m 755 60-kdump.install $(DESTDIR)$(libdir)/kernel/install.d/
install -m 755 92-crashkernel.install $(DESTDIR)$(libdir)/kernel/install.d/