WAYLAND_FLAGS = $(shell pkg-config wayland-client --cflags --libs) WAYLAND_PROTOCOLS_DIR = $(shell pkg-config wayland-protocols --variable=pkgdatadir) WAYLAND_SCANNER = $(shell pkg-config --variable=wayland_scanner wayland-scanner) CFLAGS ?= -std=c11 -Wall -Wextra -Werror -Wno-unused-parameter -ggdb XDG_SHELL_PROTOCOL = $(WAYLAND_PROTOCOLS_DIR)/stable/xdg-shell/xdg-shell.xml XDG_DECORATION_PROTOCOL = $(WAYLAND_PROTOCOLS_DIR)/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml HEADERS=xdg-shell-client-protocol.h xdg-decoration-client-protocol.h SOURCES=surface.c xdg-shell-protocol.c xdg-decoration-protocol.c all: surface surface: $(HEADERS) $(SOURCES) $(CC) $(CFLAGS) -o $@ $(SOURCES) -lrt $(WAYLAND_FLAGS) xdg-shell-client-protocol.h: $(WAYLAND_SCANNER) client-header $(XDG_SHELL_PROTOCOL) xdg-shell-client-protocol.h xdg-shell-protocol.c: $(WAYLAND_SCANNER) private-code $(XDG_SHELL_PROTOCOL) xdg-shell-protocol.c xdg-decoration-client-protocol.h: $(WAYLAND_SCANNER) client-header $(XDG_DECORATION_PROTOCOL) xdg-decoration-client-protocol.h xdg-decoration-protocol.c: $(WAYLAND_SCANNER) private-code $(XDG_DECORATION_PROTOCOL) xdg-decoration-protocol.c .PHONY: clean clean: $(RM) surface \ xdg-shell-protocol.c xdg-shell-client-protocol.h \ xdg-decoration-protocol.c xdg-decoration-client-protocol.h