#
# The Python Imaging Library
# $Makefile.in$
#
# makefile template for PIL
#
# Makefile.in is converted into Makefile by the configure script
# in the parent directory.  Once configure has run, you can recreate
# the Makefile by running just config.status.
#
# Copyright (c) 1998-2002 by Secret Labs AB
# Copyright (c) 1995-2002 by Fredrik Lundh 
#

# --------------------------------------------------------------------
# Variables set by config.stat

srcdir=		@srcdir@
VPATH=		@srcdir@

CC=		@CC@
RANLIB=		@RANLIB@
AR=		@AR@

DEFS=		@DEFS@

LIBS=		@LIBS@ @LIBM@

# --------------------------------------------------------------------
# Other things that are customizable but not by configure

INCLDIR=	$(srcdir)/.
JPEGINCLUDE=	/usr/local/include
OPT=		@OPT@
#OPT=		-g
CFLAGS=		$(OPT) -I$(INCLDIR) -I$(JPEGINCLUDE) $(DEFS)

MKDEP=		mkdep
SHELL=		/bin/sh

# --------------------------------------------------------------------
# Fixed definitions

OBJS=		Storage.o Access.o Except.o \
		Antialias.o \
		Bands.o Blend.o \
		Chops.o Convert.o ConvertYCbCr.o Copy.o Crop.o Crc32.o \
		Dib.o Draw.o \
		Effects.o \
		File.o Fill.o Filter.o \
		Geometry.o GetBBox.o \
		Histo.o \
		Matrix.o \
		Negative.o  \
		Offset.o \
		Pack.o Palette.o Paste.o Point.o \
                Quant.o QuantHash.o QuantHeap.o \
		RankFilter.o \
		Unpack.o UnpackYCC.o \
		BitDecode.o \
		EpsEncode.o \
		FliDecode.o \
		GifDecode.o GifEncode.o \
		HexDecode.o \
		JpegDecode.o JpegEncode.o \
		LzwDecode.o \
		MspDecode.o \
		PackDecode.o \
		PcdDecode.o \
		PcxDecode.o PcxEncode.o \
		RawDecode.o RawEncode.o \
		SunRleDecode.o \
		TgaRleDecode.o \
		XbmDecode.o XbmEncode.o \
		ZipDecode.o ZipEncode.o

LIB=		libImaging.a

# --------------------------------------------------------------------
# Rules

all:		coretest $(LIB)

coretest:	coretest.o $(LIB)
		$(CC) -o coretest coretest.o $(LIB) $(LIBS)

$(LIB):		$& $(OBJS)
		-rm -f $(LIB)
		$(AR) cr $(LIB) $(OBJS)
		$(RANLIB) $(LIB)

clean:
		-rm -f *.o *.so core *~ [@,#]* *.old *.orig *.rej *.pyc\
			test.ppm Imaging_wrap.c

clobber:	clean
		-rm -f coretest *.a tags TAGS

distclean:	clobber
		-rm -f Makefile ImConfig.h
		-rm -f config.log config.status config.cache

Makefile:	$(srcdir)/Makefile.in ./config.status
		(CONFIG_FILES=Makefile CONFIG_HEADERS= \
		$(SHELL) config.status)

depend:
		$(MKDEP) $(CFLAGS) `echo $(OBJS) | tr ' ' '\012' | \
					sed 's|\(.*\)\.o|$(srcdir)/\1.c|'`

.PRECIOUS:	Makefile

# --------------------------------------------------------------------
# Tests

check:		coretest
		./coretest
		-xv test.ppm

Imaging_wrap.c:
		wrap -python -dnone Imaging.i

exercise:	Imaging_wrap.c	
		gcc -I../../../Include Imaging_wrap.c -c
		ld -shared -expect_unresolved "*" Imaging_wrap.o\
			libImaging.a -o Imaging.so
		python exerciseImaging.py

# --------------------------------------------------------------------

# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
