# Makefile CXX = g++ CXXFLAGS = -Wall -g -std=c++17 LIBS = $(shell pkg-config --cflags --libs wayland-client wayland-egl egl glesv2 xkbcommon) # Wayland protocols WAYLAND_PROTOCOLS_DIR = $(shell pkg-config --variable=pkgdatadir wayland-protocols) WAYLAND_SCANNER = $(shell pkg-config --variable=wayland_scanner wayland-scanner) XDG_SHELL_XML = $(WAYLAND_PROTOCOLS_DIR)/stable/xdg-shell/xdg-shell.xml all: shader-demo # Generate code from xml xdg-shell-protocol.c: $(WAYLAND_SCANNER) private-code < $(XDG_SHELL_XML) > $@ xdg-shell-client-protocol.h: $(WAYLAND_SCANNER) client-header < $(XDG_SHELL_XML) > $@ # Compile rule OBJS = main.o xdg-shell-protocol.o %.o: %.c $(CC) -c -o $@ $< $(CFLAGS) main.o: main.cpp xdg-shell-client-protocol.h $(CXX) -c -o $@ $< $(CXXFLAGS) shader-demo: $(OBJS) $(CXX) -o $@ $(OBJS) $(LIBS) clean: rm -f shader-demo *.o xdg-shell-protocol.c xdg-shell-client-protocol.h