2010-04-17 09:17:51 -04:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
# pnglibconf.mak - standard make lines for pnglibconf.h
|
2011-05-07 11:52:49 -04:00
|
|
|
#
|
2010-04-17 09:17:51 -04:00
|
|
|
# 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'
|
|
|
|
|
2010-06-21 13:28:05 -04:00
|
|
|
# Override as appropriate, these definitions can be overridden on
|
|
|
|
# the make command line (AWK='nawk' for example).
|
|
|
|
AWK = gawk
|
|
|
|
AWK = mawk
|
|
|
|
AWK = nawk
|
|
|
|
AWK = one-true-awk
|
|
|
|
AWK = awk # Crashes on SunOS 5.10 - use 'nawk'
|
2011-03-22 07:28:27 -04:00
|
|
|
CPP = $(CC) -E # Does not work on SUN OS 5.10 - use /lib/cpp
|
2010-04-17 09:17:51 -04:00
|
|
|
SED = sed
|
2011-03-22 07:28:27 -04:00
|
|
|
|
2010-04-17 09:17:51 -04:00
|
|
|
COPY = cp
|
|
|
|
DELETE = rm -f
|
|
|
|
ECHO = echo
|
2010-04-28 08:52:16 -04:00
|
|
|
DFA_XTRA = # Appended to scripts/options.awk
|
2010-04-17 09:17:51 -04:00
|
|
|
|
|
|
|
# CPPFLAGS should contain the options to control the result,
|
|
|
|
# but DEFS and CFLAGS are also supported here, override
|
|
|
|
# as appropriate
|
|
|
|
DFNFLAGS = $(DEFS) $(CPPFLAGS) $(CFLAGS)
|
|
|
|
|
2010-04-28 08:52:16 -04:00
|
|
|
# srcdir is a defacto standard for the location of the source
|
|
|
|
srcdir = .
|
|
|
|
|
2010-08-24 17:16:35 -04:00
|
|
|
# The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
|
2010-04-17 09:17:51 -04:00
|
|
|
# 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
|
2011-03-22 07:28:27 -04:00
|
|
|
$(ECHO) "If 'cpp -e' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
|
2011-11-07 10:20:27 -05:00
|
|
|
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
|
2010-04-17 09:17:51 -04:00
|
|
|
dfn1.out >dfn2.out
|
2011-11-05 10:27:55 -04:00
|
|
|
$(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out
|
2010-04-17 09:17:51 -04:00
|
|
|
$(COPY) dfn3.out $@
|
|
|
|
$(DELETE) dfn.c dfn1.out dfn2.out dfn3.out
|
|
|
|
|
2010-04-28 08:52:16 -04:00
|
|
|
pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk
|
2010-04-17 09:17:51 -04:00
|
|
|
$(DELETE) $@ dfn1.out dfn2.out
|
2010-06-21 13:28:05 -04:00
|
|
|
$(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
|
|
|
|
$(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
|
2010-04-28 08:52:16 -04:00
|
|
|
$(AWK) -f $(srcdir)/scripts/options.awk out=dfn1.out\
|
|
|
|
$(srcdir)/scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
|
|
|
|
$(AWK) -f $(srcdir)/scripts/options.awk out=dfn2.out dfn1.out 1>&2
|
2010-04-17 09:17:51 -04:00
|
|
|
$(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
|