1 # Makefile for PngMinus (rpng2)
17 #XINC = -I/usr/include # old-style, stock X distributions
18 #XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
20 #XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
21 #XLIB = -L/usr/openwin/lib -lX11
23 XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.)
24 XLIB = -L/usr/X11R6/lib -lX11
25 #XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
27 #XINC = -I/usr/local/include # FreeBSD
28 #XLIB = -L/usr/local/lib -lX11
31 LIBS = $(XLIB) -lm #platforms that need libm
33 CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP -I. $(XINC) -O1
40 # Where to find the source code:
42 ZLIBSRC=$(PNGSRC)/../zlib
43 PROGSRC=$(PNGSRC)/contrib/gregbook
45 # Zlib (minimal inflate requirements - crc32 is used by libpng)
46 # zutil can be eliminated if you provide your own zcalloc and zcfree
47 ZSRCS = adler32$(C) crc32$(C) \
48 inffast$(C) inflate$(C) inftrees$(C) \
52 ZH = zlib.h crc32.h inffast.h inffixed.h \
53 inflate.h inftrees.h zutil.h
55 # Machine generated headers
59 ZINC = zlib.h $(ZCONF)
61 # Headers the Zlib source uses
62 ZHDRS = $(ZH) $(ZCONF)
64 ZOBJS = adler32$(O) crc32$(O) \
65 inffast$(O) inflate$(O) inftrees$(O) \
69 PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
70 pngpread$(C) pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
71 pngset$(C) pngtrans$(C)
74 PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
76 # Machine generated headers
80 PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
82 # Headers the PNG library uses
83 PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
85 PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
86 pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
87 pngset$(O) pngtrans$(O)
89 PROGSRCS= rpng2-x$(C) readpng2$(C)
91 PROGDOCS= COPYING LICENSE
92 PROGOBJS= rpng2-x$(O) readpng2$(O)
94 OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
96 # implicit make rules -------------------------------------------------------
103 all: $(PROGDOCS) rpng2-x$(E)
106 $(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
108 # The DFA_XTRA setting turns all libpng options off then
109 # turns on those required for this minimal build.
110 # The CPP_FLAGS setting causes pngusr.h to be included in
111 # both the build of pnglibconf.h and, subsequently, when
112 # building libpng itself.
113 $(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
114 $(PNGSRC)/scripts/pnglibconf.dfa \
115 $(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
116 $(RM) pnglibconf.h pnglibconf.dfn
117 $(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
118 srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
119 DFA_XTRA="pngusr.dfa" $@
122 $(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
123 srcdir=$(PNGSRC) clean
128 # distclean also removes the copied source and headers
130 $(RM) -r scripts # historical reasons
131 $(RM) $(PNGSRCS) $(PNGH)
132 $(RM) $(ZSRCS) $(ZH) $(ZCONF)
133 $(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
135 # Header file dependencies:
136 $(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
137 $(PNGOBJS): $(PNGHDRS) $(ZINC)
140 # Gather the source code from the respective directories
141 $(PNGSRCS) $(PNGH): $(PNGSRC)/$@
143 $(COPY) $(PNGSRC)/$@ $@
145 # No dependency on the ZLIBSRC target so that it only needs
146 # to be specified once.
149 $(COPY) $(ZLIBSRC)/$@ $@
151 # The unconfigured zconf.h varies in name according to the
155 @for f in zconf.h.in zconf.in.h zconf.h; do\
156 test -r $(ZLIBSRC)/$$f &&\
157 echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
158 $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
159 done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
161 $(PROGSRCS) $(PROGHDRS) $(PROGDOCS): $(PROGSRC)/$@
163 $(COPY) $(PROGSRC)/$@ $@
165 # End of makefile for rpng2-x