#Makefile for Wayland, included into main Makefile

#Authors: Bernd Paysan
#Copyright (C) 2023 Free Software Foundation, Inc.

#This file is part of Gforth.

#Gforth is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation, either version 3
#of the License, or (at your option) any later version.

#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with this program. If not, see http://www.gnu.org/licenses/.

WAYLAND_PROTOCOLS = text-input-unstable-v3 xdg-shell \
	xdg-decoration-unstable-v1 primary-selection-unstable-v1 \
	tablet-unstable-v2

WAYLAND_INCLUDE = $(patsubst %, wayland/%-client.h, $(WAYLAND_PROTOCOLS)) \
	$(patsubst %, wayland/%.c, $(WAYLAND_PROTOCOLS))

unix/wayland.fs: $(WAYLAND_INCLUDE)

vpath %.xml $(shell find $(WAYLAND_PROTOCOLS_DATADIR) -type d)

wayland/%-client.h: %.xml
	$(WAYLAND_SCANNER) client-header <$< >$@

wayland/%.c: %.xml
	$(WAYLAND_SCANNER) private-code <$< >$@
