24
31
LIBS = $(XLIB) -lm #platforms that need libm
26
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
27
-DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1
33
CPPFLAGS=-I. $(XINC) -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP
41
# Where to find the source code:
43
ZLIBSRC=$(PNGSRC)/../zlib
44
PROGSRC=$(PNGSRC)/contrib/gregbook
46
# Zlib (minimal inflate requirements - crc32 is used by libpng)
47
# zutil can be eliminated if you provide your own zcalloc and zcfree
48
ZSRCS = adler32$(C) crc32$(C) \
49
inffast$(C) inflate$(C) inftrees$(C) \
53
ZH = zlib.h crc32.h inffast.h inffixed.h \
54
inflate.h inftrees.h zutil.h
56
# Machine generated headers
60
ZINC = zlib.h $(ZCONF)
62
# Headers the Zlib source uses
63
ZHDRS = $(ZH) $(ZCONF)
34
65
ZOBJS = adler32$(O) crc32$(O) \
35
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
36
trees$(O) uncompr$(O) zutil$(O)
38
OBJS = rpng2-x$(O) readpng2$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
66
inffast$(O) inflate$(O) inftrees$(O) \
70
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
71
pngpread$(C) pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
72
pngset$(C) pngtrans$(C)
75
PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
77
# Machine generated headers
81
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
83
# Headers the PNG library uses
84
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
86
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
39
87
pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
40
pngset$(O) pngtrans$(O) $(ZOBJS)
88
pngset$(O) pngtrans$(O)
90
PROGSRCS= rpng2-x$(C) readpng2$(C)
92
PROGDOCS= COPYING LICENSE
93
PROGOBJS= rpng2-x$(O) readpng2$(O)
95
OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
42
97
# implicit make rules -------------------------------------------------------
44
.c$(O): png.h pngconf.h pngpriv.h readpng2.h pngusr.h zlib.h
100
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
104
all: $(PROGDOCS) rpng2-x$(E)
51
106
rpng2-x$(E): $(OBJS)
52
107
$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
109
# The DFA_XTRA setting turns all libpng options off then
110
# turns on those required for this minimal build.
111
# The CPP_FLAGS setting causes pngusr.h to be included in
112
# both the build of pnglibconf.h and, subsequently, when
113
# building libpng itself.
114
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
115
$(PNGSRC)/scripts/pnglibconf.dfa \
116
$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
117
$(RM) pnglibconf.h pnglibconf.dfn
118
$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
119
srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
120
DFA_XTRA="pngusr.dfa" $@
123
$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
124
srcdir=$(PNGSRC) clean
129
# distclean also removes the copied source and headers
131
$(RM) -r scripts # historical reasons
132
$(RM) $(PNGSRCS) $(PNGH)
133
$(RM) $(ZSRCS) $(ZH) $(ZCONF)
134
$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
136
# Header file dependencies:
137
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
138
$(PNGOBJS): $(PNGHDRS) $(ZINC)
141
# Gather the source code from the respective directories
142
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
144
$(COPY) $(PNGSRC)/$@ $@
146
# No dependency on the ZLIBSRC target so that it only needs
147
# to be specified once.
150
$(COPY) $(ZLIBSRC)/$@ $@
152
# The unconfigured zconf.h varies in name according to the
156
@for f in zconf.h.in zconf.in.h zconf.h; do\
157
test -r $(ZLIBSRC)/$$f &&\
158
echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
159
$(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
160
done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
162
$(PROGSRCS) $(PROGHDRS) $(PROGDOCS): $(PROGSRC)/$@
164
$(COPY) $(PROGSRC)/$@ $@
59
166
# End of makefile for rpng2-x