|
fukasawa |
e60969 |
# Sample makefile for rpng-x / rpng2-x / wpng for SGI using cc and make.
|
|
fukasawa |
e60969 |
# Greg Roelofs
|
|
fukasawa |
e60969 |
# Last modified: 7 March 2002
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# The programs built by this makefile are described in the book,
|
|
fukasawa |
e60969 |
# "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
|
|
fukasawa |
e60969 |
# Associates, 1999). Go buy a copy, eh? Buy some for friends
|
|
fukasawa |
e60969 |
# and family, too. (Not that this is a blatant plug or anything.)
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# Invoke this makefile from a shell prompt in the usual way; for example:
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# make -f Makefile.sgi
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# This makefile assumes libpng and zlib have already been built or downloaded
|
|
fukasawa |
e60969 |
# and are both installed in /usr/local/{include,lib} (as indicated by the
|
|
fukasawa |
e60969 |
# PNG* and Z* macros below). Edit as appropriate--choose only ONE each of
|
|
fukasawa |
e60969 |
# the PNGINC, PNGLIB, ZINC and ZLIB lines.
|
|
fukasawa |
e60969 |
#
|
|
fukasawa |
e60969 |
# This makefile builds dynamically linked executables (against libpng and zlib,
|
|
fukasawa |
e60969 |
# that is), but that can be changed by uncommenting the appropriate PNGLIB and
|
|
fukasawa |
e60969 |
# ZLIB lines.
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
# macros --------------------------------------------------------------------
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
PNGINC = -I/usr/local/include/libpng16
|
|
fukasawa |
e60969 |
PNGLIB = -L/usr/local/lib -lpng16 # dynamically linked against libpng
|
|
fukasawa |
e60969 |
#PNGLIB = /usr/local/lib/libpng16.a # statically linked against libpng
|
|
fukasawa |
e60969 |
# or:
|
|
fukasawa |
e60969 |
#PNGINC = -I../..
|
|
fukasawa |
e60969 |
#PNGLIB = -L../.. -lpng
|
|
fukasawa |
e60969 |
#PNGLIB = ../../libpng.a
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
ZINC = -I/usr/local/include
|
|
fukasawa |
e60969 |
ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib
|
|
fukasawa |
e60969 |
#ZLIB = /usr/local/lib/libz.a # statically linked against zlib
|
|
fukasawa |
e60969 |
#ZINC = -I../zlib
|
|
fukasawa |
e60969 |
#ZLIB = -L../zlib -lz
|
|
fukasawa |
e60969 |
#ZLIB = ../../../zlib/libz.a
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
XINC = -I/usr/include/X11 # old-style, stock X distributions
|
|
fukasawa |
e60969 |
XLIB = -L/usr/lib/X11 -lX11
|
|
fukasawa |
e60969 |
#XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
|
|
fukasawa |
e60969 |
#XLIB = -L/usr/openwin/lib -lX11
|
|
fukasawa |
e60969 |
#XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.)
|
|
fukasawa |
e60969 |
#XLIB = -L/usr/X11R6/lib -lX11
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
INCS = $(PNGINC) $(ZINC) $(XINC)
|
|
fukasawa |
e60969 |
RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm
|
|
fukasawa |
e60969 |
WLIBS = $(PNGLIB) $(ZLIB)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
CC = cc
|
|
fukasawa |
e60969 |
LD = cc
|
|
fukasawa |
e60969 |
RM = rm -f
|
|
fukasawa |
e60969 |
# ABI must be the same as that used to build libpng.
|
|
fukasawa |
e60969 |
ABI =
|
|
fukasawa |
e60969 |
CPPFLAGS =
|
|
fukasawa |
e60969 |
CFLAGS = $(ABI) -O -fullwarn $(INCS)
|
|
fukasawa |
e60969 |
LDFLAGS = $(ABI)
|
|
fukasawa |
e60969 |
O = .o
|
|
fukasawa |
e60969 |
E =
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
RPNG = rpng-x
|
|
fukasawa |
e60969 |
RPNG2 = rpng2-x
|
|
fukasawa |
e60969 |
WPNG = wpng
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
ROBJS = $(RPNG)$(O) readpng$(O)
|
|
fukasawa |
e60969 |
ROBJS2 = $(RPNG2)$(O) readpng2$(O)
|
|
fukasawa |
e60969 |
WOBJS = $(WPNG)$(O) writepng$(O)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
# implicit make rules -------------------------------------------------------
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
.c$(O):
|
|
fukasawa |
e60969 |
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
# dependencies --------------------------------------------------------------
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
all: $(EXES)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
$(RPNG)$(E): $(ROBJS)
|
|
fukasawa |
e60969 |
$(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
$(RPNG2)$(E): $(ROBJS2)
|
|
fukasawa |
e60969 |
$(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
$(WPNG)$(E): $(WOBJS)
|
|
fukasawa |
e60969 |
$(LD) $(LDFLAGS) -o $@ $(WOBJS) $(WLIBS)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
$(RPNG)$(O): $(RPNG).c readpng.h
|
|
fukasawa |
e60969 |
$(RPNG2)$(O): $(RPNG2).c readpng2.h
|
|
fukasawa |
e60969 |
$(WPNG)$(O): $(WPNG).c writepng.h
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
readpng$(O): readpng.c readpng.h
|
|
fukasawa |
e60969 |
readpng2$(O): readpng2.c readpng2.h
|
|
fukasawa |
e60969 |
writepng$(O): writepng.c writepng.h
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
# maintenance ---------------------------------------------------------------
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
clean:
|
|
fukasawa |
e60969 |
$(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)
|