1# 2# Makefile for e2scrub 3# 4 5srcdir = @srcdir@ 6top_srcdir = @top_srcdir@ 7VPATH = @srcdir@ 8top_builddir = .. 9my_dir = scrub 10INSTALL = @INSTALL@ 11MKDIR_P = @MKDIR_P@ 12 13@MCONFIG@ 14 15PROGS= e2scrub e2scrub_all 16MANPAGES= e2scrub.8 e2scrub_all.8 17CONFFILES= e2scrub.conf 18 19ifeq ($(HAVE_UDEV),yes) 20UDEV_RULES = e2scrub.rules 21INSTALLDIRS_TGT += installdirs-udev 22INSTALL_TGT += install-udev 23UNINSTALL_TGT += uninstall-udev 24endif 25 26ifeq ($(HAVE_CROND),yes) 27CRONTABS = e2scrub_all.cron 28LIBPROGS += e2scrub_all_cron 29INSTALLDIRS_TGT += installdirs-crond installdirs-libprogs 30INSTALL_TGT += install-crond install-libprogs 31UNINSTALL_TGT += uninstall-crond uninstall-libprogs 32endif 33 34ifeq ($(HAVE_SYSTEMD),yes) 35SERVICE_FILES = e2scrub@.service e2scrub_all.service e2scrub_all.timer e2scrub_fail@.service e2scrub_reap.service 36LIBPROGS += e2scrub_fail 37INSTALLDIRS_TGT += installdirs-systemd installdirs-libprogs 38INSTALL_TGT += install-systemd install-libprogs 39UNINSTALL_TGT += uninstall-systemd uninstall-libprogs 40endif 41 42all:: $(PROGS) $(MANPAGES) $(CONFFILES) $(UDEV_RULES) $(SERVICE_FILES) $(CRONTABS) $(LIBPROGS) 43 44e2scrub: $(DEP_SUBSTITUTE) e2scrub.in 45 $(E) " SUBST $@" 46 $(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/e2scrub.in $@ 47 $(Q) chmod a+x $@ 48 49e2scrub_all: e2scrub_all.in 50 $(E) " SUBST $@" 51 $(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/e2scrub_all.in $@ 52 $(Q) chmod a+x $@ 53 54e2scrub_fail: e2scrub_fail.in 55 $(E) " SUBST $@" 56 $(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/e2scrub_fail.in $@ 57 $(Q) chmod a+x $@ 58 59e2scrub_all_cron: e2scrub_all_cron.in 60 $(E) " SUBST $@" 61 $(Q) $(SUBSTITUTE_UPTIME) $(srcdir)/e2scrub_all_cron.in $@ 62 $(Q) chmod a+x $@ 63 64%.8: %.8.in $(DEP_SUBSTITUTE) 65 $(E) " SUBST $@" 66 $(Q) $(SUBSTITUTE_UPTIME) $< $@ 67 68%.conf: %.conf.in $(DEP_SUBSTITUTE) 69 $(E) " SUBST $@" 70 $(Q) $(SUBSTITUTE_UPTIME) $< $@ 71 72%.rules: %.rules.in $(DEP_SUBSTITUTE) 73 $(E) " SUBST $@" 74 $(Q) $(SUBSTITUTE_UPTIME) $< $@ 75 76%.service: %.service.in $(DEP_SUBSTITUTE) 77 $(E) " SUBST $@" 78 $(Q) $(SUBSTITUTE_UPTIME) $< $@ 79 80%.cron: %.cron.in $(DEP_SUBSTITUTE) 81 $(E) " SUBST $@" 82 $(Q) $(SUBSTITUTE_UPTIME) $< $@ 83 84%.timer: %.timer.in $(DEP_SUBSTITUTE) 85 $(E) " SUBST $@" 86 $(Q) $(SUBSTITUTE_UPTIME) $< $@ 87 88installdirs-udev: 89 $(E) " MKDIR_P $(UDEV_RULES_DIR)" 90 $(Q) $(MKDIR_P) $(DESTDIR)$(UDEV_RULES_DIR) 91 92installdirs-crond: 93 $(E) " MKDIR_P $(CROND_DIR)" 94 $(Q) $(MKDIR_P) $(DESTDIR)$(CROND_DIR) 95 96installdirs-libprogs: 97 $(E) " MKDIR_P $(pkglibdir)" 98 $(Q) $(MKDIR_P) $(DESTDIR)$(pkglibdir) 99 100installdirs-systemd: 101 $(E) " MKDIR_P $(SYSTEMD_SYSTEM_UNIT_DIR)" 102 $(Q) $(MKDIR_P) $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR) 103 104installdirs: $(INSTALLDIRS_TGT) 105 $(E) " MKDIR_P $(root_sbindir) $(man8dir) $(root_sysconfdir)" 106 $(Q) $(MKDIR_P) $(DESTDIR)$(root_sbindir) \ 107 $(DESTDIR)$(man8dir) $(DESTDIR)$(root_sysconfdir) 108 109install-udev: installdirs-udev 110 $(Q) for i in $(UDEV_RULES); do \ 111 $(ES) " INSTALL $(UDEV_RULES_DIR)/$$i"; \ 112 $(INSTALL_DATA) $$i $(DESTDIR)$(UDEV_RULES_DIR)/96-$$i; \ 113 done 114 115install-crond: installdirs-crond 116 $(Q) if test -n "$(CRONTABS)" ; then \ 117 $(ES) " INSTALL $(CROND_DIR)/e2scrub_all" ; \ 118 $(INSTALL_DATA) e2scrub_all.cron $(DESTDIR)$(CROND_DIR)/e2scrub_all ; \ 119 fi 120 121install-libprogs: $(LIBPROGS) installdirs-libprogs 122 $(Q) for i in $(LIBPROGS); do \ 123 $(ES) " INSTALL $(pkglibdir)/$$i"; \ 124 $(INSTALL_PROGRAM) $$i $(DESTDIR)$(pkglibdir)/$$i; \ 125 done 126 127install-systemd: $(SERVICE_FILES) installdirs-systemd 128 $(Q) for i in $(SERVICE_FILES); do \ 129 $(ES) " INSTALL_DATA $(SYSTEMD_SYSTEM_UNIT_DIR)/$$i"; \ 130 $(INSTALL_DATA) $$i $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/$$i; \ 131 done 132 133install-strip: install 134 135install: $(PROGS) $(MANPAGES) $(FMANPAGES) installdirs $(INSTALL_TGT) 136 $(Q) for i in $(PROGS); do \ 137 $(ES) " INSTALL $(root_sbindir)/$$i"; \ 138 $(INSTALL_PROGRAM) $$i $(DESTDIR)$(root_sbindir)/$$i; \ 139 done 140 $(Q) for i in $(MANPAGES); do \ 141 for j in $(COMPRESS_EXT); do \ 142 $(RM) -f $(DESTDIR)$(man8dir)/$$i.$$j; \ 143 done; \ 144 $(ES) " INSTALL_DATA $(man8dir)/$$i"; \ 145 $(INSTALL_DATA) $$i $(DESTDIR)$(man8dir)/$$i; \ 146 done 147 $(Q) for i in $(CONFFILES); do \ 148 $(ES) " INSTALL_DATA $(root_sysconfdir)/$$i"; \ 149 $(INSTALL_DATA) $$i $(DESTDIR)$(root_sysconfdir)/$$i; \ 150 done 151 152uninstall-udev: 153 for i in $(UDEV_RULES); do \ 154 $(RM) -f $(DESTDIR)$(UDEV_RULES_DIR)/96-$$i; \ 155 done 156 157uninstall-crond: 158 if test -n "$(CRONTABS)" ; then \ 159 $(RM) -f $(DESTDIR)$(CROND_DIR)/e2scrub_all ; \ 160 fi 161 162uninstall-libprogs: 163 for i in $(LIBPROGS); do \ 164 $(RM) -f $(DESTDIR)$(pkglibdir)/$$i; \ 165 done 166 167uninstall-systemd: 168 for i in $(SERVICE_FILES); do \ 169 $(RM) -f $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/$$i; \ 170 done 171 172uninstall: $(UNINSTALL_TGT) 173 for i in $(PROGS); do \ 174 $(RM) -f $(DESTDIR)$(root_sbindir)/$$i; \ 175 done 176 for i in $(MANPAGES); do \ 177 $(RM) -f $(DESTDIR)$(man8dir)/$$i; \ 178 done 179 for i in $(CONFFILES); do \ 180 $(RM) -f $(DESTDIR)$(root_sysconfdir)/$$i; \ 181 done 182 183clean:: 184 $(RM) -f $(PROGS) $(MANPAGES) $(CONFFILES) $(UDEV_RULES) $(SERVICE_FILES) $(CRONTABS) $(LIBPROGS) 185 186mostlyclean: clean 187distclean: clean 188 $(RM) -f .depend Makefile $(srcdir)/TAGS $(srcdir)/Makefile.in.old 189