fukasawa e60969
#!/usr/bin/make -f
fukasawa e60969
# pnglibconf.mak - standard make lines for pnglibconf.h
fukasawa e60969
#
fukasawa e60969
# These lines are copied from Makefile.am, they illustrate
fukasawa e60969
# how to automate the build of pnglibconf.h from scripts/pnglibconf.dfa
fukasawa e60969
# given just 'awk', a C preprocessor and standard command line utilities
fukasawa e60969
fukasawa e60969
# Override as appropriate, these definitions can be overridden on
fukasawa e60969
# the make command line (AWK='nawk' for example).
fukasawa e60969
AWK = gawk
fukasawa e60969
AWK = mawk
fukasawa e60969
AWK = nawk
fukasawa e60969
AWK = one-true-awk
fukasawa e60969
AWK = awk  # Crashes on SunOS 5.10 - use 'nawk'
fukasawa e60969
CPP = $(CC) -E # On SUN OS 5.10 if this causes problems use /lib/cpp
fukasawa e60969
fukasawa e60969
MOVE = mv
fukasawa e60969
DELETE = rm -f
fukasawa e60969
ECHO = echo
fukasawa e60969
DFA_XTRA = # Put your configuration file here, see scripts/pnglibconf.dfa.  Eg:
fukasawa e60969
# DFA_XTRA = pngusr.dfa
fukasawa e60969
fukasawa e60969
# CPPFLAGS should contain the options to control the result,
fukasawa e60969
# but DEFS and CFLAGS are also supported here, override
fukasawa e60969
# as appropriate
fukasawa e60969
DFNFLAGS = $(DEFS) $(CPPFLAGS) $(CFLAGS)
fukasawa e60969
fukasawa e60969
# srcdir is a defacto standard for the location of the source
fukasawa e60969
srcdir = .
fukasawa e60969
fukasawa e60969
# The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
fukasawa e60969
# copy this if the following doesn't work.
fukasawa e60969
pnglibconf.h: pnglibconf.dfn
fukasawa e60969
	$(DELETE) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp
fukasawa e60969
	$(ECHO) '#include "pnglibconf.dfn"' >pnglibconf.c
fukasawa e60969
	$(ECHO) "If '$(CC) -E' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
fukasawa e60969
	$(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out
fukasawa e60969
	$(AWK) -f "$(srcdir)/scripts/dfn.awk" out="pnglibconf.tmp" pnglibconf.out 1>&2
fukasawa e60969
	$(MOVE) pnglibconf.tmp $@
fukasawa e60969
fukasawa e60969
pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk $(srcdir)/pngconf.h $(srcdir)/pngusr.dfa $(DFA_XTRA)
fukasawa e60969
	$(DELETE) $@ pnglibconf.pre pnglibconf.tmp
fukasawa e60969
	$(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
fukasawa e60969
	$(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
fukasawa e60969
	$(AWK) -f $(srcdir)/scripts/options.awk out="pnglibconf.pre"\
fukasawa e60969
	    version=search $(srcdir)/pngconf.h $(srcdir)/scripts/pnglibconf.dfa\
fukasawa e60969
	    $(srcdir)/pngusr.dfa $(DFA_XTRA) 1>&2
fukasawa e60969
	$(AWK) -f $(srcdir)/scripts/options.awk out="pnglibconf.tmp" pnglibconf.pre 1>&2
fukasawa e60969
	$(MOVE) pnglibconf.tmp $@
fukasawa e60969
fukasawa e60969
clean-pnglibconf:
fukasawa e60969
	$(DELETE) pnglibconf.h pnglibconf.c pnglibconf.out pnglibconf.pre \
fukasawa e60969
	pnglibconf.dfn
fukasawa e60969
fukasawa e60969
clean: clean-pnglibconf