1 # Makefile for PngMinus (pngm2pnm)
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
30 # Zlib (minimal inflate requirements - crc32 is used by libpng)
31 # zutil can be eliminated if you provide your own zcalloc and zcfree
32 ZSRCS = adler32$(C) crc32$(C) \
33 inffast$(C) inflate$(C) inftrees$(C) \
37 ZH = zlib.h crc32.h inffast.h inffixed.h \
38 inflate.h inftrees.h zutil.h
40 # Machine generated headers
44 ZINC = zlib.h $(ZCONF)
46 # Headers the Zlib source uses
47 ZHDRS = $(ZH) $(ZCONF)
49 ZOBJS = adler32$(O) crc32$(O) \
50 inffast$(O) inflate$(O) inftrees$(O) \
54 PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
55 pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
56 pngset$(C) pngtrans$(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 pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
72 pngset$(O) pngtrans$(O)
74 PROGSRCS= pngm2pnm$(C)
77 PROGOBJS= pngm2pnm$(O)
79 OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
81 # implicit make rules -------------------------------------------------------
83 # note: dependencies do not work on implicit rule lines
85 $(CC) $(CPPFLAGS) -c $(CFLAGS) $<
92 $(LD) -o pngm2pnm$(E) $(OBJS)
94 # The DFA_XTRA setting turns all libpng options off then
95 # turns on those required for this minimal build.
96 # The CPP_FLAGS setting causes pngusr.h to be included in
97 # both the build of pnglibconf.h and, subsequently, when
98 # building libpng itself.
99 $(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
100 $(PNGSRC)/scripts/pnglibconf.dfa \
101 $(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
102 $(RM) pnglibconf.h pnglibconf.dfn
103 $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
104 srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
105 DFA_XTRA="pngusr.dfa" $@
108 $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
109 srcdir=$(PNGSRC) clean
114 # distclean also removes the copied source and headers
116 $(RM) -r scripts # historical reasons
117 $(RM) $(PNGSRCS) $(PNGH)
118 $(RM) $(ZSRCS) $(ZH) $(ZCONF)
119 $(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
121 # Header file dependencies:
122 $(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
123 $(PNGOBJS): $(PNGHDRS) $(ZINC)
126 # Gather the source code from the respective directories
127 $(PNGSRCS) $(PNGH): $(PNGSRC)/$@
129 $(COPY) $(PNGSRC)/$@ $@
131 # No dependency on the ZLIBSRC target so that it only needs
132 # to be specified once.
135 $(COPY) $(ZLIBSRC)/$@ $@
137 # The unconfigured zconf.h varies in name according to the
141 @for f in zconf.h.in zconf.in.h zconf.h; do\
142 test -r $(ZLIBSRC)/$$f &&\
143 echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
144 $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
145 done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
147 pngm2pnm.c: $(PROGSRC)/png2pnm.c
149 $(COPY) $(PROGSRC)/png2pnm.c $@
151 # End of makefile for pngm2pnm