[devel] Revised contrib/pngminim/decoder to build and use pnglibconf.h
This commit is contained in:
parent
6ff9ec81c5
commit
8c065ddbe6
@ -5,6 +5,8 @@
|
||||
CC=gcc
|
||||
LD=$(CC)
|
||||
AWK=awk
|
||||
SED=sed
|
||||
CPP=cpp
|
||||
|
||||
RM=rm -f
|
||||
|
||||
@ -39,6 +41,18 @@ pnglibconf.h: pnglibconf.mak pnglibconf.dfn
|
||||
|
||||
# used on demand to regenerate the standard header, CPPFLAGS should
|
||||
# be empty - no non-standard defines
|
||||
|
||||
.dfn.out:
|
||||
rm -f $@ dfn.c dfn?.out
|
||||
echo '#include "$<"' >dfn.c
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
|
||||
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c >dfn1.out
|
||||
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\
|
||||
dfn1.out >dfn2.out
|
||||
$(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
|
||||
rm -f dfn.c dfn[12].out
|
||||
mv dfn3.out $@
|
||||
|
||||
pnglibconf.dfn: pnglibconf.dfa options.awk
|
||||
rm -f $@ dfn?.out
|
||||
test -z "$(CPPFLAGS)"
|
||||
|
@ -12,10 +12,6 @@
|
||||
#ifndef MINRDPNGCONF_H
|
||||
#define MINRDPNGCONF_H
|
||||
|
||||
#ifdef NJET
|
||||
/* No 16-bit support beyond reading with strip_16 */
|
||||
#endif
|
||||
|
||||
#define PNG_NO_WARNINGS
|
||||
#define png_warning(s1,s2) ""
|
||||
#define png_chunk_warning(s1,s2) ""
|
||||
|
@ -1,9 +1,23 @@
|
||||
|
||||
# Get the source for the pngminus application
|
||||
cp ../../pngminus/pnm2png.c pnm2pngm.c
|
||||
|
||||
# Get the libpng sources
|
||||
cp ../../../*.h .
|
||||
cp ../../../*.c .
|
||||
|
||||
# Get the libpng scripts for building pnglibconf.h
|
||||
cp ../../../scripts/options.awk .
|
||||
cp ../../../scripts/pnglibconf.dfa .
|
||||
sed -e "s:scripts/::g" ../../../scripts/pnglibconf.mak > pnglibconf.mak
|
||||
#14+%
|
||||
# Remove libpng sources we won't use
|
||||
rm example.c pngtest.c pngr*.c pngpread.c
|
||||
# Change the next 2 lines if zlib is somewhere else.
|
||||
|
||||
# Get the zlib sources
|
||||
# Change the following 2 lines if zlib is somewhere else
|
||||
cp ../../../../zlib/*.h .
|
||||
cp ../../../../zlib/*.c .
|
||||
rm inf*.[ch]
|
||||
rm minigzip.c example.c gz*
|
||||
|
||||
# Remove zlib sources we won't use
|
||||
rm minigzip.c example.c inf*.[ch] gz*
|
||||
|
@ -1,13 +1,17 @@
|
||||
|
||||
# Makefile for PngMinus (pnm2pngm)
|
||||
# Linux / Unix
|
||||
|
||||
#CC=cc
|
||||
CC=gcc
|
||||
LD=$(CC)
|
||||
AWK=awk
|
||||
SED=sed
|
||||
CPP=cpp
|
||||
|
||||
RM=rm -f
|
||||
|
||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
|
||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -I. -O1
|
||||
|
||||
C=.c
|
||||
O=.o
|
||||
@ -31,6 +35,35 @@ OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
|
||||
|
||||
all: pnm2pngm$(E)
|
||||
|
||||
# see scripts/pnglibconf.mak for more options
|
||||
pnglibconf.h: pnglibconf.mak pnglibconf.dfn
|
||||
make -f pnglibconf.mak pnglibconf.h
|
||||
|
||||
# used on demand to regenerate the standard header, CPPFLAGS should
|
||||
# be empty - no non-standard defines
|
||||
|
||||
.dfn.out:
|
||||
rm -f $@ dfn.c dfn?.out
|
||||
echo '#include "$<"' >dfn.c
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
|
||||
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c >dfn1.out
|
||||
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\
|
||||
dfn1.out >dfn2.out
|
||||
$(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
|
||||
rm -f dfn.c dfn[12].out
|
||||
mv dfn3.out $@
|
||||
|
||||
pnglibconf.dfn: pnglibconf.dfa options.awk
|
||||
rm -f $@ dfn?.out
|
||||
test -z "$(CPPFLAGS)"
|
||||
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
|
||||
$(AWK) -f options.awk pre=1 out=dfn1.out\
|
||||
logunsupported=1 - pnglibconf.dfa 1>&2
|
||||
$(AWK) -f options.awk pre=0 out=dfn2.out\
|
||||
logunsupported=1 dfn1.out 1>&2
|
||||
rm dfn1.out
|
||||
mv dfn2.out $@
|
||||
|
||||
pnm2pngm$(E): $(OBJS)
|
||||
$(LD) -o pnm2pngm$(E) $(OBJS)
|
||||
strip pnm2pngm$(E)
|
||||
@ -40,4 +73,4 @@ clean:
|
||||
$(RM) pnm2pngm$(E)
|
||||
$(RM) $(OBJS)
|
||||
|
||||
# End of makefile for pnm2pngm
|
||||
# End of makefile for pngm2pnm
|
||||
|
Loading…
Reference in New Issue
Block a user