-CFLAGS += -Wall -g $(shell pkg-config --cflags libffi libdrm)
-LDLIBS += $(shell pkg-config --libs libffi libdrm)
+include config.mk
-clients = flower pointer background window
+subdirs = wayland compositor clients spec data
-all : wayland $(clients)
+all : subdirs-all
-wayland_objs = wayland.o event-loop.o connection.o hash.o input.o egl-compositor.o
-wayland : CFLAGS += -I../eagle
-wayland : LDLIBS += -L../eagle -leagle -ldl
+subdirs-all subdirs-clean subdirs-install:
+ for f in $(subdirs); do $(MAKE) -C $$f $(@:subdirs-%=%); done
-wayland : $(wayland_objs)
- gcc -o $@ $(LDLIBS) $(wayland_objs)
+install : subdirs-install
-libwayland_objs = wayland-client.o connection.o
+clean : subdirs-clean
-libwayland.so : $(libwayland_objs)
- gcc -o $@ $(libwayland_objs) -shared
-
-flower_objs = flower.o
-pointer_objs = pointer.o
-background_objs = background.o
-window_objs = window.o
-
-$(clients) : CFLAGS += $(shell pkg-config --cflags cairo)
-$(clients) : LDLIBS += $(shell pkg-config --libs cairo gdk-pixbuf-2.0) -lrt
-
-background : CFLAGS += $(shell pkg-config --cflags gdk-pixbuf-2.0)
-background : LDLIBS += $(shell pkg-config --libs gdk-pixbuf-2.0)
-
-define client_template
-$(1): $$($(1)_objs) libwayland.so
-endef
-
-$(foreach c,$(clients),$(eval $(call client_template,$(c))))
-
-$(clients) :
- gcc -o $@ -L. -lwayland $(LDLIBS) $^
-
-clean :
- rm -f $(clients) wayland *.o libwayland.so
\ No newline at end of file
+config.mk : config.mk.in
+ ./config.status