summaryrefslogtreecommitdiff
path: root/makefile
blob: 367c04f209ad86b43d5b33b0b2fded7682f7a211 (plain)
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
bin:=$(notdir $(shell pwd))
src:=$(wildcard *.c)
obj:=$(src:.c=.o)

obj+=\
	toolbox/buffer.o

libs:=\
	libva \
	libva-drm \
	mfx \
	wayland-client

protocols_dir:=\
	/usr/share/wayland-protocols

protocols:=\
	linux-dmabuf-unstable-v1 \
	pointer-constraints-unstable-v1 \
	relative-pointer-unstable-v1 \
	xdg-shell

obj:=$(patsubst %,%.o,$(protocols)) $(obj)
headers:=$(patsubst %,%.h,$(protocols))
CFLAGS+=$(shell pkg-config --cflags $(libs))
LDFLAGS+=$(shell pkg-config --libs $(libs))

all: $(bin)

$(bin): $(obj)
	$(CC) $^ $(LDFLAGS) -o $@

%.o: %.c *.h $(headers)
	$(CC) -c $< $(CFLAGS) -o $@

%.h: $(protocols_dir)/*/*/%.xml
	wayland-scanner client-header $< $@

%.c: $(protocols_dir)/*/*/%.xml
	wayland-scanner private-code $< $@

clean:
	-rm $(bin) $(obj) $(headers)

.PHONY: all clean

.PRECIOUS: $(headers)