2011-04-27 19:57:03 +02:00
|
|
|
# Makefile for postplug
|
2015-02-08 21:40:04 +01:00
|
|
|
# Copyright (C) 2004-2015 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
|
|
|
|
bindir = $(exec_prefix)/bin
|
2015-02-08 21:40:04 +01:00
|
|
|
libdir := $(prefix)/lib
|
2011-04-27 19:57:03 +02:00
|
|
|
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
|
2013-04-05 14:19:03 +02:00
|
|
|
systemdunitdir = /lib/systemd/system
|
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...";\
|
2013-04-05 14:19:03 +02:00
|
|
|
$(INSTALL_DIR) $(DESTDIR)$(systemdunitdir)
|
2014-04-21 14:54:42 +02:00
|
|
|
$(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]};\
|
2012-03-02 19:38:30 +01:00
|
|
|
ln -sf ../postplug.d/$${plugin##[0-9][0-9]}\
|
2011-04-27 19:57:03 +02:00
|
|
|
$(DESTDIR)$(postplugrcdir)/$$plugin;\
|
|
|
|
done
|
|
|
|
|
2013-11-19 10:59:44 +01:00
|
|
|
install-udev-files:
|
|
|
|
@echo "installing udev files..."
|
|
|
|
@$(INSTALL_DIR) $(DESTDIR)/lib/udev/rules.d
|
|
|
|
$(INSTALL_SCRIPT) udev/android_usb $(DESTDIR)/lib/udev/android_usb
|
|
|
|
$(INSTALL_DATA) udev/76-android_usb.rules $(DESTDIR)/lib/udev/rules.d/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...";\
|
2017-12-20 13:01:31 +01:00
|
|
|
$(INSTALL_DIR) $(DESTDIR)$(sbindir)
|
|
|
|
$(INSTALL_SCRIPT) $^ $(DESTDIR)$(sbindir)
|
|
|
|
$(INSTALL_SCRIPT) scripts/update-alternatives-set-dri $(DESTDIR)$(sbindir)
|
|
|
|
sed -i "s|@LIBDIR@|$(libdir)|" $(DESTDIR)$(sbindir)/update-alternatives-set-dri
|
2011-04-27 19:57:03 +02:00
|
|
|
|
|
|
|
install-programs: install-plugins install-scripts install-defs
|
|
|
|
@echo "installing $(PACKAGE)..."
|
2017-12-20 13:01:31 +01:00
|
|
|
@$(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 \
|
2013-11-19 10:59:44 +01:00
|
|
|
install-sysconfig \
|
|
|
|
install-udev-files
|
2011-04-27 19:57:03 +02:00
|
|
|
|
|
|
|
uninstall:
|
2017-12-20 13:01:31 +01:00
|
|
|
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)
|
2013-04-05 14:19:03 +02:00
|
|
|
rm -f $(DESTDIR)$(systemdunitdir)/postplug.service
|
2011-04-27 19:57:03 +02:00
|
|
|
rm -f $(DESTDIR)$(localesdir)/*/LC_MESSAGES/$(PACKAGE).mo
|
|
|
|
|
|
|
|
dist: clean
|
2011-07-10 17:27:37 +02:00
|
|
|
@git log > ChangeLog.git
|
2011-04-27 20:06:31 +02:00
|
|
|
@mkdir /tmp/$(distdir)
|
|
|
|
@cp -a * /tmp/$(distdir)/
|
2011-04-27 19:57:03 +02:00
|
|
|
@rm -f $(dist_archive);\
|
2011-04-27 20:06:31 +02:00
|
|
|
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:
|
2011-10-02 15:51:10 +02:00
|
|
|
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
|