blob: c125ca2c977808e65a475a56b7359cc5677acc0b [file] [log] [blame]
Chris Craikca2bf812013-07-29 15:28:30 -07001#!/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 just 'awk', a C preprocessor and standard command line utilities
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 # On SUN OS 5.10 if this causes problems use /lib/cpp
16
17MOVE = mv
18DELETE = rm -f
19ECHO = echo
20DFA_XTRA = # Put your configuration file here, see scripts/pnglibconf.dfa. Eg:
21# DFA_XTRA = pngusr.dfa
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) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp
35 $(ECHO) '#include "pnglibconf.dfn"' >pnglibconf.c
36 $(ECHO) "If '$(CC) -E' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
37 $(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out
38 $(AWK) -f "$(srcdir)/scripts/dfn.awk" out="pnglibconf.tmp" pnglibconf.out 1>&2
39 $(MOVE) pnglibconf.tmp $@
40
41pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk $(srcdir)/pngconf.h $(srcdir)/pngusr.dfa $(DFA_XTRA)
42 $(DELETE) $@ pnglibconf.pre pnglibconf.tmp
43 $(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
44 $(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
45 $(AWK) -f $(srcdir)/scripts/options.awk out="pnglibconf.pre"\
46 version=search $(srcdir)/pngconf.h $(srcdir)/scripts/pnglibconf.dfa\
47 $(srcdir)/pngusr.dfa $(DFA_XTRA) 1>&2
48 $(AWK) -f $(srcdir)/scripts/options.awk out="pnglibconf.tmp" pnglibconf.pre 1>&2
49 $(MOVE) pnglibconf.tmp $@
50
51clean-pnglibconf:
Matt Sarett9b1fe632015-11-25 10:21:17 -050052 $(DELETE) pnglibconf.h pnglibconf.c pnglibconf.out pnglibconf.pre \
53 pnglibconf.dfn
Chris Craikca2bf812013-07-29 15:28:30 -070054
55clean: clean-pnglibconf