]> git.saurik.com Git - wxWidgets.git/blame - src/png/scripts/pnglibconf.mak
new file added
[wxWidgets.git] / src / png / scripts / pnglibconf.mak
CommitLineData
9c0d9ce3
DS
1#!/usr/bin/make -f
2# pnglibconf.mak - standard make lines for pnglibconf.h
3#
4# These lines are copied from Makefile.am, they illustrate
5# how to automate the build of pnglibconf.h from scripts/pnglibconf.dfa
6# given 'awk' and 'sed'
7
8# Override as appropriate, these definitions can be overridden on
9# the make command line (AWK='nawk' for example).
10AWK = gawk
11AWK = mawk
12AWK = nawk
13AWK = one-true-awk
14AWK = awk # Crashes on SunOS 5.10 - use 'nawk'
15CPP = $(CC) -E # Does not work on SUN OS 5.10 - use /lib/cpp
16SED = sed
17
18COPY = cp
19DELETE = rm -f
20ECHO = echo
21DFA_XTRA = # Appended to scripts/options.awk
22
23# CPPFLAGS should contain the options to control the result,
24# but DEFS and CFLAGS are also supported here, override
25# as appropriate
26DFNFLAGS = $(DEFS) $(CPPFLAGS) $(CFLAGS)
27
28# srcdir is a defacto standard for the location of the source
29srcdir = .
30
31# The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
32# copy this if the following doesn't work.
33pnglibconf.h: pnglibconf.dfn
34 $(DELETE) $@ dfn.c dfn1.out dfn2.out dfn3.out
35 $(ECHO) '#include "pnglibconf.dfn"' >dfn.c
36 $(CPP) $(DFNFLAGS) dfn.c >dfn1.out
37 $(ECHO) "If 'cpp -e' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
72281370 38 $(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
9c0d9ce3 39 dfn1.out >dfn2.out
72281370 40 $(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out
9c0d9ce3
DS
41 $(COPY) dfn3.out $@
42 $(DELETE) dfn.c dfn1.out dfn2.out dfn3.out
43
72281370 44pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk $(srcdir)/pngconf.h
9c0d9ce3
DS
45 $(DELETE) $@ dfn1.out dfn2.out
46 $(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
47 $(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
72281370
DS
48 $(AWK) -f $(srcdir)/scripts/options.awk out=dfn1.out version=search\
49 $(srcdir)/pngconf.h $(srcdir)/scripts/pnglibconf.dfa\
50 $(DFA_XTRA) 1>&2
9c0d9ce3
DS
51 $(AWK) -f $(srcdir)/scripts/options.awk out=dfn2.out dfn1.out 1>&2
52 $(COPY) dfn2.out $@
53 $(DELETE) dfn1.out dfn2.out
54
55clean-pnglibconf:
56 $(DELETE) pnglibconf.h pnglibconf.dfn dfn.c dfn1.out dfn2.out dfn3.out
57
58clean: clean-pnglibconf