fukasawa e60969
# Makefile for PngMinus (rpng2)
fukasawa e60969
# Linux / Unix
fukasawa e60969
fukasawa e60969
#CC=cc
fukasawa e60969
CC=gcc
fukasawa e60969
LD=$(CC)
fukasawa e60969
fukasawa e60969
# If awk fails try
fukasawa e60969
# make AWK=nawk
fukasawa e60969
fukasawa e60969
# If cpp fails try
fukasawa e60969
# make CPP=/lib/cpp
fukasawa e60969
fukasawa e60969
RM=rm -f
fukasawa e60969
COPY=cp
fukasawa e60969
fukasawa e60969
#XINC = -I/usr/include			# old-style, stock X distributions
fukasawa e60969
#XLIB = -L/usr/lib/X11 -lX11		#  (including SGI IRIX)
fukasawa e60969
fukasawa e60969
#XINC = -I/usr/openwin/include		# Sun workstations (OpenWindows)
fukasawa e60969
#XLIB = -L/usr/openwin/lib -lX11
fukasawa e60969
fukasawa e60969
XINC = -I/usr/X11R6/include		# new X distributions (X.org, etc.)
fukasawa e60969
XLIB = -L/usr/X11R6/lib -lX11
fukasawa e60969
#XLIB = -L/usr/X11R6/lib64 -lX11	# e.g., Red Hat on AMD64
fukasawa e60969
fukasawa e60969
#XINC = -I/usr/local/include   		# FreeBSD
fukasawa e60969
#XLIB = -L/usr/local/lib -lX11
fukasawa e60969
fukasawa e60969
#LIBS = $(XLIB)
fukasawa e60969
LIBS = $(XLIB) -lm                      #platforms that need libm
fukasawa e60969
fukasawa e60969
CPPFLAGS=-I. $(XINC) -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP
fukasawa e60969
CFLAGS=-O1 -Wall
fukasawa e60969
fukasawa e60969
C=.c
fukasawa e60969
O=.o
fukasawa e60969
L=.a
fukasawa e60969
E=
fukasawa e60969
fukasawa e60969
# Where to find the source code:
fukasawa e60969
PNGSRC =../../..
fukasawa e60969
ZLIBSRC=$(PNGSRC)/../zlib
fukasawa e60969
PROGSRC=$(PNGSRC)/contrib/gregbook
fukasawa e60969
fukasawa e60969
# Zlib (minimal inflate requirements - crc32 is used by libpng)
fukasawa e60969
# zutil can be eliminated if you provide your own zcalloc and zcfree
fukasawa e60969
ZSRCS  = adler32$(C) crc32$(C) \
fukasawa e60969
	 inffast$(C) inflate$(C) inftrees$(C) \
fukasawa e60969
	 zutil$(C)
fukasawa e60969
fukasawa e60969
# Standard headers
fukasawa e60969
ZH     = zlib.h crc32.h inffast.h inffixed.h \
fukasawa e60969
	 inflate.h inftrees.h zutil.h
fukasawa e60969
fukasawa e60969
# Machine generated headers
fukasawa e60969
ZCONF  = zconf.h
fukasawa e60969
fukasawa e60969
# Headers callers use
fukasawa e60969
ZINC   = zlib.h $(ZCONF)
fukasawa e60969
fukasawa e60969
# Headers the Zlib source uses
fukasawa e60969
ZHDRS  = $(ZH) $(ZCONF)
fukasawa e60969
fukasawa e60969
ZOBJS  = adler32$(O) crc32$(O) \
fukasawa e60969
	 inffast$(O) inflate$(O) inftrees$(O) \
fukasawa e60969
	 zutil$(O)
fukasawa e60969
fukasawa e60969
# libpng
fukasawa e60969
PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
fukasawa e60969
	pngpread$(C) pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
fukasawa e60969
	pngset$(C) pngtrans$(C)
fukasawa e60969
fukasawa e60969
# Standard headers
fukasawa e60969
PNGH   =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
fukasawa e60969
fukasawa e60969
# Machine generated headers
fukasawa e60969
PNGCONF=pnglibconf.h
fukasawa e60969
fukasawa e60969
# Headers callers use
fukasawa e60969
PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
fukasawa e60969
fukasawa e60969
# Headers the PNG library uses
fukasawa e60969
PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
fukasawa e60969
fukasawa e60969
PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
fukasawa e60969
	pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
fukasawa e60969
	pngset$(O) pngtrans$(O)
fukasawa e60969
fukasawa e60969
PROGSRCS= rpng2-x$(C) readpng2$(C)
fukasawa e60969
PROGHDRS= readpng2.h
fukasawa e60969
PROGDOCS= COPYING LICENSE
fukasawa e60969
PROGOBJS= rpng2-x$(O) readpng2$(O)
fukasawa e60969
fukasawa e60969
OBJS    = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
fukasawa e60969
fukasawa e60969
# implicit make rules -------------------------------------------------------
fukasawa e60969
fukasawa e60969
.c$(O):
fukasawa e60969
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
fukasawa e60969
fukasawa e60969
# dependencies
fukasawa e60969
fukasawa e60969
all: $(PROGDOCS) rpng2-x$(E)
fukasawa e60969
fukasawa e60969
rpng2-x$(E): $(OBJS)
fukasawa e60969
	$(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
fukasawa e60969
fukasawa e60969
# The DFA_XTRA setting turns all libpng options off then
fukasawa e60969
# turns on those required for this minimal build.
fukasawa e60969
# The CPP_FLAGS setting causes pngusr.h to be included in
fukasawa e60969
# both the build of pnglibconf.h and, subsequently, when
fukasawa e60969
# building libpng itself.
fukasawa e60969
$(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
fukasawa e60969
	$(PNGSRC)/scripts/pnglibconf.dfa \
fukasawa e60969
	$(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
fukasawa e60969
	$(RM) pnglibconf.h pnglibconf.dfn
fukasawa e60969
	$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
fukasawa e60969
	    srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
fukasawa e60969
	    DFA_XTRA="pngusr.dfa" $@
fukasawa e60969
fukasawa e60969
clean:
fukasawa e60969
	$(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
fukasawa e60969
	    srcdir=$(PNGSRC) clean
fukasawa e60969
	$(RM) rpng2-x$(O)
fukasawa e60969
	$(RM) rpng2-x$(E)
fukasawa e60969
	$(RM) $(OBJS)
fukasawa e60969
fukasawa e60969
# distclean also removes the copied source and headers
fukasawa e60969
distclean: clean
fukasawa e60969
	$(RM) -r scripts # historical reasons
fukasawa e60969
	$(RM) $(PNGSRCS) $(PNGH)
fukasawa e60969
	$(RM) $(ZSRCS) $(ZH) $(ZCONF)
fukasawa e60969
	$(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
fukasawa e60969
fukasawa e60969
# Header file dependencies:
fukasawa e60969
$(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
fukasawa e60969
$(PNGOBJS): $(PNGHDRS) $(ZINC)
fukasawa e60969
$(ZOBJS): $(ZHDRS)
fukasawa e60969
fukasawa e60969
# Gather the source code from the respective directories
fukasawa e60969
$(PNGSRCS) $(PNGH): $(PNGSRC)/$@
fukasawa e60969
	$(RM) $@
fukasawa e60969
	$(COPY) $(PNGSRC)/$@ $@
fukasawa e60969
fukasawa e60969
# No dependency on the ZLIBSRC target so that it only needs
fukasawa e60969
# to be specified once.
fukasawa e60969
$(ZSRCS) $(ZH):
fukasawa e60969
	$(RM) $@
fukasawa e60969
	$(COPY) $(ZLIBSRC)/$@ $@
fukasawa e60969
fukasawa e60969
# The unconfigured zconf.h varies in name according to the
fukasawa e60969
# zlib release
fukasawa e60969
$(ZCONF):
fukasawa e60969
	$(RM) $@
fukasawa e60969
	@for f in zconf.h.in zconf.in.h zconf.h; do\
fukasawa e60969
	    test -r $(ZLIBSRC)/$$f &&\
fukasawa e60969
	    echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
fukasawa e60969
	    $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
fukasawa e60969
	done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
fukasawa e60969
fukasawa e60969
$(PROGSRCS) $(PROGHDRS) $(PROGDOCS): $(PROGSRC)/$@
fukasawa e60969
	$(RM) $@
fukasawa e60969
	$(COPY) $(PROGSRC)/$@ $@
fukasawa e60969
fukasawa e60969
# End of makefile for rpng2-x