aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/mk/doc.images.mk66
1 files changed, 66 insertions, 0 deletions
diff --git a/share/mk/doc.images.mk b/share/mk/doc.images.mk
new file mode 100644
index 0000000000..f7539a52b1
--- /dev/null
+++ b/share/mk/doc.images.mk
@@ -0,0 +1,66 @@
+#
+# $FreeBSD$
+#
+# This include file <doc.images.mk> handles image processing.
+#
+# There are two types of images that must be handled:
+#
+# 1. Images from the library directory, that are shared across multiple
+# documents.
+#
+# 2. Images that are document specific.
+#
+# For library images this file ensures that they are copied in to the
+# documents directory so that they can be reference properly.
+#
+# For library images *and* document specific images, this file ensures
+# that the images are converted from their repository format to the
+# correct output format.
+#
+# Note that this latter functionality is not yet implemented.
+#
+
+#
+# Using library images
+# --------------------
+#
+# Each document that wants to use one or more library images has to
+# list them in the LIB_IMAGES variable. For example, a document that wants
+# to use callouts 1 thru 4 has to list
+#
+# LIB_IMAGES= callouts/1.png callouts/2.png callouts/3.png callouts/4.png
+#
+# in the controlling Makefile.
+#
+# This code ensures they exist in the current directory, and copies them in
+# as necessary.
+#
+
+#
+# The name of the directory that contains all the library images for this
+# language and encoding
+#
+LIB_IMAGES_DIR?= ${.CURDIR}/../../share/images
+
+#
+# The name of the directory *in* the document directory where files and
+# directory hierarchies should be copied to. "images" is too generic, and
+# might clash with local document images, so use "imagelib" by default
+# instead. If you redefine this then you must also update the
+# %callout-graphics-path% variable in the .dsl file.
+#
+LOCAL_LIB_IMAGES_DIR?= ${.CURDIR}/imagelib
+
+CP?= /bin/cp
+MKDIR?= /bin/mkdir
+
+#
+# Create a target for each image used from the library. This target just
+# ensures that each image required is copied from its location in
+# ${LIB_IMAGES_DIR} to the same place in ${LOCAL_LIB_IMAGES_DIR}.
+#
+.for _curimage in ${LIB_IMAGES}
+${_curimage}: ${LIB_IMAGES_DIR}/${_curimage}
+ [ -d ${LOCAL_LIB_IMAGES_DIR}/${_curimage:H} ] || ${MKDIR} -p ${LOCAL_LIB_IMAGES_DIR}/${_curimage:H}
+ ${CP} ${LIB_IMAGES_DIR}/${_curimage} ${LOCAL_LIB_IMAGES_DIR}/${_curimage}
+.endfor