added DESTDIR and PREFIX

This commit is contained in:
skilion 2017-05-29 01:37:09 +02:00
parent c2815d6498
commit 83a958df59
2 changed files with 16 additions and 12 deletions

View file

@ -1,6 +1,5 @@
DC = dmd
DFLAGS = -ofonedrive -L-lcurl -L-lsqlite3 -L-ldl
DESTDIR = /usr/local/bin
PREFIX = /usr/local
SOURCES = \
src/config.d \
@ -16,22 +15,27 @@ SOURCES = \
src/upload.d \
src/util.d
all: onedrive onedrive.service
onedrive: $(SOURCES)
$(DC) -O -release -inline -boundscheck=off $(DFLAGS) $(SOURCES)
dmd -g -inline -O -release $(DFLAGS) $(SOURCES)
onedrive.service:
sed "s|@PREFIX@|$(PREFIX)|g" onedrive.service.in > onedrive.service
debug: $(SOURCES)
$(DC) -debug -g -gs $(DFLAGS) $(SOURCES)
dmd -debug -g -gs $(DFLAGS) $(SOURCES)
unittest: $(SOURCES)
$(DC) -unittest -debug -g -gs $(DFLAGS) $(SOURCES)
dmd -debug -g -gs -unittest $(DFLAGS) $(SOURCES)
clean:
rm -f onedrive.o onedrive
rm -f onedrive onedrive.o onedrive.service
install: onedrive onedrive.service
install onedrive $(DESTDIR)/onedrive
install -m 644 onedrive.service /usr/lib/systemd/user
install: all
install -D onedrive $(DESTDIR)$(PREFIX)/bin/onedrive
install -D -m 644 onedrive.service $(DESTDIR)/usr/lib/systemd/user
uninstall:
rm -f $(DESTDIR)/onedrive
rm -f /usr/lib/systemd/user/onedrive.service
rm -f $(DESTDIR)$(PREFIX)/bin/onedrive
rm -f $(DESTDIR)/usr/lib/systemd/user/onedrive.service

View file

@ -3,7 +3,7 @@ Description=OneDrive Free Client
Documentation=https://github.com/skilion/onedrive
[Service]
ExecStart=/usr/local/bin/onedrive -m
ExecStart=@PREFIX@/bin/onedrive -m
Restart=no
[Install]