-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathMakefile
32 lines (22 loc) · 1020 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
CFLAGS ?= -std=c11 -Wall -Wextra -Werror -Wno-unused-parameter -g
PKG_CONFIG ?= pkg-config
# Host deps
WAYLAND_FLAGS = $(shell $(PKG_CONFIG) wayland-client --cflags --libs)
WAYLAND_PROTOCOLS_DIR = $(shell $(PKG_CONFIG) wayland-protocols --variable=pkgdatadir)
# Build deps
WAYLAND_SCANNER = $(shell pkg-config --variable=wayland_scanner wayland-scanner)
XDG_SHELL_PROTOCOL = $(WAYLAND_PROTOCOLS_DIR)/stable/xdg-shell/xdg-shell.xml
HEADERS=cat.h xdg-shell-client-protocol.h shm.h
SOURCES=main.c xdg-shell-protocol.c shm.c
all: hello-wayland
hello-wayland: $(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
cat.h: cat.png
convert cat.png -define h:format=bgra -depth 8 cat.h
.PHONY: clean
clean:
$(RM) hello-wayland cat.h xdg-shell-protocol.c xdg-shell-client-protocol.h