# Makefile for postplug # Copyright (C) 2004-2005 by Silvan Calarco # Copyright (C) 2004-2007 by Davide Madrisan include VERSION PACKAGE = postplug prefix = /usr exec_prefix = $(prefix) sysconfdir = /etc bindir = $(exec_prefix)/bin sbindir = $(exec_prefix)/sbin sbin = /sbin mandir = $(prefix)/share/man datadir = $(prefix)/share initrddir = $(sysconfdir)/rc.d/init.d logrotatedir = $(sysconfdir)/logrotate.d/ sysconfigdir= $(sysconfdir)/sysconfig systemdunitdir = /lib/systemd/system localesdir = $(datadir)/locale srcdir = . DESTDIR = INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} -m 755 INSTALL_DATA = ${INSTALL} -m 644 INSTALL_DIR = ${INSTALL} -d -m 755 INSTALL_SCRIPT = ${INSTALL_PROGRAM} # package related variables distdir = $(PACKAGE)-$(VERSION) dist_archive = $(distdir).tar.bz2 postplugdir = ${sysconfdir}/$(PACKAGE)/postplug.d postplugrcdir = $(sysconfdir)/$(PACKAGE)/rcpostplug.d postplugupdatesdir = ${sysconfdir}/$(PACKAGE)/updates.d postplugdefsdir = $(sysconfdir)/$(PACKAGE) postplugnewdir = /var/lib/$(PACKAGE)/new pck_catalogs := $(wildcard po/*.po) pck_plugins := $(wildcard postplug.d/*) pck_sysconfig := $(wildcard sysconfig/*) pck_defs := postplug/postplug-defs pck_initscript = postplug/postplug-initscript pck_logrotate = postplug/postplug-logrotate pck_postplug = postplug/postplug pck_scripts := $(wildcard scripts/*) .SUFFIXES: .SUFFIXES: .po .mo .po.mo:; msgfmt $< -o $@ all: locales locales: $(pck_catalogs:.po=.mo) install-locales: locales @for f in $(pck_catalogs); do\ lang=`echo $$f | sed 's,.*/\(.*\)\.po,\1,'`;\ echo "installing i18n file for language \`$$lang'...";\ dir="$(DESTDIR)$(localesdir)/$$lang/LC_MESSAGES";\ $(INSTALL_DIR) $$dir;\ $(INSTALL_DATA) po/$$lang.mo $$dir/$(PACKAGE).mo;\ done install-defs: $(pck_defs) @echo "installing defs file...";\ $(INSTALL_DIR) $(DESTDIR)$(postplugdefsdir) $(INSTALL_DATA) $^ $(DESTDIR)$(postplugdefsdir)/$(PACKAGE).defs install-initscript: $(pck_initscript) @echo "installing initscript...";\ $(INSTALL_DIR) $(DESTDIR)$(initrddir) $(INSTALL_DIR) $(DESTDIR)$(systemdunitdir) $(INSTALL_SCRIPT) $^ $(DESTDIR)$(initrddir)/$(PACKAGE) $(INSTALL_SCRIPT) postplug/postplug-service $(DESTDIR)$(systemdunitdir)/postplug.service install-logrotate: $(pck_logrotate) @echo "installing logrotate file...";\ $(INSTALL_DIR) $(DESTDIR)$(logrotatedir) $(INSTALL_DATA) $^ $(DESTDIR)$(logrotatedir)/$(PACKAGE) install-plugins: $(pck_plugins) @echo "installing plugins..." @$(INSTALL_DIR) $(DESTDIR)$(postplugdir) @$(INSTALL_DIR) $(DESTDIR)$(postplugrcdir) @$(INSTALL_DIR) $(DESTDIR)$(postplugupdatesdir) for plugin in $(notdir $^); do\ $(INSTALL_SCRIPT) postplug.d/$$plugin \ $(DESTDIR)$(postplugdir)/$${plugin##[0-9][0-9]};\ ln -sf ../postplug.d/$${plugin##[0-9][0-9]}\ $(DESTDIR)$(postplugrcdir)/$$plugin;\ done install-sysconfig: $(pck_sysconfig) @$(INSTALL_DIR) $(DESTDIR)$(sysconfigdir) $(INSTALL_DATA) $^ $(DESTDIR)$(sysconfigdir) install-scripts: $(pck_scripts) @echo "installing logrotate file...";\ $(INSTALL_DIR) $(DESTDIR)$(sbin) $(INSTALL_SCRIPT) $^ $(DESTDIR)$(sbin) install-programs: install-plugins install-scripts install-defs @echo "installing $(PACKAGE)..." @$(INSTALL_DIR) $(DESTDIR)$(sbin) $(INSTALL_SCRIPT) $(pck_postplug) $(DESTDIR)$(sbin)/$(PACKAGE) $(INSTALL_DIR) $(DESTDIR)$(postplugnewdir) install: \ install-programs \ install-initscript \ install-logrotate \ install-locales \ install-sysconfig uninstall: rm -f $(DESTDIR)$(sbin)/$(PACKAGE) for f in $(notdir $(pck_plugins)); do\ rm -f $(DESTDIR)$(postplugdir)/$${f##[0-9][0-9]};\ rm -f $(DESTDIR)$(postplugrcdir)/$$f;\ done -rmdir $(DESTDIR)$(postplugdir) -rmdir $(DESTDIR)$(postplugrcdir) rm -f $(DESTDIR)$(initrddir)/$(PACKAGE) rm -f $(DESTDIR)$(systemdunitdir)/postplug.service rm -f $(DESTDIR)$(localesdir)/*/LC_MESSAGES/$(PACKAGE).mo dist: clean @git log > ChangeLog.git @mkdir /tmp/$(distdir) @cp -a * /tmp/$(distdir)/ @rm -f $(dist_archive);\ tar cf - -C /tmp $(distdir) | bzip2 -9 -c > $(dist_archive) @rm -rf /tmp/$(distdir) @echo "file \`$(dist_archive)' created" dist-rpm: dist @rpm_sourcedir=`rpm --eval=%{_sourcedir}`;\ mv -f $(dist_archive) $$rpm_sourcedir && \ echo "and saved as \`$$rpm_sourcedir/$(dist_archive)'" clean: find . -name *~ -exec rm {} \; rm -f $(dist_archive) rm -f $(pck_catalogs:.po=.mo) rm -f $(PACKAGE).lang