2018-12-03 21:28:16 +01:00
|
|
|
DC ?= dmd
|
2019-04-01 20:44:38 +02:00
|
|
|
RELEASEVER = v2.3.2
|
2019-01-29 01:37:51 +01:00
|
|
|
pkgconfig := $(shell if [ $(PKGCONFIG) ] && [ "$(PKGCONFIG)" != 0 ] ; then echo 1 ; else echo "" ; fi)
|
|
|
|
notifications := $(shell if [ $(NOTIFICATIONS) ] && [ "$(NOTIFICATIONS)" != 0 ] ; then echo 1 ; else echo "" ; fi)
|
2019-03-19 03:14:07 +01:00
|
|
|
gitversion := $(shell if [ -f .git/HEAD ] ; then echo 1 ; else echo "" ; fi)
|
2019-01-29 01:37:51 +01:00
|
|
|
|
|
|
|
ifeq ($(pkgconfig),1)
|
|
|
|
LIBS = $(shell pkg-config --libs sqlite3 libcurl)
|
2019-01-07 03:03:47 +01:00
|
|
|
else
|
2019-01-29 01:37:51 +01:00
|
|
|
LIBS = -lcurl -lsqlite3
|
2019-01-07 03:03:47 +01:00
|
|
|
endif
|
2019-01-29 01:37:51 +01:00
|
|
|
ifeq ($(notifications),1)
|
|
|
|
NOTIF_VERSIONS = -version=NoPragma -version=NoGdk -version=Notifications
|
|
|
|
ifeq ($(pkgconfig),1)
|
|
|
|
LIBS += $(shell pkg-config --libs libnotify)
|
2019-01-07 03:03:47 +01:00
|
|
|
else
|
2019-01-29 01:37:51 +01:00
|
|
|
LIBS += -lgmodule-2.0 -lglib-2.0 -lnotify
|
2019-01-07 03:03:47 +01:00
|
|
|
endif
|
2018-12-05 20:19:00 +01:00
|
|
|
endif
|
2019-01-07 03:03:47 +01:00
|
|
|
LIBS += -ldl
|
|
|
|
|
|
|
|
# add the necessary prefix for the D compiler
|
|
|
|
LIBS := $(addprefix -L,$(LIBS))
|
|
|
|
|
|
|
|
# support ldc2 which needs -d prefix for version specification
|
|
|
|
ifeq ($(notdir $(DC)),ldc2)
|
|
|
|
NOTIF_VERSIONS := $(addprefix -d,$(NOTIF_VERSIONS))
|
|
|
|
endif
|
|
|
|
|
2019-03-24 01:12:40 +01:00
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
ifeq ($(notdir $(DC)),ldc2)
|
|
|
|
DFLAGS += -d-debug -gc
|
|
|
|
else
|
|
|
|
DFLAGS += -debug -gs
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-01-07 03:03:47 +01:00
|
|
|
DFLAGS += -w -g -ofonedrive -O $(NOTIF_VERSIONS) $(LIBS) -J.
|
|
|
|
|
2018-12-03 21:28:16 +01:00
|
|
|
PREFIX ?= /usr/local
|
2018-12-04 00:40:05 +01:00
|
|
|
DOCDIR ?= $(PREFIX)/share/doc/onedrive
|
|
|
|
MANDIR ?= $(PREFIX)/share/man/man1
|
2018-12-01 21:41:01 +01:00
|
|
|
DOCFILES = README.md README.Office365.md config LICENSE CHANGELOG.md
|
2015-09-01 20:45:34 +02:00
|
|
|
|
2018-08-27 02:35:58 +02:00
|
|
|
ifneq ("$(wildcard /etc/redhat-release)","")
|
2019-01-19 03:01:01 +01:00
|
|
|
RHEL = $(shell cat /etc/redhat-release | grep -E "(Red Hat Enterprise Linux Server|CentOS)" | wc -l)
|
|
|
|
RHEL_VERSION = $(shell rpm --eval "%{centos_ver}")
|
2018-08-27 02:35:58 +02:00
|
|
|
else
|
|
|
|
RHEL = 0
|
2019-01-19 03:01:01 +01:00
|
|
|
RHEL_VERSION = 0
|
2018-08-27 02:35:58 +02:00
|
|
|
endif
|
|
|
|
|
2015-09-01 20:45:34 +02:00
|
|
|
SOURCES = \
|
|
|
|
src/config.d \
|
2015-09-14 23:56:14 +02:00
|
|
|
src/itemdb.d \
|
2016-08-04 23:35:58 +02:00
|
|
|
src/log.d \
|
2015-09-01 20:45:34 +02:00
|
|
|
src/main.d \
|
2015-09-11 18:33:22 +02:00
|
|
|
src/monitor.d \
|
2015-09-01 20:45:34 +02:00
|
|
|
src/onedrive.d \
|
2017-05-28 19:53:39 +02:00
|
|
|
src/qxor.d \
|
2017-03-24 22:30:03 +01:00
|
|
|
src/selective.d \
|
2015-09-01 20:45:34 +02:00
|
|
|
src/sqlite.d \
|
|
|
|
src/sync.d \
|
2015-09-27 18:47:41 +02:00
|
|
|
src/upload.d \
|
2018-08-09 23:46:27 +02:00
|
|
|
src/util.d \
|
|
|
|
src/progress.d
|
2015-09-01 20:45:34 +02:00
|
|
|
|
2019-01-29 01:37:51 +01:00
|
|
|
ifeq ($(notifications),1)
|
2018-12-05 20:19:00 +01:00
|
|
|
SOURCES += src/notifications/notify.d src/notifications/dnotify.d
|
|
|
|
endif
|
|
|
|
|
2018-12-01 21:41:01 +01:00
|
|
|
all: onedrive onedrive.service onedrive.1
|
2017-05-29 01:37:09 +02:00
|
|
|
|
2017-07-14 11:31:16 +02:00
|
|
|
clean:
|
2019-03-25 23:40:07 +01:00
|
|
|
rm -f onedrive onedrive.o onedrive.service onedrive@.service onedrive.1 version
|
2017-07-14 11:31:16 +02:00
|
|
|
|
2018-12-04 01:59:03 +01:00
|
|
|
onedrive: version $(SOURCES)
|
|
|
|
$(DC) $(DFLAGS) $(SOURCES)
|
|
|
|
|
|
|
|
install.noservice: onedrive onedrive.1
|
2018-05-23 21:31:20 +02:00
|
|
|
mkdir -p $(DESTDIR)/var/log/onedrive
|
|
|
|
chown root.users $(DESTDIR)/var/log/onedrive
|
|
|
|
chmod 0775 $(DESTDIR)/var/log/onedrive
|
2018-04-22 00:29:43 +02:00
|
|
|
install -D onedrive $(DESTDIR)$(PREFIX)/bin/onedrive
|
2018-12-01 21:41:01 +01:00
|
|
|
install -D onedrive.1 $(DESTDIR)$(MANDIR)/onedrive.1
|
2018-05-23 21:31:20 +02:00
|
|
|
install -D -m 644 logrotate/onedrive.logrotate $(DESTDIR)/etc/logrotate.d/onedrive
|
2018-12-04 01:59:03 +01:00
|
|
|
|
|
|
|
install: all install.noservice
|
2018-12-01 21:41:01 +01:00
|
|
|
for i in $(DOCFILES) ; do install -D -m 644 $$i $(DESTDIR)$(DOCDIR)/$$i ; done
|
2018-08-27 02:35:58 +02:00
|
|
|
ifeq ($(RHEL),1)
|
2019-01-19 03:01:01 +01:00
|
|
|
ifeq ($(RHEL_VERSION),6)
|
|
|
|
mkdir -p $(DESTDIR)/etc/init.d/
|
|
|
|
chown root.root $(DESTDIR)/etc/init.d/
|
|
|
|
install -D init.d/onedrive.init $(DESTDIR)/etc/init.d/onedrive
|
|
|
|
install -D init.d/onedrive_service.sh $(DESTDIR)$(PREFIX)/bin/onedrive_service.sh
|
|
|
|
else
|
2018-10-07 04:10:41 +02:00
|
|
|
mkdir -p $(DESTDIR)/usr/lib/systemd/system/
|
|
|
|
chown root.root $(DESTDIR)/usr/lib/systemd/system/
|
|
|
|
chmod 0755 $(DESTDIR)/usr/lib/systemd/system/
|
2018-10-17 09:18:33 +02:00
|
|
|
install -D -m 644 *.service $(DESTDIR)/usr/lib/systemd/system/
|
2019-01-19 03:01:01 +01:00
|
|
|
endif
|
2018-08-27 02:35:58 +02:00
|
|
|
else
|
2018-07-14 22:23:50 +02:00
|
|
|
mkdir -p $(DESTDIR)/usr/lib/systemd/user/
|
|
|
|
chown root.root $(DESTDIR)/usr/lib/systemd/user/
|
|
|
|
chmod 0755 $(DESTDIR)/usr/lib/systemd/user/
|
2018-10-17 09:18:33 +02:00
|
|
|
install -D -m 644 onedrive.service $(DESTDIR)/usr/lib/systemd/user/
|
2018-10-07 04:10:41 +02:00
|
|
|
mkdir -p $(DESTDIR)/usr/lib/systemd/system/
|
|
|
|
chown root.root $(DESTDIR)/usr/lib/systemd/system/
|
|
|
|
chmod 0755 $(DESTDIR)/usr/lib/systemd/system/
|
2018-10-17 09:18:33 +02:00
|
|
|
install -D -m 644 onedrive@.service $(DESTDIR)/usr/lib/systemd/system/
|
2018-12-04 01:59:03 +01:00
|
|
|
install -D -m 644 onedrive.service $(DESTDIR)/usr/lib/systemd/user/onedrive.service
|
2019-01-19 03:01:01 +01:00
|
|
|
endif
|
2017-05-29 01:37:09 +02:00
|
|
|
|
|
|
|
onedrive.service:
|
2018-04-13 13:56:22 +02:00
|
|
|
sed "s|@PREFIX@|$(PREFIX)|g" systemd.units/onedrive.service.in > onedrive.service
|
2018-04-14 00:29:31 +02:00
|
|
|
sed "s|@PREFIX@|$(PREFIX)|g" systemd.units/onedrive@.service.in > onedrive@.service
|
2015-09-22 14:49:20 +02:00
|
|
|
|
2018-12-01 21:41:01 +01:00
|
|
|
onedrive.1: onedrive.1.in
|
|
|
|
sed "s|@DOCDIR@|$(DOCDIR)|g" onedrive.1.in > onedrive.1
|
|
|
|
|
2015-09-22 14:49:20 +02:00
|
|
|
uninstall:
|
2017-05-29 01:37:09 +02:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/onedrive
|
2018-08-27 02:35:58 +02:00
|
|
|
rm -f $(DESTDIR)/etc/logrotate.d/onedrive
|
|
|
|
ifeq ($(RHEL),1)
|
2019-01-19 03:01:01 +01:00
|
|
|
ifeq ($(RHEL_VERSION),6)
|
|
|
|
rm -f $(DESTDIR)/etc/init.d/onedrive
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/onedrive_service.sh
|
|
|
|
else
|
2018-10-07 04:10:41 +02:00
|
|
|
rm -f $(DESTDIR)/usr/lib/systemd/system/onedrive*.service
|
2019-01-19 03:01:01 +01:00
|
|
|
endif
|
2018-08-27 02:35:58 +02:00
|
|
|
else
|
2017-05-29 01:37:09 +02:00
|
|
|
rm -f $(DESTDIR)/usr/lib/systemd/user/onedrive.service
|
2018-10-07 04:10:41 +02:00
|
|
|
rm -f $(DESTDIR)/usr/lib/systemd/system/onedrive@.service
|
2018-08-27 02:35:58 +02:00
|
|
|
endif
|
2018-12-01 21:41:01 +01:00
|
|
|
for i in $(DOCFILES) ; do rm -f $(DESTDIR)$(DOCDIR)/$$i ; done
|
|
|
|
rm -f $(DESTDIR)$(MANDIR)/onedrive.1
|
2017-07-14 11:31:16 +02:00
|
|
|
|
2019-03-19 03:14:07 +01:00
|
|
|
version:
|
|
|
|
ifeq ($(gitversion),1)
|
2019-01-19 03:01:01 +01:00
|
|
|
echo $(shell git describe --tags) > version
|
2019-03-19 03:14:07 +01:00
|
|
|
else
|
|
|
|
echo $(RELEASEVER) > version
|
2019-03-25 23:40:07 +01:00
|
|
|
endif
|