]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - scrub/Makefile
2f123ef005e169d218c9b929b728d541ece160b3
[thirdparty/xfsprogs-dev.git] / scrub / Makefile
1 # SPDX-License-Identifier: GPL-2.0
2 # Copyright (C) 2018-2024 Oracle. All Rights Reserved.
3 #
4
5 TOPDIR = ..
6 builddefs=$(TOPDIR)/include/builddefs
7 include $(builddefs)
8
9 SCRUB_PREREQS=$(HAVE_GETFSMAP)
10
11 scrub_svcname=xfs_scrub@.service
12
13 ifeq ($(SCRUB_PREREQS),yes)
14 LTCOMMAND = xfs_scrub
15 INSTALL_SCRUB = install-scrub
16 XFS_SCRUB_ALL_PROG = xfs_scrub_all
17 XFS_SCRUB_FAIL_PROG = xfs_scrub_fail
18 XFS_SCRUB_ARGS = -b -n
19 ifeq ($(HAVE_SYSTEMD),yes)
20 INSTALL_SCRUB += install-systemd
21 SYSTEMD_SERVICES = $(scrub_svcname) xfs_scrub_all.service xfs_scrub_all.timer xfs_scrub_fail@.service
22 OPTIONAL_TARGETS += $(SYSTEMD_SERVICES)
23 endif
24 ifeq ($(HAVE_CROND),yes)
25 INSTALL_SCRUB += install-crond
26 CRONTABS = xfs_scrub_all.cron
27 OPTIONAL_TARGETS += $(CRONTABS)
28 # Don't enable the crontab by default for now
29 CROND_DIR = $(PKG_DATA_DIR)
30 endif
31
32 endif # scrub_prereqs
33
34 UDEV_RULES = xfs.rules
35 ifeq ($(HAVE_UDEV),yes)
36 INSTALL_SCRUB += install-udev
37 endif
38
39 HFILES = \
40 common.h \
41 counter.h \
42 descr.h \
43 disk.h \
44 filemap.h \
45 fscounters.h \
46 inodes.h \
47 progress.h \
48 read_verify.h \
49 repair.h \
50 scrub.h \
51 spacemap.h \
52 unicrash.h \
53 vfs.h \
54 xfs_scrub.h
55
56 CFILES = \
57 common.c \
58 counter.c \
59 descr.c \
60 disk.c \
61 filemap.c \
62 fscounters.c \
63 inodes.c \
64 phase1.c \
65 phase2.c \
66 phase3.c \
67 phase4.c \
68 phase5.c \
69 phase6.c \
70 phase7.c \
71 progress.c \
72 read_verify.c \
73 repair.c \
74 scrub.c \
75 spacemap.c \
76 vfs.c \
77 xfs_scrub.c
78
79 LLDLIBS += $(LIBHANDLE) $(LIBFROG) $(LIBICU_LIBS) $(LIBRT) $(LIBURCU) \
80 $(LIBPTHREAD)
81 LTDEPENDENCIES += $(LIBHANDLE) $(LIBFROG)
82 LLDFLAGS = -static
83
84 ifeq ($(HAVE_MALLINFO),yes)
85 LCFLAGS += -DHAVE_MALLINFO
86 endif
87
88 ifeq ($(HAVE_MALLINFO2),yes)
89 LCFLAGS += -DHAVE_MALLINFO2
90 endif
91
92 ifeq ($(HAVE_LIBATTR),yes)
93 LCFLAGS += -DHAVE_LIBATTR
94 endif
95
96 ifeq ($(HAVE_LIBICU),yes)
97 CFILES += unicrash.c
98 LCFLAGS += -DHAVE_LIBICU $(LIBICU_CFLAGS)
99 endif
100
101 ifeq ($(HAVE_HDIO_GETGEO),yes)
102 LCFLAGS += -DHAVE_HDIO_GETGEO
103 endif
104
105 LDIRT = $(XFS_SCRUB_ALL_PROG) $(XFS_SCRUB_FAIL_PROG) *.service *.cron
106
107 default: depend $(LTCOMMAND) $(XFS_SCRUB_ALL_PROG) $(XFS_SCRUB_FAIL_PROG) $(OPTIONAL_TARGETS)
108
109 xfs_scrub_all: xfs_scrub_all.in $(builddefs)
110 @echo " [SED] $@"
111 $(Q)$(SED) -e "s|@sbindir@|$(PKG_SBIN_DIR)|g" \
112 -e "s|@scrub_svcname@|$(scrub_svcname)|g" \
113 -e "s|@pkg_version@|$(PKG_VERSION)|g" \
114 -e "s|@scrub_args@|$(XFS_SCRUB_ARGS)|g" < $< > $@
115 $(Q)chmod a+x $@
116
117 xfs_scrub_fail: xfs_scrub_fail.in $(builddefs)
118 @echo " [SED] $@"
119 $(Q)$(SED) -e "s|@sbindir@|$(PKG_SBIN_DIR)|g" \
120 -e "s|@scrub_svcname@|$(scrub_svcname)|g" \
121 -e "s|@pkg_version@|$(PKG_VERSION)|g" < $< > $@
122 $(Q)chmod a+x $@
123
124 phase5.o unicrash.o xfs.o: $(builddefs)
125
126 include $(BUILDRULES)
127
128 install: $(INSTALL_SCRUB)
129
130 %.service: %.service.in $(builddefs)
131 @echo " [SED] $@"
132 $(Q)$(SED) -e "s|@sbindir@|$(PKG_SBIN_DIR)|g" \
133 -e "s|@scrub_args@|$(XFS_SCRUB_ARGS)|g" \
134 -e "s|@pkg_libexec_dir@|$(PKG_LIBEXEC_DIR)|g" \
135 < $< > $@
136
137 %.cron: %.cron.in $(builddefs)
138 @echo " [SED] $@"
139 $(Q)$(SED) -e "s|@sbindir@|$(PKG_SBIN_DIR)|g" < $< > $@
140
141 install-systemd: default $(SYSTEMD_SERVICES)
142 $(INSTALL) -m 755 -d $(SYSTEMD_SYSTEM_UNIT_DIR)
143 $(INSTALL) -m 644 $(SYSTEMD_SERVICES) $(SYSTEMD_SYSTEM_UNIT_DIR)
144 $(INSTALL) -m 755 -d $(PKG_LIBEXEC_DIR)
145 $(INSTALL) -m 755 $(XFS_SCRUB_FAIL_PROG) $(PKG_LIBEXEC_DIR)
146
147 install-crond: default $(CRONTABS)
148 $(INSTALL) -m 755 -d $(CROND_DIR)
149 $(INSTALL) -m 644 $(CRONTABS) $(CROND_DIR)
150
151 install-scrub: default
152 $(INSTALL) -m 755 -d $(PKG_SBIN_DIR)
153 $(LTINSTALL) -m 755 $(LTCOMMAND) $(PKG_SBIN_DIR)
154 $(INSTALL) -m 755 $(XFS_SCRUB_ALL_PROG) $(PKG_SBIN_DIR)
155
156 install-udev: $(UDEV_RULES)
157 $(INSTALL) -m 755 -d $(UDEV_RULE_DIR)
158 for i in $(UDEV_RULES); do \
159 $(INSTALL) -m 644 $$i $(UDEV_RULE_DIR)/64-$$i; \
160 done
161
162 install-dev:
163
164 -include .dep