]> gitweb.michael.orlitzky.com - libsvgtiny.git/blobdiff - examples/GNUmakefile
examples/GNUmakefile: add a GNUmakefile for the example program
[libsvgtiny.git] / examples / GNUmakefile
diff --git a/examples/GNUmakefile b/examples/GNUmakefile
new file mode 100644 (file)
index 0000000..1c287fe
--- /dev/null
@@ -0,0 +1,20 @@
+CC       ?= cc
+
+# Handle libsvgtiny flags and libs separately in case it's missing. If
+# you're building against a local (non-system) libsvgtiny, then the
+# absence of its pkg-config file should not be a fatal error.
+SVGTINY_CPPFLAGS := $(shell pkg-config --silence-errors --cflags libsvgtiny)
+OTHER_CPPFLAGS   := $(shell pkg-config --cflags cairo x11)
+CPPFLAGS         += $(SVGTINY_CPPFLAGS) $(OTHER_CPPFLAGS)
+
+SVGTINY_LIBS := $(shell pkg-config --silence-errors --libs libsvgtiny)
+OTHER_LIBS   := $(shell pkg-config --libs cairo x11) -lm
+LIBS         += $(SVGTINY_LIBS) $(OTHER_LIBS)
+
+all: svgtiny_display_x11
+.c:
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
+
+.PHONY : clean
+clean:
+       rm -f svgtiny_display_x11