# Makefile for postplug # Copyright (C) 2004-2024 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 libdir := $(prefix)/lib sbindir := $(bindir) sbin := $(bindir) mandir = $(prefix)/share/man datadir = $(prefix)/share logrotatedir = $(sysconfdir)/logrotate.d/ sysconfigdir= $(sysconfdir)/sysconfig systemdunitdir := $(prefix)/lib/systemd/system udevdir := $(prefix)/lib/udev udevrulesdir := $(udevdir)/rules.d 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_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: @echo "installing initscript...";\ $(INSTALL_DIR) $(DESTDIR)$(systemdunitdir) $(INSTALL_DATA) 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-udev-files: @echo "installing udev files..." @$(INSTALL_DIR) $(DESTDIR)$(udevrulesdir) $(INSTALL_SCRIPT) udev/android_usb $(DESTDIR)$(udevdir)/android_usb $(INSTALL_DATA) udev/76-android_usb.rules $(DESTDIR)$(udevrulesdir)/76-android_usb.rules install-sysconfig: $(pck_sysconfig) @$(INSTALL_DIR) $(DESTDIR)$(sysconfigdir) $(INSTALL_DATA) $^ $(DESTDIR)$(sysconfigdir) install-scripts: $(pck_scripts) @echo "installing logrotate file...";\ $(INSTALL_DIR) $(DESTDIR)$(sbindir) $(INSTALL_SCRIPT) $^ $(DESTDIR)$(sbindir) install-programs: install-plugins install-scripts install-defs @echo "installing $(PACKAGE)..." @$(INSTALL_DIR) $(DESTDIR)$(sbindir) $(INSTALL_SCRIPT) $(pck_postplug) $(DESTDIR)$(sbindir)/$(PACKAGE) $(INSTALL_DIR) $(DESTDIR)$(postplugnewdir) install: \ install-programs \ install-initscript \ install-logrotate \ install-locales \ install-sysconfig \ install-udev-files uninstall: rm -f $(DESTDIR)$(sbindir)/$(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)$(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