-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (50 loc) · 1.81 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
PROGNAME ?= smpcp
DAEMON ?= smpcpd
SERVICE ?= smpcpd.service
PREFIX ?= $(HOME)/.local
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
SYSDUNIT ?= $(HOME)/.config/systemd/user
SHAREDIR ?= $(PREFIX)/share
MANDIR1 ?= $(SHAREDIR)/man/man1
MANDIR5 ?= $(SHAREDIR)/man/man5
ASSETSDIR ?= $(SHAREDIR)/$(PROGNAME)/assets
BASHCOMP ?= $(SHAREDIR)/bash-completion/completions
ZSHCOMP ?= $(SHAREDIR)/zsh/functions/Completion/Unix
MANPAGE1 = $(PROGNAME).1
MANPAGE5 = $(PROGNAME).conf.5
CC = gcc
LIBS = -lmpdclient
.PHONY: install
install:src/$(PROGNAME)
install:src/$(DAEMON)
install -d $(BINDIR)
install -m755 src/$(PROGNAME) $(BINDIR)/$(PROGNAME)
install -m755 src/$(DAEMON) $(BINDIR)/$(DAEMON)
${CC} src/idle.c $(LIBS) -o src/idlecmd
install -m755 src/idlecmd $(BINDIR)
install -m644 $(SERVICE) $(SYSDUNIT)/$(SERVICE)
install -Dm644 src/lib/*.* -t $(LIBDIR)/$(PROGNAME)
install -Dm644 smpcp.conf -t $(SHAREDIR)/$(PROGNAME)
install -Dm644 assets/*.* -t $(ASSETSDIR)/
install -Dm644 $(MANPAGE1) -t $(MANDIR1)
install -Dm644 $(MANPAGE5) -t $(MANDIR5)
install -Dm644 LICENSE -t $(SHAREDIR)/licenses/$(PROGNAME)
if [ $$(basename $$SHELL) == "bash" ]; then install -Dm644 autocomplete/bash-smpcp-complete $(BASHCOMP)/$(PROGNAME); fi
if [ $$(basename $$SHELL) == "zsh" ]; then install -Dm644 autocomplete/zsh-smpcp-complete $(ZSHCOMP)/_$(PROGNAME); fi
rm src/$(PROGNAME)
rm src/$(DAEMON)
rm src/idlecmd
.PHONY: uninstall
uninstall:
rm $(BINDIR)/$(PROGNAME)
rm $(BINDIR)/$(DAEMON)
rm $(BINDIR)/idlecmd
rm $(SYSDUNIT)/$(SERVICE)
rm -rf $(LIBDIR)/$(PROGNAME)
rm -rf $(SHAREDIR)/$(PROGNAME)
rm $(MANDIR1)/$(MANPAGE1)
rm $(MANDIR5)/$(MANPAGE5)
rm -rf $(SHAREDIR)/licenses/$(PROGNAME)
if [ -d $(BASHCOMP) ]; then rm $(BASHCOMP)/$(PROGNAME); fi
if [ -d $(ZSHCOMP) ]; then rm $(ZSHCOMP)/_$(PROGNAME); fi