CFLAGS = -g -Wall -Wextra -Wno-unused-parameter WAYLAND_PROTOCOLS_DIR = $(shell pkg-config wayland-protocols --variable=pkgdatadir) WAYLAND_SCANNER = $(shell pkg-config --variable=wayland_scanner wayland-scanner) deps = libavcodec libavformat libavutil libdrm wayland-client xcb libva depflags = $(shell pkg-config $(deps) --cflags --libs) gamescope_xwayland_protocol = gamescope-xwayland.xml linux_dmabuf_unstable_v1_protocol = $(WAYLAND_PROTOCOLS_DIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml protocol_files = gamescope-xwayland-client-protocol.h gamescope-xwayland-protocol.c \ linux-dmabuf-unstable-v1-client-protocol.h linux-dmabuf-unstable-v1-protocol.c all: vaapi-decoder vaapi-decoder: main.c $(protocol_files) $(CC) $(CFLAGS) $(depflags) -o $@ $^ gamescope-xwayland-client-protocol.h: $(gamescope_xwayland_protocol) $(WAYLAND_SCANNER) client-header $< $@ gamescope-xwayland-protocol.c: $(gamescope_xwayland_protocol) $(WAYLAND_SCANNER) private-code $< $@ linux-dmabuf-unstable-v1-client-protocol.h: $(linux_dmabuf_unstable_v1_protocol) $(WAYLAND_SCANNER) client-header $< $@ linux-dmabuf-unstable-v1-protocol.c: $(linux_dmabuf_unstable_v1_protocol) $(WAYLAND_SCANNER) private-code $< $@ clean: $(RM) vaapi-decoder $(protocol_files)