-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
57 lines (44 loc) · 1.32 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
54
55
56
57
CFLAGS += -Wall -Wextra -Wpedantic -fPIC -O3
ASAP = asap-6.0.0
INSTALL := install -m664
MKDIR := mkdir
RMDIR := rmdir
LN := ln
RM := rm
PLUGINDIR := $(PREFIX)/lib/mpv-mpris
PREFIX := /usr/local
SYS_SCRIPTS_DIR := /etc/mpv/scripts
USR_SCRIPTS_DIR := $(HOME)/.config/mpv/scripts
.PHONY: clean install-system install-user \
uninstall-system uninstall-user
mpv-sap.so: asap.o mpv-sap.o
$(LD) -shared -o $@ $^
asap.o: $(ASAP)/asap.c $(ASAP)/asap.h
$(CC) $(CFLAGS) -c -o $@ $<
mpv-sap.o: mpv-sap.c $(ASAP)/asap.h
$(CC) $(CFLAGS) -DASAP_H='"$(ASAP)/asap.h"' -c -o $@ $<
ifneq ($(shell id -u),0)
install: install-user
uninstall: uninstall-user
else
install: install-system
uninstall: uninstall-system
endif
install-user: mpv-sap.so
$(MKDIR) -p $(USR_SCRIPTS_DIR)
$(INSTALL) mpv-sap.so $(USR_SCRIPTS_DIR)/sap.so
uninstall-user:
$(RM) -f $(USR_SCRIPTS_DIR)/sap.so
$(RMDIR) -p $(USR_SCRIPTS_DIR)
install-system: mpv-sap.so
$(MKDIR) -p $(DESTDIR)$(PLUGINDIR)
$(INSTALL) mpv-sap.so $(DESTDIR)$(PLUGINDIR)/sap.so
$(MKDIR) -p $(DESTDIR)$(SYS_SCRIPTS_DIR)
$(LN) -s $(PLUGINDIR)/sap.so $(DESTDIR)$(SYS_SCRIPTS_DIR)
uninstall-system:
$(RM) -f $(DESTDIR)$(SYS_SCRIPTS_DIR)/sap.so
$(RMDIR) -p $(DESTDIR)$(SYS_SCRIPTS_DIR)
$(RM) -f $(DESTDIR)$(PLUGINDIR)/sap.so
$(RMDIR) -p $(DESTDIR)$(PLUGINDIR)
clean:
rm -rf asap.o mpv-sap.o mpv-sap.so