makefile does wayland-scanner stuff

This commit is contained in:
Rakarake 2025-12-17 17:03:01 +01:00
parent dc791e3481
commit 27b66bec0a
6 changed files with 554 additions and 143 deletions

View file

@ -1,15 +1,26 @@
LIBS=sdl3 opengl wayland-client
CFLAGS=-g -Wall -Wextra $(shell pkg-config --cflags $(LIBS))
LDFLAGS=$(shell pkg-config --libs $(LIBS))
CFLAGS+=-g -Wall -Wextra $(shell pkg-config --cflags $(LIBS))
LDLIBS+=$(shell pkg-config --libs $(LIBS))
objects = renderer.o
WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols)
WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner)
glonkers: $(objects) glonkers.c
$(CC) $(CFLAGS) $(LDFLAGS) -o glonkers $^
glonkers: wlr-layer-shell-unstable-v1-protocol.o xdg-shell-protocol.o renderer.o
glonkers.o: wlr-layer-shell-unstable-v1-protocol.h xdg-shell-protocol.h renderer.h
renderer.o: renderer.h
$(objects): %.o: %.c
$(CC) $(CFLAGS) $(LDFLAGS) -c $^ -o $@
xdg-shell-protocol.h:
$(WAYLAND_SCANNER) client-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.c:
$(WAYLAND_SCANNER) private-code $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.o: xdg-shell-protocol.h
wlr-layer-shell-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) client-header protocols/wlr-layer-shell-unstable-v1.xml $@
wlr-layer-shell-unstable-v1-protocol.c:
$(WAYLAND_SCANNER) private-code protocols/wlr-layer-shell-unstable-v1.xml $@
wlr-layer-shell-unstable-v1-protocol.o: wlr-layer-shell-unstable-v1-protocol.h
clean:
rm -f *.o glonkers
rm -f *.o *xdg *wlr glonkers