Run /usr/lib/time-sliderd directly from .service file
[time-slider.git] / Makefile
1 ifeq ($(wildcard .git),)
2         include VERSION
3 else
4         VERSION=$(shell git describe)
5 endif
6 MAINVER=$(shell echo $(VERSION) | cut -f1 -d'-')
7 RELEASE=$(shell echo $(VERSION) | cut -f2- -d'-' | sed -e 's/-/./g')
8
9 mkinstalldirs = /usr/bin/mkdir -p
10 INSTALL = /usr/bin/install
11 INSTALL_DATA = ${INSTALL} -m 644 -t
12 INSTALL_PROGRAM = ${INSTALL} -m 755 -t
13 INSTALL_SCRIPT = ${INSTALL} -t
14 RM = /usr/bin/rm -f
15 RMRF = /usr/bin/rm -Rf
16 RMDIR = /usr/bin/rmdir
17 RPM = /usr/bin/rpm
18 RPMBUILD = /usr/bin/rpmbuild
19 # Use python 2.6 if PYTHON environent is not set
20 ifeq ($(strip $(PYTHON)),)
21 PYTHON = /usr/bin/python2
22 endif
23
24 SUBDIRS = po data rpm
25
26 DISTFILES = Authors \
27                         VERSION \
28                         ChangeLog \
29                         Makefile \
30                         py-compile.py \
31                         $(SUBDIRS) \
32                         lib \
33                         usr \
34                         var \
35                         etc
36
37 clean:
38         $(RM) usr/share/time-slider/lib/time_slider/*.pyc
39         $(RM) usr/share/time-slider/lib/plugin/*.pyc
40         $(RM) usr/share/time-slider/lib/plugin/rsync/*.pyc
41         $(RM) usr/share/time-slider/lib/plugin/zfssend/*.pyc
42         $(RM) rpm/time-slider.spec
43
44 all:
45         for subdir in $(SUBDIRS); do \
46           cd $$subdir; make; cd ..;\
47         done
48         echo $(VERSION)
49
50 dist: clean all
51         $(RMRF) time-slider-$(VERSION)
52         mkdir time-slider-$(VERSION)
53         cp -pR $(DISTFILES) time-slider-$(VERSION)
54         /usr/bin/tar cf - time-slider-$(VERSION) | bzip2 > time-slider-$(VERSION).tar.bz2
55         $(RMRF) time-slider-$(VERSION)
56
57 install:
58         for subdir in $(SUBDIRS); do \
59           cd $$subdir; \
60           make DESTDIR=$(DESTDIR) GETTEXT_PACKAGE=time-slider install; \
61           cd ..;\
62         done
63         $(mkinstalldirs) $(DESTDIR)/etc/dbus-1/system.d
64         $(INSTALL_DATA) $(DESTDIR)/etc/dbus-1/system.d etc/dbus-1/system.d/time-slider.conf
65         $(mkinstalldirs) $(DESTDIR)/etc/xdg/autostart
66         $(INSTALL_DATA) $(DESTDIR)/etc/xdg/autostart etc/xdg/autostart/*.desktop
67         $(mkinstalldirs) $(DESTDIR)/usr/lib/systemd/system
68         $(INSTALL_DATA) $(DESTDIR)/usr/lib/systemd/system etc/systemd/system/*.service
69         $(mkinstalldirs) $(DESTDIR)/usr/bin
70         $(INSTALL_PROGRAM) $(DESTDIR)/usr/bin usr/bin/time-slider-setup
71         $(mkinstalldirs) $(DESTDIR)/usr/lib/time-slider/plugins/rsync
72         $(mkinstalldirs) $(DESTDIR)/usr/lib/time-slider/plugins/zfssend
73         $(INSTALL_PROGRAM) $(DESTDIR)/usr/lib usr/lib/time-sliderd
74         $(INSTALL_PROGRAM) $(DESTDIR)/usr/lib usr/lib/time-slider-delete
75         $(INSTALL_PROGRAM) $(DESTDIR)/usr/lib usr/lib/time-slider-notify
76         $(INSTALL_PROGRAM) $(DESTDIR)/usr/lib usr/lib/time-slider-snapshot
77         $(INSTALL_PROGRAM) $(DESTDIR)/usr/lib usr/lib/time-slider-version
78         $(INSTALL_PROGRAM) $(DESTDIR)/usr/lib/time-slider/plugins/zfssend usr/lib/time-slider/plugins/zfssend/zfssend
79         $(INSTALL_PROGRAM) $(DESTDIR)/usr/lib/time-slider/plugins/rsync usr/lib/time-slider/plugins/rsync/rsync-trigger
80         $(INSTALL_PROGRAM) $(DESTDIR)/usr/lib/time-slider/plugins/rsync usr/lib/time-slider/plugins/rsync/rsync-backup
81         $(mkinstalldirs) $(DESTDIR)/usr/share/applications
82         $(INSTALL_DATA) $(DESTDIR)/usr/share/applications usr/share/applications/time-slider.desktop
83         $(mkinstalldirs) $(DESTDIR)/usr/share/icons/hicolor/16x16/apps
84         $(INSTALL_DATA) $(DESTDIR)/usr/share/icons/hicolor/16x16/apps usr/share/icons/hicolor/16x16/apps/time-slider-setup.png
85         $(mkinstalldirs) $(DESTDIR)/usr/share/icons/hicolor/24x24/apps
86         $(INSTALL_DATA) $(DESTDIR)/usr/share/icons/hicolor/24x24/apps usr/share/icons/hicolor/24x24/apps/time-slider-setup.png
87         $(mkinstalldirs) $(DESTDIR)/usr/share/icons/hicolor/32x32/apps
88         $(INSTALL_DATA) $(DESTDIR)/usr/share/icons/hicolor/32x32/apps usr/share/icons/hicolor/32x32/apps/time-slider-setup.png
89         $(mkinstalldirs) $(DESTDIR)/usr/share/icons/hicolor/36x36/apps
90         $(INSTALL_DATA) $(DESTDIR)/usr/share/icons/hicolor/36x36/apps usr/share/icons/hicolor/36x36/apps/time-slider-setup.png
91         $(mkinstalldirs) $(DESTDIR)/usr/share/icons/hicolor/48x48/apps
92         $(INSTALL_DATA) $(DESTDIR)/usr/share/icons/hicolor/48x48/apps usr/share/icons/hicolor/48x48/apps/time-slider-setup.png
93         $(mkinstalldirs) $(DESTDIR)/usr/share/icons/hicolor/72x72/apps
94         $(INSTALL_DATA) $(DESTDIR)/usr/share/icons/hicolor/72x72/apps usr/share/icons/hicolor/72x72/apps/time-slider-setup.png
95         $(mkinstalldirs) $(DESTDIR)/usr/share/icons/hicolor/96x96/apps
96         $(INSTALL_DATA) $(DESTDIR)/usr/share/icons/hicolor/96x96/apps usr/share/icons/hicolor/96x96/apps/time-slider-setup.png
97         $(mkinstalldirs) $(DESTDIR)/usr/share/time-slider/glade
98         $(INSTALL_DATA) $(DESTDIR)/usr/share/time-slider/glade usr/share/time-slider/glade/time-slider-delete.glade
99         $(INSTALL_DATA) $(DESTDIR)/usr/share/time-slider/glade usr/share/time-slider/glade/time-slider-setup.glade
100         $(INSTALL_DATA) $(DESTDIR)/usr/share/time-slider/glade usr/share/time-slider/glade/time-slider-snapshot.glade
101         $(INSTALL_DATA) $(DESTDIR)/usr/share/time-slider/glade usr/share/time-slider/glade/time-slider-version.glade
102         $(mkinstalldirs) $(DESTDIR)/usr/share/time-slider/lib/time_slider
103         for file in usr/share/time-slider/lib/time_slider/*.py; do \
104                 if test -f $$file ; then \
105                   $(INSTALL_DATA) $(DESTDIR)/usr/share/time-slider/lib/time_slider $$file; \
106                 fi; \
107         done
108         $(mkinstalldirs) $(DESTDIR)/usr/share/time-slider/lib/time_slider/linux
109         for file in usr/share/time-slider/lib/time_slider/linux/*.py; do \
110                 if test -f $$file ; then \
111                   $(INSTALL_DATA) $(DESTDIR)/usr/share/time-slider/lib/time_slider/linux $$file; \
112                 fi; \
113         done
114         $(mkinstalldirs) $(DESTDIR)/usr/share/time-slider/lib/plugin
115         for file in usr/share/time-slider/lib/plugin/*.py; do \
116                 if test -f $$file ; then \
117                   $(INSTALL_DATA) $(DESTDIR)/usr/share/time-slider/lib/plugin $$file; \
118                 fi; \
119         done
120         $(mkinstalldirs) $(DESTDIR)/usr/share/time-slider/lib/plugin/rsync
121         for file in usr/share/time-slider/lib/plugin/rsync/*.py; do \
122                 if test -f $$file ; then \
123                   $(INSTALL_DATA) $(DESTDIR)/usr/share/time-slider/lib/plugin/rsync $$file; \
124                 fi; \
125         done
126         $(mkinstalldirs) $(DESTDIR)/usr/share/time-slider/lib/plugin/zfssend
127         for file in usr/share/time-slider/lib/plugin/zfssend/*.py; do \
128                 if test -f $$file ; then \
129                   $(INSTALL_DATA) $(DESTDIR)/usr/share/time-slider/lib/plugin/zfssend $$file; \
130                 fi; \
131         done
132         
133 uninstall:
134         for subdir in $(SUBDIRS); do \
135           cd $$subdir; \
136           make DESTDIR=$(DESTDIR) GETTEXT_PACKAGE=time-slider uninstall; \
137           cd ..;\
138         done
139         $(RM) $(DESTDIR)/etc/dbus-1/system.d/time-slider.conf
140         $(RM) $(DESTDIR)/etc/xdg/autostart/time-slider-notify.desktop
141         $(RM) $(DESTDIR)/usr/lib/systemd/system/time-sliderd.service
142         $(RM) $(DESTDIR)/usr/bin/time-slider-setup
143         $(RM) $(DESTDIR)/usr/lib/time-sliderd
144         $(RM) $(DESTDIR)/usr/lib/time-slider-delete
145         $(RM) $(DESTDIR)/usr/lib/time-slider-notify
146         $(RM) $(DESTDIR)/usr/lib/time-slider-snapshot
147         $(RM) $(DESTDIR)/usr/lib/time-slider-version
148         $(RM) $(DESTDIR)/usr/lib/time-slider-zfssend
149         $(RM) $(DESTDIR)/usr/lib/time-slider-rsync
150         $(RMRF) $(DESTDIR)/usr/lib/time-slider/plugins/rsync
151         $(RMRF) $(DESTDIR)/usr/lib/time-slider/plugins/zfssend
152         $(RM) $(DESTDIR)/usr/share/applications/time-slider.desktop
153         $(RM) $(DESTDIR)/usr/share/icons/hicolor/*/apps/time-slider-setup.png
154         $(RMRF) $(DESTDIR)/usr/share/time-slider
155
156
157 rpm-local:
158         @(if test ! -x "${RPMBUILD}"; then \
159                 echo -e "\n" \
160         "*** Required util ${RPMBUILD} missing.  Please install the\n" \
161         "*** package for your distribution which provides ${RPMBUILD},\n" \
162         "*** re-run configure, and try again.\n"; \
163                 exit 1; \
164         fi; \
165         mkdir -p $(rpmbuild)/TMP && \
166         mkdir -p $(rpmbuild)/BUILD && \
167         mkdir -p $(rpmbuild)/RPMS && \
168         mkdir -p $(rpmbuild)/SRPMS && \
169         mkdir -p $(rpmbuild)/SPECS && \
170         cp rpm/$(rpmspec) $(rpmbuild)/SPECS && \
171         mkdir -p $(rpmbuild)/SOURCES && \
172         cp time-slider-$(VERSION).tar.bz2 $(rpmbuild)/SOURCES)
173
174 srpm: dist
175         @(dist=`$(RPM) --eval %{?dist}`; \
176         rpmpkg=time-slider-$(MAINVER)-0.$(RELEASE)$$dist*src.rpm; \
177         rpmspec=time-slider.spec; \
178         rpmbuild=`mktemp -t -d time-slider-build-$$USER-XXXXXXXX`; \
179         $(MAKE) \
180                 rpmbuild="$$rpmbuild" \
181                 rpmspec="$$rpmspec" \
182                 rpm-local || exit 1; \
183         $(RPMBUILD) \
184                 --define "_tmppath $$rpmbuild/TMP" \
185                 --define "_topdir $$rpmbuild" \
186                 $(def) -bs $$rpmbuild/SPECS/$$rpmspec || exit 1; \
187         cp $$rpmbuild/SRPMS/$$rpmpkg . || exit 1; \
188         rm -R $$rpmbuild)
189
190 rpm: srpm
191         @(dist=`$(RPM) --eval %{?dist}`; \
192         rpmpkg=time-slider-$(MAINVER)-0.$(RELEASE)$$dist*src.rpm; \
193         rpmspec=time-slider.spec; \
194         rpmbuild=`mktemp -t -d time-slider-build-$$USER-XXXXXXXX`; \
195         $(MAKE) \
196                 rpmbuild="$$rpmbuild" \
197                 rpmspec="$$rpmspec" \
198                 rpm-local || exit 1; \
199         ${RPMBUILD} \
200                 --define "_tmppath $$rpmbuild/TMP" \
201                 --define "_topdir $$rpmbuild" \
202                 $(def) --rebuild $$rpmpkg || exit 1; \
203         cp $$rpmbuild/RPMS/*/* . || exit 1; \
204         rm -R $$rpmbuild)