# Generated automatically from Makefile.in by configure.
#
# Makefile for Stk version of BLT
# 
# Copyright (C) 1993, 1994 Erick Gallesio - I3S - CNRS / UNSA <eg@unice.fr>
# 
# Permission to use, copy, and/or distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that both the above copyright notice and this permission notice appear in
# all copies and derived works.  Fees for distribution or use of this
# software or derived works may only be charged with express written
# permission of the copyright holder.  
# This software is provided ``as is'' without express or implied warranty.
#
#           Author: Erick Gallesio [eg@unice.fr]
#    Creation date: 25-Jul-1994 11:53
# Last file update: 11-Feb-1995 21:58
#

BLT		=./blt-1.7
STK		= ..

include $(STK)/config.make

USING		= -DUSE_TK
CFLAGS		= $(STKCFLAGS) $(USING) $(DYNLOAD) $(DFLGS) $(OPTS)  -DHAVE_UNISTD_H=1 \
		  -I. -I $(STK)/Src -I$(STK)/Tk -I$(STK)/Tcl -I$(STK)/Mp \
		   $(XINCLUDES) -DSTK_LIBRARY=\"$(libdir)\"
INSTALL		= cp

# Shared objects
SOBJ= so/bltGraph.o so/bltGrAxis.o so/bltGrBar.o so/bltGrElem.o \
      so/bltGrHairs.o so/bltGrLegd.o so/bltGrLine.o so/bltGrMisc.o\
      so/bltGrPS.o so/bltGrTag.o so/bltCutbuffer.o so/bltBell.o \
      so/bltBitmap.o so/bltBusy.o so/bltDragDrop.o so/bltHtext.o \
      so/bltList.o so/bltTable.o  so/bltUtil.o so/bltWin.o

# Objects
OBJ=  o/bltGraph.o o/bltGrAxis.o o/bltGrBar.o o/bltGrElem.o \
      o/bltGrHairs.o o/bltGrLegd.o o/bltGrLine.o o/bltGrMisc.o\
      o/bltGrPS.o o/bltGrTag.o o/bltCutbuffer.o o/bltBell.o \
      o/bltBitmap.o o/bltBusy.o o/bltDragDrop.o o/bltHtext.o \
      o/bltList.o o/bltTable.o  o/bltUtil.o o/bltWin.o

TKLIB		= $(STK)/Tk/libtk.a
TCLLIB		= $(STK)/Tcl/libtcl.a 
MPLIB		= $(STK)/Mp/$(MP).a
LIBS    	=  -lnsl -ldl -lm

ALLIBS	= $(MPLIB) $(TKLIB) $(TCLLIB) 

what:
	@echo "You must specify 'static' or 'dynamic' for make"

stk-bin: libstk.a $(ALLIBS)
	/bin/rm -f stk-bin
	$(CC) $(CFLAGS) -o stk-bin userinit.c libstk.a $(ALLIBS) $(XLIBSW) $(LIBS)

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

static: libblt.a 
	/bin/rm -f stk-bin
	$(CC) $(CFLAGS) -o stk-bin userinit.c $(STK)/Src/libstk.a libblt.a $(ALLIBS) $(XLIBSW) $(LIBS)
	

dynamic: blt.so

blt.so: 
	@echo "Make dynamic version"
	(cd $(BLT); \
	 make CC=$(CC) CFLAGS="$(CFLAGS)" \
	      SHLIB_CCFLAGS="$(SHLIB_CCFLAGS)" sharedlib)
	$(CC) -c $(SHLIB_CCFLAGS) $(CFLAGS) -o blt.o blt.c
	$(SHLIB_LOADER) $(SHLIB_LDFLAGS) blt.so blt.o $(SOBJ)
	
libblt.a: 
	@echo "Make static version"
	(cd $(BLT); make CC=$(CC) CFLAGS="$(CFLAGS)" normallib)
	$(CC) -c $(CFLAGS) -o blt.o blt.c
	ar rc libblt.a blt.o $(OBJ)
	$(RANLIB) libblt.a

install:
	@if test -f blt.so ;then \
	   $(INSTALL) blt.so $(execdir); \
	fi
	@if test -f stk-bin; then \
	   $(INSTALL) stk-bin $(execdir); \
	fi
	$(INSTALL) blt.stk $(libdir)/STk;
	$(INSTALL) dd-protocol.stk $(libdir)/STk;
	$(INSTALL) dd-protocol.stklos $(libdir)/STk;

clean:
	(cd $(BLT); make clean)
	/bin/rm -f blt.o blt.so stk-bin libblt.a *~ core 
