libpng/contrib/gregbook/Makefile.unx

133 lines
3.9 KiB
Makefile
Raw Normal View History

1999-10-14 08:43:10 -04:00
# Sample makefile for rpng-x / rpng2-x / wpng using gcc and make.
# Greg Roelofs
2008-07-30 15:47:09 -04:00
# Last modified: 2 June 2007
1999-10-14 08:43:10 -04:00
#
# The programs built by this makefile are described in the book,
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
2008-07-30 15:47:09 -04:00
# Associates, 1999). Go buy a copy, eh? Well, OK, it's not
# generally for sale anymore, but it's the thought that counts,
# right? (Hint: http://www.libpng.org/pub/png/book/ )
1999-10-14 08:43:10 -04:00
#
# Invoke this makefile from a shell prompt in the usual way; for example:
#
2000-03-21 06:13:06 -05:00
# make -f Makefile.unx
1999-10-14 08:43:10 -04:00
#
# This makefile assumes libpng and zlib have already been built or downloaded
2008-07-30 15:47:09 -04:00
# and are installed in /usr/local/{include,lib} or as otherwise indicated by
# the PNG* and Z* macros below. Edit as appropriate--choose only ONE each of
# the PNGINC, PNGLIBd, PNGLIBs, ZINC, ZLIBd and ZLIBs lines.
1999-10-14 08:43:10 -04:00
#
2008-07-30 15:47:09 -04:00
# This makefile builds both dynamically and statically linked executables
# (against libpng and zlib, that is), but that can be changed by modifying
# the "EXES =" line. (You need only one set, but for testing it can be handy
# to have both.)
1999-10-14 08:43:10 -04:00
# macros --------------------------------------------------------------------
2008-07-30 15:47:09 -04:00
#PNGDIR = /usr/local/lib
#PNGINC = -I/usr/local/include/libpng12
#PNGLIBd = -L$(PNGDIR) -lpng12 # dynamically linked, installed libpng
#PNGLIBs = $(PNGDIR)/libpng12.a # statically linked, installed libpng
2000-03-21 06:13:06 -05:00
# or:
2008-07-30 15:47:09 -04:00
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
#PNGDIR = ../libpng
PNGINC = -I$(PNGDIR)
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng12 # dynamically linked
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
ZDIR = /usr/local/lib
#ZDIR = /usr/lib64
2000-03-21 06:13:06 -05:00
ZINC = -I/usr/local/include
2008-07-30 15:47:09 -04:00
ZLIBd = -L$(ZDIR) -lz # dynamically linked against zlib
ZLIBs = $(ZDIR)/libz.a # statically linked against zlib
# or:
#ZDIR = ../zlib
#ZINC = -I$(ZDIR)
#ZLIBd = -Wl,-rpath,$(ZDIR) -L$(ZDIR) -lz # -rpath allows in-place testing
#ZLIBs = $(ZDIR)/libz.a
2000-03-21 06:13:06 -05:00
2001-06-23 09:03:17 -04:00
#XINC = -I/usr/include # old-style, stock X distributions
2008-07-30 15:47:09 -04:00
#XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
2001-06-23 09:03:17 -04:00
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
2000-03-21 06:13:06 -05:00
#XLIB = -L/usr/openwin/lib -lX11
2008-07-30 15:47:09 -04:00
XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.)
2000-03-21 06:13:06 -05:00
XLIB = -L/usr/X11R6/lib -lX11
2008-07-30 15:47:09 -04:00
#XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
1999-10-14 08:43:10 -04:00
INCS = $(PNGINC) $(ZINC) $(XINC)
2008-07-30 15:47:09 -04:00
RLIBSd = $(PNGLIBd) $(ZLIBd) $(XLIB) -lm
RLIBSs = $(PNGLIBs) $(ZLIBs) $(XLIB) -lm
WLIBSd = $(PNGLIBd) $(ZLIBd) -lm
WLIBSs = $(PNGLIBs) $(ZLIBs)
1999-10-14 08:43:10 -04:00
CC = gcc
LD = gcc
RM = rm -f
2008-07-30 15:47:09 -04:00
CFLAGS = -O -Wall $(INCS) -DFEATURE_LOOP
2000-03-21 06:13:06 -05:00
# [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
# [-ansi, -pedantic and -W can also be used]
1999-10-14 08:43:10 -04:00
LDFLAGS =
O = .o
E =
2008-07-30 15:47:09 -04:00
RPNG = rpng-x
RPNG2 = rpng2-x
WPNG = wpng
RPNGs = $(RPNG)-static
RPNG2s = $(RPNG2)-static
WPNGs = $(WPNG)-static
1999-10-14 08:43:10 -04:00
ROBJS = $(RPNG)$(O) readpng$(O)
ROBJS2 = $(RPNG2)$(O) readpng2$(O)
WOBJS = $(WPNG)$(O) writepng$(O)
2008-07-30 15:47:09 -04:00
STATIC_EXES = $(RPNGs)$(E) $(RPNG2s)$(E) $(WPNGs)$(E)
DYNAMIC_EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
EXES = $(STATIC_EXES) $(DYNAMIC_EXES)
1999-10-14 08:43:10 -04:00
# implicit make rules -------------------------------------------------------
.c$(O):
$(CC) -c $(CFLAGS) $<
# dependencies --------------------------------------------------------------
all: $(EXES)
2008-07-30 15:47:09 -04:00
$(RPNGs)$(E): $(ROBJS)
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSs)
1999-10-14 08:43:10 -04:00
$(RPNG)$(E): $(ROBJS)
2008-07-30 15:47:09 -04:00
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBSd)
$(RPNG2s)$(E): $(ROBJS2)
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSs)
1999-10-14 08:43:10 -04:00
$(RPNG2)$(E): $(ROBJS2)
2008-07-30 15:47:09 -04:00
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBSd)
$(WPNGs)$(E): $(WOBJS)
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSs)
1999-10-14 08:43:10 -04:00
$(WPNG)$(E): $(WOBJS)
2008-07-30 15:47:09 -04:00
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBSd)
1999-10-14 08:43:10 -04:00
$(RPNG)$(O): $(RPNG).c readpng.h
$(RPNG2)$(O): $(RPNG2).c readpng2.h
$(WPNG)$(O): $(WPNG).c writepng.h
readpng$(O): readpng.c readpng.h
readpng2$(O): readpng2.c readpng2.h
writepng$(O): writepng.c writepng.h
# maintenance ---------------------------------------------------------------
clean:
$(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)