Use autoconf instead of $(shell ...) in the Makefile.
authorKristian Høgsberg <krh@redhat.com>
Fri, 5 Dec 2008 03:48:50 +0000 (22:48 -0500)
committerKristian Høgsberg <krh@redhat.com>
Fri, 5 Dec 2008 04:00:01 +0000 (23:00 -0500)
.gitignore
Makefile [deleted file]
Makefile.in [new file with mode: 0644]
configure.ac [new file with mode: 0644]

index 66f62c6..85c3649 100644 (file)
@@ -7,3 +7,8 @@ screenshot
 *.jpg
 *.png
 *~
+aclocal.m4
+autom4te.cache/
+config.log
+config.status
+configure
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index c0ad067..0000000
--- a/Makefile
+++ /dev/null
@@ -1,66 +0,0 @@
-CFLAGS = -Wall -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden
-
-PKG_CONFIG_PATH ?= $(HOME)/install/lib/pkgconfig
-
-EAGLE_CFLAGS = $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --cflags eagle)
-EAGLE_LDLIBS = $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs eagle)
-
-clients = flower window screenshot
-compositors = egl-compositor.so glx-compositor.so
-
-all : wayland libwayland.so $(compositors) $(clients)
-
-wayland_objs =                                 \
-       wayland.o                               \
-       event-loop.o                            \
-       connection.o                            \
-       wayland-util.o
-
-wayland : CFLAGS += $(shell pkg-config --cflags libffi)
-wayland : LDLIBS += $(shell pkg-config --libs libffi) -ldl -rdynamic
-
-wayland : $(wayland_objs)
-       gcc -o $@ $(LDLIBS) $(wayland_objs)
-
-libwayland_objs = wayland-client.o connection.o wayland-util.o
-
-libwayland.so : $(libwayland_objs)
-
-$(compositors) $(clients) : CFLAGS += $(shell pkg-config --cflags libdrm)
-
-egl_compositor_objs = egl-compositor.o evdev.o cairo-util.o
-egl-compositor.so : CFLAGS += $(EAGLE_CFLAGS) $(shell pkg-config --cflags libpng cairo gdk-pixbuf-2.0)
-egl-compositor.so : LDLIBS += $(EAGLE_LDLIBS) $(shell pkg-config --libs libpng cairo gdk-pixbuf-2.0) -rdynamic -lrt
-
-egl-compositor.so : $(egl_compositor_objs)
-
-glx_compositor_objs = glx-compositor.o
-glx-compositor.so : LDLIBS += -lGL
-
-glx-compositor.so : $(glx_compositor_objs)
-
-
-libwayland.so $(compositors) :
-       gcc -o $@ $^ $(LDLIBS) -shared 
-
-flower_objs = flower.o wayland-glib.o cairo-util.o
-window_objs = window.o gears.o wayland-glib.o cairo-util.o
-screenshot_objs = screenshot.o wayland-glib.o
-
-$(clients) : CFLAGS += $(shell pkg-config --cflags cairo glib-2.0)
-$(clients) : LDLIBS += $(shell pkg-config --libs cairo glib-2.0) -lrt
-
-window : CFLAGS += $(EAGLE_CFLAGS)
-window : LDLIBS += $(EAGLE_LDLIBS)
-
-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 *.so
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..3c2d256
--- /dev/null
@@ -0,0 +1,65 @@
+CFLAGS = @GCC_CFLAGS@
+
+clients = flower window screenshot
+compositors = egl-compositor.so glx-compositor.so
+
+all : wayland libwayland.so $(compositors) $(clients)
+
+wayland_objs =                                 \
+       wayland.o                               \
+       event-loop.o                            \
+       connection.o                            \
+       wayland-util.o
+
+wayland : CFLAGS += @FFI_CFLAGS@
+wayland : LDLIBS += @FFI_LIBS@ -ldl -rdynamic
+
+wayland : $(wayland_objs)
+       gcc -o $@ $(LDLIBS) $(wayland_objs)
+
+libwayland_objs =                              \
+       wayland-client.o                        \
+       connection.o                            \
+       wayland-util.o
+
+libwayland.so : $(libwayland_objs)
+
+$(compositors) $(clients) : CFLAGS += @LIBDRM_CFLAGS@
+
+egl_compositor_objs = egl-compositor.o evdev.o cairo-util.o
+egl-compositor.so : CFLAGS += @EGL_COMPOSITOR_CFLAGS@
+egl-compositor.so : LDLIBS += @EGL_COMPOSITOR_LIBS@ -rdynamic -lrt
+
+egl-compositor.so : $(egl_compositor_objs)
+
+glx_compositor_objs = glx-compositor.o
+glx-compositor.so : CFLAGS += @GL_COMPOSITOR_CFLAGS@
+glx-compositor.so : LDLIBS += @GL_COMPOSITOR_LIBS@
+
+glx-compositor.so : $(glx_compositor_objs)
+
+
+libwayland.so $(compositors) :
+       gcc -o $@ $^ $(LDLIBS) -shared 
+
+flower_objs = flower.o wayland-glib.o cairo-util.o
+window_objs = window.o gears.o wayland-glib.o cairo-util.o
+screenshot_objs = screenshot.o wayland-glib.o
+
+$(clients) : CFLAGS += @CLIENT_CFLAGS@
+$(clients) : LDLIBS += @CLIENT_LIBS@ -lrt
+
+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 *.so
+
+Makefile : Makefile.in
+       ./config.status
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..58b4429
--- /dev/null
@@ -0,0 +1,18 @@
+AC_INIT(wayland, 0.1)
+AC_PROG_CC
+
+PKG_PROG_PKG_CONFIG()
+PKG_CHECK_MODULES(FFI, [libffi])
+PKG_CHECK_MODULES(LIBDRM, [libdrm])
+
+PKG_CHECK_MODULES(EGL_COMPOSITOR, [eagle libpng cairo gdk-pixbuf-2.0])
+PKG_CHECK_MODULES(GL_COMPOSITOR, [gl x11])
+PKG_CHECK_MODULES(CLIENT, [eagle cairo glib-2.0])
+
+if test $CC = gcc; then
+       GCC_CFLAGS="-Wall -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
+fi
+AC_SUBST(GCC_CFLAGS)
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
\ No newline at end of file