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 DFLAGS = -ofonedrive -L-lcurl -L-lsqlite3 -L-ldl
DESTDIR = /usr/local/bin PREFIX = /usr/local
SOURCES = \ SOURCES = \
src/config.d \ src/config.d \
@ -16,22 +15,27 @@ SOURCES = \
src/upload.d \ src/upload.d \
src/util.d src/util.d
all: onedrive onedrive.service
onedrive: $(SOURCES) 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) debug: $(SOURCES)
$(DC) -debug -g -gs $(DFLAGS) $(SOURCES) dmd -debug -g -gs $(DFLAGS) $(SOURCES)
unittest: $(SOURCES) unittest: $(SOURCES)
$(DC) -unittest -debug -g -gs $(DFLAGS) $(SOURCES) dmd -debug -g -gs -unittest $(DFLAGS) $(SOURCES)
clean: clean:
rm -f onedrive.o onedrive rm -f onedrive onedrive.o onedrive.service
install: onedrive onedrive.service install: all
install onedrive $(DESTDIR)/onedrive install -D onedrive $(DESTDIR)$(PREFIX)/bin/onedrive
install -m 644 onedrive.service /usr/lib/systemd/user install -D -m 644 onedrive.service $(DESTDIR)/usr/lib/systemd/user
uninstall: uninstall:
rm -f $(DESTDIR)/onedrive rm -f $(DESTDIR)$(PREFIX)/bin/onedrive
rm -f /usr/lib/systemd/user/onedrive.service 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 Documentation=https://github.com/skilion/onedrive
[Service] [Service]
ExecStart=/usr/local/bin/onedrive -m ExecStart=@PREFIX@/bin/onedrive -m
Restart=no Restart=no
[Install] [Install]