# ------------------------------------------------------------------------
# 	Makefile for shared version of BLT library
# ------------------------------------------------------------------------

SHLIB_SUFFIX =	@SHLIB_SUFFIX@
version =	@BLT_MAJOR_VERSION@@BLT_MINOR_VERSION@

# ------------------------------------------------------------------------
# 	C Compiler options 
# ------------------------------------------------------------------------

CC =		@CC@
CFLAGS =	@CFLAGS@ 
EXTRA_CFLAGS =	@GCCFLAGS@ @SHLIB_CFLAGS@
DEFINES =	@DEFINES@
DEF_BLTINIT =	-DBLT_LIBRARY=\"$(scriptdir)\"
SHLIB_LD_FLAGS = @SHLIB_LD_FLAGS@ @LD_RUN_PATH@
SHLIB_TCL_ONLY_LIB_SPECS = @SHLIB_TCL_ONLY_LIB_SPECS@ 
SHLIB_LIB_SPECS = @SHLIB_LIB_SPECS@ 
SHLIB_LD =	@SHLIB_LD@
LDFLAGS =	@LDFLAGS@ @LD_RUN_PATH@

prefix =	@prefix@
exec_prefix =	@exec_prefix@
libdir =	@libdir@
bindir =	$(exec_prefix)/bin
srcdir =	@srcdir@/..

instdirs =	$(exec_prefix) $(libdir) 

scriptdir =	@BLT_LIBRARY@

LIBS =		@LIB_SPECS@ @EXTRA_LIB_SPECS@
TCL_ONLY_LIB_SPECS = @TCL_ONLY_LIB_SPECS@ @EXTRA_LIB_SPECS@

# ------------------------------------------------------------------------
# 	Don't edit anything beyond this point
# ------------------------------------------------------------------------

N_OBJS =	bltTed.o
V3_OBJS =	bltTri.o bltGrMt.o 

TK_OBJS =	tkButton.o tkFrame.o bltScrollbar.o 

GRAPH_OBJS =	bltGrAxis.o \
		bltGrBar.o \
		bltGrElem.o \
		bltGrGrid.o \
		bltGrHairs.o \
		bltGrLegd.o \
		bltGrLine.o \
		bltGrMarker.o \
		bltGrMisc.o \
		bltGrPen.o \
		bltGrPs.o \
		bltGraph.o 

TCL_ONLY_OBJS =	bltAlloc.o \
		bltArrayObj.o \
		bltBgexec.o \
		bltChain.o \
		bltDebug.o \
		bltHash.o \
		bltList.o \
		bltNsUtil.o \
		bltParse.o \
		bltPool.o \
		bltSpline.o \
		bltSwitch.o \
		bltTree.o \
		bltTreeCmd.o \
		bltUnixPipe.o \
		bltUtil.o \
		bltVector.o \
		bltVecMath.o \
		bltVecCmd.o \
		bltVecObjCmd.o \
		bltWatch.o  

OBJS =		$(GRAPH_OBJS) \
		$(TCL_ONLY_OBJS) \
		bltBeep.o \
		bltBind.o \
		bltBitmap.o \
		bltBusy.o \
		bltCanvEps.o \
		bltColor.o \
		bltConfig.o \
		bltContainer.o \
		bltCutbuffer.o \
		bltDragdrop.o \
		bltHierbox.o \
		bltHtext.o \
		bltImage.o \
		bltUnixImage.o \
		bltPs.o \
		bltTable.o \
		bltTabnotebook.o \
		bltTabset.o \
		bltText.o \
		bltTile.o \
		bltTreeView.o \
		bltTreeViewCmd.o \
		bltTreeViewColumn.o \
		bltTreeViewEdit.o \
		bltTreeViewStyle.o \
		bltUnixDnd.o \
		bltWindow.o \
		bltObjConfig.o \
		bltWinop.o \
		$(TK_OBJS) $(N_OBJS) 

INCLUDES =	-I.. -I$(srcdir) -I$(srcdir)/.. @INCLUDES@
CC_SWITCHES =	$(EXTRA_CFLAGS) $(CFLAGS) $(DEFINES) $(INCLUDES)
INSTALL =	@INSTALL@
INSTALL_DATA =	@INSTALL_DATA@
INSTALL_ROOT =  
SHELL =		/bin/sh
RM =		rm -f
LN_S =		@LN_S@
bltwish =	bltwish$(version)
bltsh =		bltsh$(version)
lib_so =	libBLT$(version)$(SHLIB_SUFFIX)
tcl_only_lib_so = libBLTlite$(version)$(SHLIB_SUFFIX)

all: build_lib build_demo

build_demo: $(bltwish) $(bltsh)

$(bltwish): $(lib_so)
	$(RM) $(bltwish)
	$(CC) $(CC_SWITCHES) $(LDFLAGS) -o $(bltwish) \
		$(srcdir)/bltUnixMain.c $(lib_so) $(LIBS) 

$(bltsh): $(tcl_only_lib_so)
	$(RM) $(bltsh)
	$(CC) $(CC_SWITCHES) $(LDFLAGS) -DTCL_ONLY -o $(bltsh) \
		$(srcdir)/bltUnixMain.c $(tcl_only_lib_so) \
		$(TCL_ONLY_LIB_SPECS) 

build_lib: $(lib_so) $(tcl_only_lib_so)

$(lib_so): $(OBJS)
	$(CC) -c $(CC_SWITCHES) -DBLT_LIBRARY=\"$(scriptdir)\" \
		$(srcdir)/bltInit.c
	$(RM) $@
	$(SHLIB_LD) $(SHLIB_LD_FLAGS) -o $@ bltInit.o $(OBJS) \
		$(SHLIB_LIB_SPECS)

$(tcl_only_lib_so): $(TCL_ONLY_OBJS)
	$(CC) -c $(CC_SWITCHES) -DTCL_ONLY -DBLT_LIBRARY=\"$(scriptdir)\" \
		$(srcdir)/bltInit.c
	$(RM) $@
	$(SHLIB_LD) $(SHLIB_LD_FLAGS) -o $@ bltInit.o $(TCL_ONLY_OBJS) \
		$(SHLIB_TCL_ONLY_LIB_SPECS)

install: mkdirs install-lib install-demo

install-demo: $(bltwish)
	$(INSTALL) -m 0755 bltwish$(version) $(INSTALL_ROOT)$(bindir)
	$(INSTALL) -m 0755 bltsh$(version) $(INSTALL_ROOT)$(bindir)

install-lib: $(lib_so) $(tcl_only_lib_so)
	$(INSTALL) -m 0755 $(lib_so) $(INSTALL_ROOT)$(libdir)
	$(INSTALL) -m 0755 $(tcl_only_lib_so) $(INSTALL_ROOT)$(libdir)

mkdirs:
	@for i in $(instdirs) ; do \
          if test -d $(INSTALL_ROOT)$$i ; then \
	    : ;\
	  else \
	    echo " mkdir $(INSTALL_ROOT)$$i" ; \
            mkdir $(INSTALL_ROOT)$$i ; \
	  fi ; \
        done
clean:
	$(RM) $(OBJS) $(lib_so) $(tcl_only_lib_so) $(bltwish) $(bltsh) \
		*pure* .pure* 

distclean: clean
	$(RM) $(srcdir)/*.bak $(srcdir)/*\~ $(srcdir)/"#"* 

# ------------------------------------------------------------------------
# 	in lieu of viewpath-ing...
#
bltAlloc.o: 	$(srcdir)/bltAlloc.c
	$(CC) -c $(CC_SWITCHES) $?
bltArrayObj.o: 	$(srcdir)/bltArrayObj.c
	$(CC) -c $(CC_SWITCHES) $?
bltBeep.o: 	$(srcdir)/bltBeep.c 
	$(CC) -c $(CC_SWITCHES) $?
bltBgexec.o: 	$(srcdir)/bltBgexec.c
	$(CC) -c $(CC_SWITCHES) $?
bltBind.o: 	$(srcdir)/bltBind.c
	$(CC) -c $(CC_SWITCHES) $?
bltBitmap.o: 	$(srcdir)/bltBitmap.c
	$(CC) -c $(CC_SWITCHES) $?
bltBusy.o: 	$(srcdir)/bltBusy.c
	$(CC) -c $(CC_SWITCHES) $?
bltCanvEps.o: 	$(srcdir)/bltCanvEps.c
	$(CC) -c $(CC_SWITCHES) $?
bltColor.o: 	$(srcdir)/bltColor.c       
	$(CC) -c $(CC_SWITCHES) $?
bltConfig.o: 	$(srcdir)/bltConfig.c       
	$(CC) -c $(CC_SWITCHES) $?
bltObjConfig.o: $(srcdir)/bltObjConfig.c       
	$(CC) -c $(CC_SWITCHES) $?
bltContainer.o: $(srcdir)/bltContainer.c
	$(CC) -c $(CC_SWITCHES) $?
bltCutbuffer.o: $(srcdir)/bltCutbuffer.c
	$(CC) -c $(CC_SWITCHES) $?
bltDebug.o: $(srcdir)/bltDebug.c
	$(CC) -c $(CC_SWITCHES) $?
bltDragdrop.o: $(srcdir)/bltDragdrop.c
	$(CC) -c $(CC_SWITCHES) $?
bltUnixDnd.o: $(srcdir)/bltUnixDnd.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrAxis.o:	$(srcdir)/bltGrAxis.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrBar.o:	$(srcdir)/bltGrBar.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrElem.o:	$(srcdir)/bltGrElem.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrGrid.o:	$(srcdir)/bltGrGrid.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrHairs.o:	$(srcdir)/bltGrHairs.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrLegd.o: 	$(srcdir)/bltGrLegd.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrLine.o:	$(srcdir)/bltGrLine.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrMisc.o: 	$(srcdir)/bltGrMisc.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrPen.o: 	$(srcdir)/bltGrPen.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrPs.o: 	$(srcdir)/bltGrPs.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrMarker.o: 	$(srcdir)/bltGrMarker.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrMt.o: 	$(srcdir)/bltGrMt.c
	$(CC) -c $(CC_SWITCHES) $?
bltGrCont.o: 	$(srcdir)/bltGrCont.c
	$(CC) -c $(CC_SWITCHES) $?
bltGraph.o:	$(srcdir)/bltGraph.c
	$(CC) -c $(CC_SWITCHES) $?
bltHash.o: 	$(srcdir)/bltHash.c
	$(CC) -c $(CC_SWITCHES) $?
bltHierbox.o: 	$(srcdir)/bltHierbox.c
	$(CC) -c $(CC_SWITCHES) $?
bltHtext.o: 	$(srcdir)/bltHtext.c
	$(CC) -c $(CC_SWITCHES) $?
bltImage.o: 	$(srcdir)/bltImage.c       
	$(CC) -c $(CC_SWITCHES) $?
bltUnixImage.o: $(srcdir)/bltUnixImage.c       
	$(CC) -c $(CC_SWITCHES) $?
bltList.o: 	$(srcdir)/bltList.c
	$(CC) -c $(CC_SWITCHES) $?
bltChain.o: 	$(srcdir)/bltChain.c
	$(CC) -c $(CC_SWITCHES) $?
bltNsUtil.o: 	$(srcdir)/bltNsUtil.c
	$(CC) -c $(CC_SWITCHES) $?
bltParse.o: 	$(srcdir)/bltParse.c
	$(CC) -c $(CC_SWITCHES) $?
bltPool.o: 	$(srcdir)/bltPool.c
	$(CC) -c $(CC_SWITCHES) $?
bltPs.o: 	$(srcdir)/bltPs.c
	$(CC) -c $(CC_SWITCHES) $?
bltSpline.o: 	$(srcdir)/bltSpline.c
	$(CC) -c $(CC_SWITCHES) $?
bltSwitch.o: 	$(srcdir)/bltSwitch.c
	$(CC) -c $(CC_SWITCHES) $?
bltTable.o: 	$(srcdir)/bltTable.c
	$(CC) -c $(CC_SWITCHES) $?
bltTabset.o: 	$(srcdir)/bltTabset.c
	$(CC) -c $(CC_SWITCHES) $?
bltTabnotebook.o: $(srcdir)/bltTabnotebook.c
	$(CC) -c $(CC_SWITCHES) $?
bltTed.o: 	$(srcdir)/bltTed.c
	$(CC) -c $(CC_SWITCHES) $?
bltText.o: 	$(srcdir)/bltText.c
	$(CC) -c $(CC_SWITCHES) $?
bltTile.o: 	$(srcdir)/bltTile.c
	$(CC) -c $(CC_SWITCHES) $?
bltTree.o: 	$(srcdir)/bltTree.c
	$(CC) -c $(CC_SWITCHES) $?
bltTreeCmd.o: 	$(srcdir)/bltTreeCmd.c
	$(CC) -c $(CC_SWITCHES) $?
bltTreeView.o: 	$(srcdir)/bltTreeView.c
	$(CC) -c $(CC_SWITCHES) $?
bltTreeViewCmd.o: $(srcdir)/bltTreeViewCmd.c
	$(CC) -c $(CC_SWITCHES) $?
bltTreeViewColumn.o: $(srcdir)/bltTreeViewColumn.c
	$(CC) -c $(CC_SWITCHES) $?
bltTreeViewEdit.o: $(srcdir)/bltTreeViewEdit.c
	$(CC) -c $(CC_SWITCHES) $?
bltTreeViewStyle.o: $(srcdir)/bltTreeViewStyle.c
	$(CC) -c $(CC_SWITCHES) $?
bltTri.o: 	$(srcdir)/bltTri.c
	$(CC) -c $(CC_SWITCHES) $?
bltVector.o: 	$(srcdir)/bltVector.c
	$(CC) -c $(CC_SWITCHES) $?
bltVecObjCmd.o: $(srcdir)/bltVecObjCmd.c
	$(CC) -c $(CC_SWITCHES) $?
bltVecCmd.o: 	$(srcdir)/bltVecCmd.c
	$(CC) -c $(CC_SWITCHES) $?
bltVecMath.o: 	$(srcdir)/bltVecMath.c
	$(CC) -c $(CC_SWITCHES) $?
bltWatch.o:	$(srcdir)/bltWatch.c
	$(CC) -c $(CC_SWITCHES) $?
bltWindow.o: 	$(srcdir)/bltWindow.c       
	$(CC) -c $(CC_SWITCHES) $?
bltWinop.o:     $(srcdir)/bltWinop.c
	$(CC) -c $(CC_SWITCHES) $?
bltUnixPipe.o: 	$(srcdir)/bltUnixPipe.c
	$(CC) -c $(CC_SWITCHES) $?
bltUtil.o: 	$(srcdir)/bltUtil.c
	$(CC) -c $(CC_SWITCHES) $?
tkButton.o: 	$(srcdir)/tkButton.c
	$(CC) -c $(CC_SWITCHES) $?
tkFrame.o: 	$(srcdir)/tkFrame.c
	$(CC) -c $(CC_SWITCHES) $?
tkMenubutton.o: $(srcdir)/tkMenubutton.c
	$(CC) -c $(CC_SWITCHES) $?
bltScrollbar.o: $(srcdir)/bltScrollbar.c
	$(CC) -c $(CC_SWITCHES) $?
