xref: /aosp_15_r20/external/libpng/scripts/pnglibconf.mak (revision a67afe4df73cf47866eedc69947994b8ff839aba)
1*a67afe4dSAndroid Build Coastguard Worker#!/usr/bin/make -f
2*a67afe4dSAndroid Build Coastguard Worker# pnglibconf.mak - standard make lines for pnglibconf.h
3*a67afe4dSAndroid Build Coastguard Worker#
4*a67afe4dSAndroid Build Coastguard Worker# These lines are copied from Makefile.am, they illustrate
5*a67afe4dSAndroid Build Coastguard Worker# how to automate the build of pnglibconf.h from scripts/pnglibconf.dfa
6*a67afe4dSAndroid Build Coastguard Worker# given just 'awk', a C preprocessor and standard command line utilities
7*a67afe4dSAndroid Build Coastguard Worker
8*a67afe4dSAndroid Build Coastguard Worker# Override as appropriate, these definitions can be overridden on
9*a67afe4dSAndroid Build Coastguard Worker# the make command line (AWK='nawk' for example).
10*a67afe4dSAndroid Build Coastguard WorkerAWK = gawk
11*a67afe4dSAndroid Build Coastguard WorkerAWK = mawk
12*a67afe4dSAndroid Build Coastguard WorkerAWK = nawk
13*a67afe4dSAndroid Build Coastguard WorkerAWK = one-true-awk
14*a67afe4dSAndroid Build Coastguard WorkerAWK = awk      # This fails on SunOS 5.10; use 'nawk'
15*a67afe4dSAndroid Build Coastguard WorkerCPP = $(CC) -E # If this fails on SunOS 5.10, use '/lib/cpp'
16*a67afe4dSAndroid Build Coastguard Worker
17*a67afe4dSAndroid Build Coastguard WorkerMOVE = mv -f
18*a67afe4dSAndroid Build Coastguard WorkerDELETE = rm -f
19*a67afe4dSAndroid Build Coastguard Worker
20*a67afe4dSAndroid Build Coastguard WorkerDFA_XTRA = # Put your configuration file here, see scripts/pnglibconf.dfa.  Eg:
21*a67afe4dSAndroid Build Coastguard Worker# DFA_XTRA = pngusr.dfa
22*a67afe4dSAndroid Build Coastguard Worker
23*a67afe4dSAndroid Build Coastguard Worker# CPPFLAGS should contain the options to control the result,
24*a67afe4dSAndroid Build Coastguard Worker# but DEFS and CFLAGS are also supported here, override
25*a67afe4dSAndroid Build Coastguard Worker# as appropriate
26*a67afe4dSAndroid Build Coastguard WorkerDFNFLAGS = $(DEFS) $(CPPFLAGS) $(CFLAGS)
27*a67afe4dSAndroid Build Coastguard Worker
28*a67afe4dSAndroid Build Coastguard Worker# srcdir is a de-facto standard for the location of the source
29*a67afe4dSAndroid Build Coastguard Workersrcdir = .
30*a67afe4dSAndroid Build Coastguard Worker
31*a67afe4dSAndroid Build Coastguard Worker# The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
32*a67afe4dSAndroid Build Coastguard Worker# copy this if the following doesn't work.
33*a67afe4dSAndroid Build Coastguard Workerpnglibconf.h: pnglibconf.dfn
34*a67afe4dSAndroid Build Coastguard Worker	$(DELETE) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp
35*a67afe4dSAndroid Build Coastguard Worker	echo '#include "pnglibconf.dfn"' >pnglibconf.c
36*a67afe4dSAndroid Build Coastguard Worker	@echo "## If '$(CC) -E' fails, try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
37*a67afe4dSAndroid Build Coastguard Worker	$(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out
38*a67afe4dSAndroid Build Coastguard Worker	$(AWK) -f $(srcdir)/scripts/dfn.awk out=pnglibconf.tmp pnglibconf.out >&2
39*a67afe4dSAndroid Build Coastguard Worker	$(MOVE) pnglibconf.tmp $@
40*a67afe4dSAndroid Build Coastguard Worker
41*a67afe4dSAndroid Build Coastguard Workerpnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk $(srcdir)/pngconf.h $(srcdir)/pngusr.dfa $(DFA_XTRA)
42*a67afe4dSAndroid Build Coastguard Worker	$(DELETE) $@ pnglibconf.pre pnglibconf.tmp
43*a67afe4dSAndroid Build Coastguard Worker	@echo "## Calling $(AWK) from scripts/pnglibconf.mak" >&2
44*a67afe4dSAndroid Build Coastguard Worker	@echo "## If 'awk' fails, try a better awk (e.g. AWK='nawk')" >&2
45*a67afe4dSAndroid Build Coastguard Worker	$(AWK) -f $(srcdir)/scripts/options.awk out=pnglibconf.pre\
46*a67afe4dSAndroid Build Coastguard Worker	    version=search $(srcdir)/pngconf.h $(srcdir)/scripts/pnglibconf.dfa\
47*a67afe4dSAndroid Build Coastguard Worker	    $(srcdir)/pngusr.dfa $(DFA_XTRA) >&2
48*a67afe4dSAndroid Build Coastguard Worker	$(AWK) -f $(srcdir)/scripts/options.awk out=pnglibconf.tmp pnglibconf.pre >&2
49*a67afe4dSAndroid Build Coastguard Worker	$(MOVE) pnglibconf.tmp $@
50*a67afe4dSAndroid Build Coastguard Worker
51*a67afe4dSAndroid Build Coastguard Workerclean-pnglibconf:
52*a67afe4dSAndroid Build Coastguard Worker	$(DELETE) pnglibconf.h pnglibconf.c pnglibconf.out pnglibconf.pre \
53*a67afe4dSAndroid Build Coastguard Worker	pnglibconf.dfn
54*a67afe4dSAndroid Build Coastguard Worker
55*a67afe4dSAndroid Build Coastguard Workerclean: clean-pnglibconf
56