summaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile42
1 files changed, 42 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..24bc614
--- /dev/null
+++ b/makefile
@@ -0,0 +1,42 @@
+bin:=$(notdir $(shell pwd))
+src:=$(wildcard *.c)
+obj:=$(src:.c=.o)
+
+libs:=\
+ libva \
+ libva-drm \
+ mfx \
+ wayland-client
+
+protocols_dir:=\
+ /usr/share/wayland-protocols
+
+protocols:=\
+ linux-dmabuf-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)