-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
34 lines (26 loc) · 805 Bytes
/
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
TARGET = lib/mpv_inhibit_gnome.so
SRC_DIR = src
XDG_CONFIG_DIR := $(or $(XDG_CONFIG_HOME),$(HOME)/.config)
LDFLAGS += $(shell pkg-config --libs dbus-1)
CFLAGS += -Wall $(shell pkg-config --cflags dbus-1)
SRCS := $(shell find $(SRC_DIR) -name *.c)
OBJS := $(patsubst src/%.c,build/%.o,$(SRCS))
$(TARGET): $(OBJS)
-@mkdir -p $(@D)
gcc $^ -o $@ $(CFLAGS) -shared $(LDFLAGS)
build/%.o: src/%.c
-@mkdir -p $(@D)
gcc -c $< -o $@ $(CFLAGS) -fPIC $(LDFLAGS)
define INSTALL_PLUGIN
.PHONY: $(1) $(2)
$(1): $$(TARGET)
install -Dt "$(3)" $$<
$(2):
-rm -f "$(3)/$$(notdir $$(TARGET))"
endef
$(eval $(call INSTALL_PLUGIN,install,uninstall,$(XDG_CONFIG_DIR)/mpv/scripts))
$(eval $(call INSTALL_PLUGIN,sys-install,sys-uninstall,/usr/share/mpv/scripts))
.PHONY: clean
clean:
-rm -rf build
-rm -f $(TARGET)