summaryrefslogtreecommitdiff
path: root/scripts/pnglibconf.mak
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp@shaggy.simplesystems.org>2010-04-17 08:17:51 -0500
committerGlenn Randers-Pehrson <glennrp@shaggy.simplesystems.org>2010-04-17 08:17:51 -0500
commit725314432d6ff034986d692b2cb6261a041b2942 (patch)
treef239e74ce073d6d67b1d90b0f517409011f51e89 /scripts/pnglibconf.mak
parent98b4f0032bdec52caeac779da0560ab75ca813c2 (diff)
downloadlibpng-725314432d6ff034986d692b2cb6261a041b2942.tar.gz
[devel] Revise scripts to work with pnglibconf.h
Diffstat (limited to 'scripts/pnglibconf.mak')
-rw-r--r--scripts/pnglibconf.mak44
1 files changed, 44 insertions, 0 deletions
diff --git a/scripts/pnglibconf.mak b/scripts/pnglibconf.mak
new file mode 100644
index 000000000..9cdb42297
--- /dev/null
+++ b/scripts/pnglibconf.mak
@@ -0,0 +1,44 @@
+#!/usr/bin/make -f
+# pnglibconf.mak - standard make lines for pnglibconf.h
+#
+# These lines are copied from Makefile.am, they illustrate
+# how to automate the build of pnglibconf.h from scripts/pnglibconf.dfa
+# given 'awk' and 'sed'
+
+# Override as appropriate:
+AWK = awk
+SED = sed
+CPP = $(CC) -E
+COPY = cp
+DELETE = rm -f
+ECHO = echo
+
+# CPPFLAGS should contain the options to control the result,
+# but DEFS and CFLAGS are also supported here, override
+# as appropriate
+DFNFLAGS = $(DEFS) $(CPPFLAGS) $(CFLAGS)
+
+# The standard pnglibconf.h exists as scripts/pnglibconf.h,
+# copy this if the following doesn't work.
+pnglibconf.h: pnglibconf.dfn
+ $(DELETE) $@ dfn.c dfn1.out dfn2.out dfn3.out
+ $(ECHO) '#include "pnglibconf.dfn"' >dfn.c
+ $(CPP) $(DFNFLAGS) dfn.c >dfn1.out
+ $(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\
+ dfn1.out >dfn2.out
+ $(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
+ $(COPY) dfn3.out $@
+ $(DELETE) dfn.c dfn1.out dfn2.out dfn3.out
+
+pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
+ $(DELETE) $@ dfn1.out dfn2.out
+ $(AWK) -f scripts/options.awk pre=1 out=dfn1.out\
+ scripts/pnglibconf.dfa 1>&2
+ $(AWK) -f scripts/options.awk pre=0 out=dfn2.out dfn1.out 1>&2
+ $(COPY) dfn2.out $@
+ $(DELETE) dfn1.out dfn2.out
+
+clean-pnglibconf:
+ $(DELETE) pnglibconf.h pnglibconf.dfn dfn.c dfn1.out dfn2.out dfn3.out
+
+clean: clean-pnglibconf