Skip to content
Browse files

docs: Add a Makefile for the tutorial examples.

The tutorial examples are meant to be stand-alone applications, which
might be installed along with the headers in a development package.

For that reason, it seems useful to have a Makefile to build the
sources, using an installed library, independent of the library's
build system.
  • Loading branch information...
1 parent 855de6d commit a9f707970163f1838462cc2a7e325aee73182e4b @algernon committed Jun 5, 2011
Showing with 25 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 docs/tutorial/Makefile.am
  3. +23 −0 docs/tutorial/examples/GNUmakefile
View
1 .gitignore
@@ -17,5 +17,6 @@ m4/
missing
tests/*.ok
docs/html/
+docs/tutorial/examples/tut/
b/
.pc/
View
1 docs/tutorial/Makefile.am
@@ -1,4 +1,5 @@
EXTRA_DIST = tutorial.h \
+ examples/GNUmakefile \
tut_bson.h \
tut_bson_build.h examples/tut_bson_build.c examples/tut_bson_build.json \
tut_bson_traverse.h examples/tut_bson_traverse.c \
View
23 docs/tutorial/examples/GNUmakefile
@@ -0,0 +1,23 @@
+# NOTE: This Makefile assumes that a recent enough version of
+# libmongo-client is installed!
+#
+# It will NOT work in the build directory, without an installed
+# libmongo-client library.
+
+TUTORIAL_PROGRAMS = tut/bson_build \
+ tut/bson_traverse \
+ tut/hl_client
+
+LMC_CFLAGS = $(shell pkg-config --cflags libmongo-client)
+LMC_LIBS = $(shell pkg-config --libs libmongo-client)
+
+all: ${TUTORIAL_PROGRAMS}
+clean:
+ rm -f ${TUTORIAL_PROGRAMS}
+ -rmdir tut/
+
+${TUTORIAL_PROGRAMS}: tut/%: tut_%.c
+ @install -d tut
+ ${CC} ${LMC_CFLAGS} ${CFLAGS} ${LMC_LIBS} ${LDFLAGS} $< -o $@
+
+.PHONY: all clean

0 comments on commit a9f7079

Please sign in to comment.
Something went wrong with that request. Please try again.