9999endif
100100
101101ifeq ($(WAYLAND ) ,1)
102+ WAYLAND_SOURCE = $(shell make -f wayland.mk sources -s)
103+
102104 NO_VULKAN = 1
103105 NO_GLES = 0
104106 NO_EGL = 0
105- LIBS += -D RGFW_WAYLAND relative-pointer-unstable-v1.c pointer-constraints-unstable-v1.c xdg-toplevel-icon-v1.c xdg-output-unstable-v1.c xdg-decoration-unstable-v1.c xdg-shell.c -lwayland-cursor -lwayland-client -lxkbcommon -lwayland-egl -lEGL -lm
107+ LIBS += -D RGFW_WAYLAND $(WAYLAND_SOURCE) -lwayland-cursor -lwayland-client -lxkbcommon -lwayland-egl -lEGL -lm
106108 LINK_GL1 = -lEGL -lGL
107109
108110 # LIBS += -ldecor-0
@@ -191,37 +193,37 @@ TEST_OUTPUTS = \
191193 tests/loop \
192194
193195
194- all : xdg-shell.c $(EXAMPLE_OUTPUTS ) $(EXAMPLE_OUTPUTS_CUSTOM ) libRGFW$(LIB_EXT ) libRGFW.a
196+ all : $( WAYLAND_SOURCE ) $(EXAMPLE_OUTPUTS ) $(EXAMPLE_OUTPUTS_CUSTOM ) libRGFW$(LIB_EXT ) libRGFW.a
195197
196- examples : xdg-shell.c $(EXAMPLE_OUTPUTS ) $(EXAMPLE_OUTPUTS_CUSTOM )
198+ examples : $( WAYLAND_SOURCE ) $(EXAMPLE_OUTPUTS ) $(EXAMPLE_OUTPUTS_CUSTOM )
197199
198- tests : xdg-shell.c $(TEST_OUTPUTS )
200+ tests : $( WAYLAND_SOURCE ) $(TEST_OUTPUTS )
199201
200- examples/gears/gears : examples/gears/gears.c RGFW.h xdg-shell.c
202+ examples/gears/gears : examples/gears/gears.c RGFW.h $( WAYLAND_SOURCE )
201203ifneq (,$(filter $(CC ) ,emcc em++) )
202204 @echo gears is not supported on this platform
203205else
204206 $(CC) $(CFLAGS) -I. $< $(LINK_GL1) $(LIBS) -lm $($) -o $@$(EXT)
205207endif
206208
207- examples/srgb/srgb : examples/srgb/srgb.c RGFW.h xdg-shell.c
209+ examples/srgb/srgb : examples/srgb/srgb.c RGFW.h $( WAYLAND_SOURCE )
208210 $(CC ) $(CFLAGS ) -I. $< $(LINK_GL1 ) $(LIBS ) -lm $($ ) -o $@ $(EXT )
209211
210- examples/portableGL/pgl : examples/portableGL/pgl.c RGFW.h xdg-shell.c
212+ examples/portableGL/pgl : examples/portableGL/pgl.c RGFW.h $( WAYLAND_SOURCE )
211213ifeq (,$(filter $(CC ) ,emcc em++) )
212214 $(CC) -w $(CFLAGS) -I. $< -lm $(LIBS) -o $@
213215else
214216 @echo "the portableGL example doesn't support html5"
215217endif
216218
217- examples/gles2/gles2 : examples/gles2/gles2.c RGFW.h xdg-shell.c
219+ examples/gles2/gles2 : examples/gles2/gles2.c RGFW.h $( WAYLAND_SOURCE )
218220ifneq ($(NO_GLES ) , 1)
219221 $(CC) $(CFLAGS) -I. $< $(LIBS) $(LINK_GL2) -lGL -o $@$(EXT)
220222else
221223 @echo gles has been disabled
222224endif
223225
224- examples/egl/egl : examples/egl/egl.c RGFW.h xdg-shell.c
226+ examples/egl/egl : examples/egl/egl.c RGFW.h $( WAYLAND_SOURCE )
225227ifneq ($(NO_EGL ) , 1)
226228 $(CC) $(CFLAGS) -I. $< $(LIBS) $(LINK_GL1) -lGL -lEGL -o $@$(EXT)
227229else
@@ -230,15 +232,15 @@ endif
230232
231233
232234
233- examples/osmesa_demo/osmesa_demo : examples/osmesa_demo/osmesa_demo.c RGFW.h xdg-shell.c
235+ examples/osmesa_demo/osmesa_demo : examples/osmesa_demo/osmesa_demo.c RGFW.h $( WAYLAND_SOURCE )
234236ifneq ($(NO_OSMESA ) , 1)
235237 $(CC) $(CFLAGS) -I. $< $(LIBS) $(LINK_OSMESA) -lOSMesa -o $@$(EXT)
236238else
237239 @echo osmesa has been disabled
238240endif
239241
240242
241- examples/vk10/vk10 : examples/vk10/vk10.c examples/vk10/vkinit.h RGFW.h xdg-shell.c
243+ examples/vk10/vk10 : examples/vk10/vk10.c examples/vk10/vkinit.h RGFW.h $( WAYLAND_SOURCE )
242244ifneq ($(NO_VULKAN ) , 1)
243245 glslangValidator -V examples/vk10/shaders/vert.vert -o examples/vk10/shaders/vert.h --vn vert_code
244246 glslangValidator -V examples/vk10/shaders/frag.frag -o examples/vk10/shaders/frag.h --vn frag_code
255257 $(CC) $(CFLAGS) -I. $< $(LIBS) $(LINK_GL1) $(DX11_LIBS) -D RGFW_NO_VULKAN -o $@
256258endif
257259
258- examples/dx11/dx11 : examples/dx11/dx11.c RGFW.h xdg-shell.c
260+ examples/dx11/dx11 : examples/dx11/dx11.c RGFW.h $( WAYLAND_SOURCE )
259261ifeq ($(CC ) , zig cc)
260262 @echo directX is not supported with Zig
261263else ifneq (,$(filter $(CC),g++ clang++ "zig cc"))
@@ -267,14 +269,14 @@ else
267269endif
268270
269271
270- examples/metal/metal : examples/metal/metal.m RGFW.h xdg-shell.c
272+ examples/metal/metal : examples/metal/metal.m RGFW.h $( WAYLAND_SOURCE )
271273ifeq ($(detected_OS ) ,Darwin) # Mac OS X
272274 $(CC) $(CFLAGS) examples/metal/metal.m -I. -framework CoreVideo -framework Metal -framework Cocoa -framework IOKit -framework QuartzCore -o $@
273275else
274276 @echo metal is not supported on $(detected_OS)
275277endif
276278
277- examples/minimal_links/minimal_links : examples/minimal_links/minimal_links.c RGFW.h xdg-shell.c
279+ examples/minimal_links/minimal_links : examples/minimal_links/minimal_links.c RGFW.h $( WAYLAND_SOURCE )
278280ifeq ($(WAYLAND ) , 1)
279281 @echo nostl is not supported on this platform
280282else ifneq (,$(filter $(CC),emcc em++))
292294endif
293295
294296
295- examples/nostl/nostl : examples/nostl/nostl.c RGFW.h xdg-shell.c
297+ examples/nostl/nostl : examples/nostl/nostl.c RGFW.h $( WAYLAND_SOURCE )
296298ifeq ($(WAYLAND ) , 1)
297299 @echo nostl is not supported on this platform
298300else ifneq (,$(filter $(CC),emcc em++))
308310endif
309311
310312
311- examples/microui_demo/microui_demo : examples/microui_demo/microui_demo.c RGFW.h xdg-shell.c
313+ examples/microui_demo/microui_demo : examples/microui_demo/microui_demo.c RGFW.h $( WAYLAND_SOURCE )
312314ifeq (,$(filter $(CC ) ,emcc em++ g++ clang++) )
313315 $(CC) $(CFLAGS) -I. $< examples/microui_demo/microui.c $(LINK_GL1) $(LIBS) -o $@$(EXT)
314316else ifneq (,$(filter $(CC),em++ g++ clang++))
@@ -317,18 +319,18 @@ else
317319 $(CC) $(CFLAGS) -I. $< examples/microui_demo/microui.c -s USE_WEBGL2 $(LIBS) $(LINK_GL1) -o $@$(EXT)
318320endif
319321
320- examples/window_icons/icons : examples/window_icons/icons.c RGFW.h xdg-shell.c
322+ examples/window_icons/icons : examples/window_icons/icons.c RGFW.h $( WAYLAND_SOURCE )
321323 $(CC ) $(CFLAGS ) -I. $< $(LIBS ) -lm $(LINK_GL1 ) -o $@ $(EXT )
322- examples/mouse_icons/icons : examples/mouse_icons/icons.c RGFW.h xdg-shell.c
324+ examples/mouse_icons/icons : examples/mouse_icons/icons.c RGFW.h $( WAYLAND_SOURCE )
323325 $(CC ) $(CFLAGS ) -I. $< $(LIBS ) -lm $(LINK_GL1 ) -o $@ $(EXT )
324- examples/gamepad/gamepad : examples/gamepad/gamepad.c RGFW.h xdg-shell.c
326+ examples/gamepad/gamepad : examples/gamepad/gamepad.c RGFW.h $( WAYLAND_SOURCE )
325327 $(CC ) $(CFLAGS ) -I. $< $(LIBS ) -lm $(LINK_GL1 ) -o $@ $(EXT )
326328
327- examples/first-person-camera/camera : examples/first-person-camera/camera.c RGFW.h xdg-shell.c
329+ examples/first-person-camera/camera : examples/first-person-camera/camera.c RGFW.h $( WAYLAND_SOURCE )
328330 $(CC ) $(CFLAGS ) -I. $< $(LIBS ) -lm $(LINK_GL1 ) -o $@ $(EXT )
329331
330332
331- examples/gl33/gl33 : examples/gl33/gl33.c RGFW.h xdg-shell.c
333+ examples/gl33/gl33 : examples/gl33/gl33.c RGFW.h $( WAYLAND_SOURCE )
332334ifeq ($(WAYLAND ) , 1)
333335 $(CC) $(CFLAGS) $(WARNINGS) -I. $< -lm $(LIBS) $(LINK_GL1) -lEGL -lwayland-egl -o $@$(EXT)
334336else ifeq ($(detected_OS),NetBSD)
@@ -343,10 +345,10 @@ else
343345 $(CC) $(CFLAGS) $(WARNINGS) -I. $< $(LIBS) $(LINK_GL3) -o $@$(EXT)
344346endif
345347
346- $(EXAMPLE_OUTPUTS ) : % : % .c RGFW.h xdg-shell.c
348+ $(EXAMPLE_OUTPUTS ) : % : % .c RGFW.h $( WAYLAND_SOURCE )
347349 $(CC ) $(CFLAGS ) $(WARNINGS ) -I. $< $(LINK_GL1 ) $(LIBS ) $($ ) -o $@ $(EXT )
348350
349- $(TEST_OUTPUTS ) : % : % .c RGFW.h xdg-shell.c
351+ $(TEST_OUTPUTS ) : % : % .c RGFW.h $( WAYLAND_SOURCE )
350352 $(CC ) $(CFLAGS ) $(WARNINGS ) -I. $< $(LINK_GL1 ) $(LIBS ) $($ ) -o $@ $(EXT )
351353 @for exe in $(TEST_OUTPUTS ) ; do \
352354 echo " Running $$ exe..." ; \
@@ -379,7 +381,7 @@ endif
379381 $(MAKE) clean
380382
381383
382- RGFW$(OBJ_FILE ) : RGFW.h xdg-shell.c
384+ RGFW$(OBJ_FILE ) : RGFW.h $( WAYLAND_SOURCE )
383385 # $(CC) -x c $(CUSTOM_CFLAGS) -c RGFW.h -D RGFW_IMPLEMENTATION -fPIC -D RGFW_EXPORT
384386 cp RGFW.h RGFW.c
385387 $(CC ) $(CUSTOM_CFLAGS ) -c RGFW.c -D RGFW_IMPLEMENTATION -fPIC -D RGFW_EXPORT
@@ -397,9 +399,11 @@ libRGFW.a: RGFW.h RGFW$(OBJ_FILE)
397399 $(MAKE ) RGFW$(OBJ_FILE )
398400 $(AR ) rcs libRGFW.a RGFW$(OBJ_FILE )
399401
400- xdg-shell.c :
401402ifeq ($(WAYLAND ) ,1)
403+
404+ $(WAYLAND_SOURCE ) : % .c:
402405 $(MAKE ) -f wayland.mk
406+
403407endif
404408
405409
0 commit comments