beta-0.89.2
[luatex.git] / source / libs / libpng / libpng-src / contrib / gregbook / Makefile.unx
blob1a73e03bff4898cc25978fa6b9570dab25ede26a
1 # Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
2 # Greg Roelofs
3 # Last modified:  2 June 2007
5 #       The programs built by this makefile are described in the book,
6 #       "PNG:  The Definitive Guide," by Greg Roelofs (O'Reilly and
7 #       Associates, 1999).  Go buy a copy, eh?  Well, OK, it's not
8 #       generally for sale anymore, but it's the thought that counts,
9 #       right?  (Hint:  http://www.libpng.org/pub/png/book/ )
11 # Invoke this makefile from a shell prompt in the usual way; for example:
13 #       make -f Makefile.unx
15 # This makefile assumes libpng and zlib have already been built or downloaded
16 # and are installed in /usr/local/{include,lib} or as otherwise indicated by
17 # the PNG* and Z* macros below.  Edit as appropriate--choose only ONE each of
18 # the PNGINC, PNGLIBd, PNGLIBs, ZINC, ZLIBd and ZLIBs lines.
20 # This makefile builds both dynamically and statically linked executables
21 # (against libpng and zlib, that is), but that can be changed by modifying
22 # the "EXES =" line.  (You need only one set, but for testing it can be handy
23 # to have both.)
26 # macros --------------------------------------------------------------------
28 #PNGDIR = /usr/local/lib
29 #PNGINC = -I/usr/local/include/libpng16
30 #PNGLIBd = -L$(PNGDIR) -lpng16 # dynamically linked, installed libpng
31 #PNGLIBs = $(PNGDIR)/libpng16.a # statically linked, installed libpng
32 # or:
33 PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
34 #PNGDIR = ../libpng
35 PNGINC = -I$(PNGDIR)
36 PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng16      # dynamically linked
37 PNGLIBs = $(PNGDIR)/libpng.a            # statically linked, local libpng
39 ZDIR = /usr/local/lib
40 #ZDIR = /usr/lib64
41 ZINC = -I/usr/local/include
42 ZLIBd = -L$(ZDIR) -lz                   # dynamically linked against zlib
43 ZLIBs = $(ZDIR)/libz.a                  # statically linked against zlib
44 # or:
45 #ZDIR = ../zlib
46 #ZINC = -I$(ZDIR)
47 #ZLIBd = -Wl,-rpath,$(ZDIR) -L$(ZDIR) -lz  # -rpath allows in-place testing
48 #ZLIBs = $(ZDIR)/libz.a
50 #XINC = -I/usr/include                  # old-style, stock X distributions
51 #XLIB = -L/usr/lib/X11 -lX11            #  (including SGI IRIX)
52 #XINC = -I/usr/openwin/include          # Sun workstations (OpenWindows)
53 #XLIB = -L/usr/openwin/lib -lX11
54 XINC = -I/usr/X11R6/include             # new X distributions (X.org, etc.)
55 XLIB = -L/usr/X11R6/lib -lX11
56 #XLIB = -L/usr/X11R6/lib64 -lX11        # e.g., Red Hat on AMD64
58 INCS = $(PNGINC) $(ZINC) $(XINC)
59 RLIBSd = $(PNGLIBd) $(ZLIBd) $(XLIB) -lm
60 RLIBSs = $(PNGLIBs) $(ZLIBs) $(XLIB) -lm
61 WLIBSd = $(PNGLIBd) $(ZLIBd) -lm
62 WLIBSs = $(PNGLIBs) $(ZLIBs) -lm
64 CC = gcc
65 LD = gcc
66 RM = rm -f
67 CPPFLAGS = $(INCS) -DFEATURE_LOOP
68 CFLAGS = -O -Wall
69 #CFLAGS = -O -W -Wall -Wextra -pedantic -ansi
70 # [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
71 # [-ansi, -pedantic, -Wextra, and -W can also be used]
72 LDFLAGS =
73 O = .o
74 E =
76 RPNG   = rpng-x
77 RPNG2  = rpng2-x
78 WPNG   = wpng
80 RPNGs  = $(RPNG)-static
81 RPNG2s = $(RPNG2)-static
82 WPNGs  = $(WPNG)-static
84 ROBJS  = $(RPNG)$(O) readpng$(O)
85 ROBJS2 = $(RPNG2)$(O) readpng2$(O)
86 WOBJS  = $(WPNG)$(O) writepng$(O)
88 STATIC_EXES  = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
89 DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
91 EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
94 # implicit make rules -------------------------------------------------------
96 .c$(O):
97         $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
100 # dependencies --------------------------------------------------------------
102 all:  $(EXES)
104 $(RPNGs)$(E): $(ROBJS)
105         $(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSs)
107 $(RPNG)$(E): $(ROBJS)
108         $(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSd)
110 $(RPNG2s)$(E): $(ROBJS2)
111         $(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSs)
113 $(RPNG2)$(E): $(ROBJS2)
114         $(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSd)
116 $(WPNGs)$(E): $(WOBJS)
117         $(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSs)
119 $(WPNG)$(E): $(WOBJS)
120         $(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSd)
122 $(RPNG)$(O):    $(RPNG).c readpng.h
123 $(RPNG2)$(O):   $(RPNG2).c readpng2.h
124 $(WPNG)$(O):    $(WPNG).c writepng.h
126 readpng$(O):    readpng.c readpng.h
127 readpng2$(O):   readpng2.c readpng2.h
128 writepng$(O):   writepng.c writepng.h
131 # maintenance ---------------------------------------------------------------
133 clean:
134         $(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)