# $Id: makefile,v 1.27 94/02/14 15:38:55 mangin Exp $

InstallTop=/usr			   	# Top install dir #
InstallLib=$(InstallTop)/lib/tcl 	# where to install picasso tcl files #
InstallBin=$(InstallTop)/bin            # where to install picasso #

PicassoLib=$(InstallLib)	# where to find picasso tcl files after install

Top=/usr

TKSRC=$(Top)/src/tk             # where to find tk private include files
TCLSRC=$(Top)/src/tcl           # where to find tcl private include files

TINCLUDES=$(Top)/include	# where to find tk, tclX, and tcl include files #
TLIBDIR=$(Top)/lib		# where to find tcl, tclX, tk, and tkX C libraries #

XINCLUDES=$(Top)/include/X11R5	# where to find X11/<X11R5 include files> #
XLIBDIR=$(Top)/lib/X11R5	# where to find X11R5 libraries #

PPMINCLUDES=$(Top)/include	# where to find ppm include files #
PPMLIBDIR=$(Top)/lib		# where to find ppm libraries #

CC=cc
LD=cc
CFLAGS=-O3

# Geometric transformation of images implies heavy computations.
# Using fastimgeom will cause picasso to use faster, lower quality
# algorithms to compute displayed images. This won't change Postscript
# generated images for which postscript operators are used.

IMGEOM= fastimgeom
#IMGEOM= imgeom

# Inrimage is a private image file format you probably don't know about,
# so you should define HAS_INRIM as 0 and set INRIMLIBS to nothing.

INRIMDEFS= -DHAS_INRIM=0
INRIMLIBS=

#INRIMDEFS= -DHAS_INRIM=1
#INRIMLIBS= -linrimage

################

 DEFINES= -DPicassoLib=\"$(PicassoLib)\" $(INRIMDEFS) $(IMDEFS)
INCLUDES= -I$(TKSRC) -I$(TCLSRC) -I$(TINCLUDES) -I$(XINCLUDES) -I$(PPMINCLUDES) -I.

  TLIBS= -L$(TLIBDIR) -ltkx -ltk -ltclx -ltcl
PPMLIBS= -L$(PPMLIBDIR) -lppm -lpgm -lpbm
  XLIBS= -L$(XLIBDIR) -lX11

.c.o:
	$(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES) $(DEFINES)
.o:
	$(CC) -o $@ $< $(OPT)

TclLibFiles = picasso.tcl piccombine.tcl picgroup.tcl picio.tcl picrc.tcl \
  picbind.tcl picconfig.tcl pichelp.tcl picmisc.tcl pictext.tcl \
  picbuild.tcl picgrid.tcl picimage.tcl picproc.tcl picundo.tcl

Objects = picasso.o $(IMGEOM).o commands.o tclUtil.o \
  tkcanvas/tkCanvArc.o tkcanvas/tkCanvBmap.o tkcanvas/tkCanvDline.o \
  tkcanvas/tkCanvImage.o tkcanvas/tkCanvLatex.o tkcanvas/tkCanvLine.o \
  tkcanvas/tkCanvPoly.o tkcanvas/tkCanvPs.o tkcanvas/tkCanvRrectangle.o \
  tkcanvas/tkCanvTexPos.o tkcanvas/tkCanvText.o tkcanvas/tkCanvWind.o \
  tkcanvas/tkCanvas.o tkcanvas/tkDRectOval.o tkcanvas/tkRectOval.o \
  tkcanvas/tkSwitch.o tkcanvas/tkTrig.o

all : picasso

allg : 
	make CFLAGS="-g" \
             DEFINES="-DPicassoLib=\\\"$(PicassoLib)\\\" -DDEBUG $(INRIMDEFS) $(IMDEFS)" \
             TLIBS="-L$(TLIBDIR) -ltkxg -ltkg -ltclxg -ltclg" \
             LD="cc" \
             all

install : all
	cp picasso $(InstallBin)
	if [ ! -f picrev ]; then echo "Couldn't find revision file"; exit 1; fi
	cp picrev $(InstallLib)/picrev
	cp $(TclLibFiles) $(InstallLib)
	if [ ! -d $(InstallLib)/bitmaps ]; then mkdir $(InstallLib)/bitmaps; fi
	cp bitmaps/*.xbm $(InstallLib)/bitmaps

clean : 
	rm -f *.o picasso *.pure_* lint.out .*~ 

picasso : $(Objects)
	$(LD) -o picasso $(Objects) \
                 $(INRIMLIBS) $(PPMLIBS) $(TLIBS) $(XLIBS) -lm
