postplug/Makefile

155 lines
4.5 KiB
Makefile
Raw Normal View History

2011-04-27 19:57:03 +02:00
# Makefile for postplug
# Copyright (C) 2004-2024 by Silvan Calarco <silvan.calarco@qilinux.it>
2011-04-27 19:57:03 +02:00
# Copyright (C) 2004-2007 by Davide Madrisan <davide.madrisan@gmail.com>
include VERSION
PACKAGE = postplug
prefix := /usr
exec_prefix := $(prefix)
sysconfdir := /etc
2011-04-27 19:57:03 +02:00
bindir = $(exec_prefix)/bin
libdir := $(prefix)/lib
sbindir := $(bindir)
sbin := $(bindir)
2011-04-27 19:57:03 +02:00
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
2011-04-27 19:57:03 +02:00
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;\
2013-10-01 01:36:15 +02:00
$(INSTALL_DATA) po/$$lang.mo $$dir/$(PACKAGE).mo;\
2011-04-27 19:57:03 +02:00
done
install-defs: $(pck_defs)
@echo "installing defs file...";\
$(INSTALL_DIR) $(DESTDIR)$(postplugdefsdir)
$(INSTALL_DATA) $^ $(DESTDIR)$(postplugdefsdir)/$(PACKAGE).defs
2014-10-03 13:40:25 +02:00
install-initscript:
2011-04-27 19:57:03 +02:00
@echo "installing initscript...";\
$(INSTALL_DIR) $(DESTDIR)$(systemdunitdir)
$(INSTALL_DATA) postplug/postplug-service $(DESTDIR)$(systemdunitdir)/postplug.service
2011-04-27 19:57:03 +02:00
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]}\
2011-04-27 19:57:03 +02:00
$(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
2011-04-27 19:57:03 +02:00
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)
2011-04-27 19:57:03 +02:00
install-programs: install-plugins install-scripts install-defs
@echo "installing $(PACKAGE)..."
@$(INSTALL_DIR) $(DESTDIR)$(sbindir)
$(INSTALL_SCRIPT) $(pck_postplug) $(DESTDIR)$(sbindir)/$(PACKAGE)
2011-04-27 19:57:03 +02:00
$(INSTALL_DIR) $(DESTDIR)$(postplugnewdir)
install: \
install-programs \
install-initscript \
install-logrotate \
install-locales \
install-sysconfig \
install-udev-files
2011-04-27 19:57:03 +02:00
uninstall:
rm -f $(DESTDIR)$(sbindir)/$(PACKAGE)
2011-04-27 19:57:03 +02:00
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
2011-04-27 19:57:03 +02:00
rm -f $(DESTDIR)$(localesdir)/*/LC_MESSAGES/$(PACKAGE).mo
dist: clean
@git log > ChangeLog.git
@mkdir /tmp/$(distdir)
@cp -a * /tmp/$(distdir)/
2011-04-27 19:57:03 +02:00
@rm -f $(dist_archive);\
tar cf - -C /tmp $(distdir) | bzip2 -9 -c > $(dist_archive)
@rm -rf /tmp/$(distdir)
2011-04-27 19:57:03 +02:00
@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 {} \;
2011-04-27 19:57:03 +02:00
rm -f $(dist_archive)
rm -f $(pck_catalogs:.po=.mo)
rm -f $(PACKAGE).lang