]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
examples/GNUmakefile: add a GNUmakefile for the example program
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 19 Nov 2023 13:32:01 +0000 (08:32 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 20 Nov 2023 16:42:58 +0000 (11:42 -0500)
This should simplify building it a bit, both against the system copy
and against a development repo. We use the name GNUmakefile (as
opposed to Makefile) to avoid interacting with the netsurf build
system.

examples/GNUmakefile [new file with mode: 0644]

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