1 # Makefile for PngMinus (pnm2pngm)
17 CPPFLAGS=-I. -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP
25 # Where to find the source code:
27 ZLIBSRC=$(PNGSRC)/../zlib
28 PROGSRC=$(PNGSRC)/contrib/pngminus
31 ZSRCS = adler32$(C) compress$(C) crc32$(C) deflate$(C) \
35 #ZH = zlib.h crc32.h deflate.h trees.h zutil.h
36 ZH = zlib.h crc32.h deflate.h trees.h zutil.h
38 # Machine generated headers
42 ZINC = zlib.h $(ZCONF)
44 # Headers the Zlib source uses
45 ZHDRS = $(ZH) $(ZCONF)
47 # compress is not required; it is needed to link the zlib
48 # code because deflate defines an unused API function deflateBound
49 # which itself calls compressBound from compress.
50 ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
54 PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
55 pngset$(C) pngtrans$(C) pngwio$(C) pngwrite$(C) \
56 pngwtran$(C) pngwutil$(C)
59 PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
61 # Machine generated headers
65 PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
67 # Headers the PNG library uses
68 PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
70 PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
71 pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \
72 pngwtran$(O) pngwutil$(O)
74 PROGSRCS= pnm2pngm$(C)
77 PROGOBJS= pnm2pngm$(O)
79 OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
81 # implicit make rules -------------------------------------------------------
84 $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
91 $(LD) -o pnm2pngm$(E) $(OBJS)
93 # The DFA_XTRA setting turns all libpng options off then
94 # turns on those required for this minimal build.
95 # The CPP_FLAGS setting causes pngusr.h to be included in
96 # both the build of pnglibconf.h and, subsequently, when
97 # building libpng itself.
98 $(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
99 $(PNGSRC)/scripts/pnglibconf.dfa \
100 $(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
101 $(RM) pnglibconf.h pnglibconf.dfn
102 $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
103 srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
104 DFA_XTRA="pngusr.dfa" $@
107 $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
108 srcdir=$(PNGSRC) clean
113 # distclean also removes the copied source and headers
115 $(RM) -r scripts # historical reasons
116 $(RM) $(PNGSRCS) $(PNGH)
117 $(RM) $(ZSRCS) $(ZH) $(ZCONF)
118 $(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
120 # Header file dependencies:
121 $(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
122 $(PNGOBJS): $(PNGHDRS) $(ZINC)
125 # Gather the source code from the respective directories
126 $(PNGSRCS) $(PNGH): $(PNGSRC)/$@
128 $(COPY) $(PNGSRC)/$@ $@
130 # No dependency on the ZLIBSRC target so that it only needs
131 # to be specified once.
134 $(COPY) $(ZLIBSRC)/$@ $@
136 # The unconfigured zconf.h varies in name according to the
140 @for f in zconf.h.in zconf.in.h zconf.h; do\
141 test -r $(ZLIBSRC)/$$f &&\
142 echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
143 $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
144 done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
146 pnm2pngm.c: $(PROGSRC)/pnm2png.c
148 $(COPY) $(PROGSRC)/pnm2png.c $@
150 # End of makefile for pnm2pngm