# Generated automatically from Makefile.in by configure.
SHELL = /bin/sh

############################################################################
## ATTENTION LIBRARY PROGRAMMERS:
##
##  At the bottom of this makefile, there is a detachable, self-contained
##  makefile specially designed for compiling standalone programs using
##  Link's libraries.  It gives you the option of including the GUI or not.
##  You can copy this makefile to an empty directory and use it as is, or
##  copy only the appropriate part.  In either case, search for the string
##  LIBRARY_MAKEFILE in this file and read the directions.
############################################################################

OP_SYS		= SunOS-4.1.X-sun4
VERSION         = 3.0b2
VERS-OPT        = -DSTK_VERSION=\"$(VERSION)\"
DFLGS           = -DSTk_CODE -DSUNOS4
TK		= -DUSE_TK

prefix          = /usr/local
stklibdir       = /scratch/berryj/tcl/lib/stk/$(VERSION)/$(OP_SYS)
stkincdir       = /scratch/berryj/tcl/lib/stk/$(VERSION)/include
#stkincdir	= /scratch/berryj/tcl/include

STKINCLUDES     = -I$(stkincdir)
STKFLAGS	= $(MACH) $(VERS-OPT) $(DFLGS) \
		  $(TK) -DHAVE_UNISTD_H=1 -DHAVE_SIGACTION=1 -DHAVE_SELECT=1





top_srcdir      = .
srcdir          = .
LINKBASE        = .
LINKINCL        = /scratch/berryj/link/new_link/link/include

##------------------------------------------------------------------
## got to find flex & bison;  lex and yacc are not good enough
FLEX =   flex
PARSE = bison
##------------------------------------------------------------------

TKINCL          = /scratch/berryj/tcl/lib/stk/3.0b2/include
TCLINCL         = /scratch/berryj/STk-3.0/Tcl
MPINCL         = /scratch/berryj/tcl/lib/stk/3.0b2/include
X11INCL         =  -I/usr/local/X11R5/include 

MPLIB		= /scratch/berryj/STk-3.0/Mp/gmp-1.3.2/libgmp.a
TKLIB		= /scratch/berryj/STk-3.0/Tk/libtk.a
TCLLIB		= /scratch/berryj/STk-3.0/Tcl/libtcl.a

##LIBS =-L$(stklibdir) -L/scratch/berryj/STk-3.0/Mp/gmp-1.3.2 -L/usr/local/gnu/lib   -L/usr/local/X11R5/lib  -lnsl -lX11 -ltcl -lfl -lm

## there is some redundancy here.  The reason is that some places might
## not have STk fully installed.  The MPLIB,TKLIB,TCLLIB (and ..INCL) allow
## you to recover.
LIBS =-L$(stklibdir) -L/scratch/berryj/STk-3.0/Tk   -L/usr/local/X11R5/lib  -lnsl -lXpm -lX11 -lstk $(MPLIB) $(TKLIB) $(TCLLIB) -ldl -lm


### ---------------------Parameters for GNU Compiler---------------------

CC = gcc
CCC = c++
CPPFLAGS = -I. -I$(LINKINCL) $(X11INCL) -I$(TCLINCL) -I$(TKINCL) \
           -I$(MPINCL) $(STKINCLUDES)
GNUFLAGS = -v $(STKFLAGS) -fno-implicit-templates
##### will need -fPIC -B/usr/bin/ -fno-gnu-linker if dynloading ever used
##### not using it now since I need stklos in libstk.a

DEPENDFLAGS = "-D__GNUC__ -I$(LINKINCL) $(X11INCL) -I$(TCLINCL) $(STKINCLUDES)"


## ------------------Parameters for AT&T Sun Compiler---------------------
##  NOT USED RIGHT NOW
# CCC = CC
# ATTINCL = /usr/lang/SC2.0.1/include/CC_413
# CPPFLAGS = "-I../include -I$(X11INCL) -I$(TCLINCL)"
# DEPENDFLAGS =  "-I$(LINKINCL) -I$(ATTINCL) -I$(TCLINCL)"

CCFLAGS = 
#### the following replaces COMPILE.cc, which doesn't seem to be well
#### supported by gnu make.  There should even be the addition:
#### -target $(TARGET_ARCH:-%=%),  but gnu make doesn't support


LINK_COMPILE.c = $(CC) $(CCFLAGS) $(CPPFLAGS) -c 
LINK_COMPILE.cc = $(CCC) $(CCFLAGS) $(CPPFLAGS) -c -DSTK_GUI
LINK_COMPILE_NO_GUI.cc = $(CCC) $(CCFLAGS) $(CPPFLAGS) -c

PROGRAM = Link README

$(PROGRAM): autowrap bin stklos standalone test include src
	cd autowrap; $(MAKE) -f Make.autowrap all
	cd bin; $(MAKE) -f Make.bin all
	cd standalone; $(MAKE) -f Make.standalone all
	cd stklos; $(MAKE) -f Make.stklos all
	cd test; $(MAKE) -f Make.tests all
	cd include; $(MAKE) -f Make.incl all
	cd src; $(MAKE) -f Make.src LINK_COMPILE.c="$(LINK_COMPILE.c)" LINK_COMPILE.cc="$(LINK_COMPILE.cc)" GNUFLAGS="$(GNUFLAGS)" FLEX=$(FLEX) PARSE=$(PARSE) LIBS="$(LIBS)" all

libs: src
	- rm src/algorithm/Animation.o   ### GUI stuff must be removed
	cd src; $(MAKE) -f Make.src \
		LINK_COMPILE.cc="$(LINK_COMPILE.c)" \
		LINK_COMPILE.cc="$(LINK_COMPILE_NO_GUI.cc)" \
		GNUFLAGS="$(GNUFLAGS)" FLEX=$(FLEX) PARSE=$(PARSE) \
		LIBS="$(LIBS)" libs
	- rm src/algorithm/Animation.o   ### so next make will put it back

debug:
	cd include; $(MAKE) -f Make.incl all
	cd src; $(MAKE) -f Make.src LINK_COMPILE.c="$(LINK_COMPILE.c)" LINK_COMPILE.cc="$(LINK_COMPILE.cc)" GNUFLAGS="$(GNUFLAGS)" FLEX=$(FLEX) PARSE=$(PARSE) LIBS="$(LIBS)" all

include:
	mkdir include
	mkdir include/LINK
	mkdir include/LINK/algorithm
	mkdir include/LINK/basic
	mkdir include/LINK/generator
	mkdir include/LINK/graph
	mkdir include/LINK/layout
	mkdir include/LINK/stkWrapper
	mkdir include/LINK/userobj
	mkdir include/LINK/wrappers

standalone:
	mkdir standalone

bin:
	mkdir bin

autowrap:
	mkdir autowrap

test:
	mkdir test
	mkdir test/graphs
	mkdir test/algorithm

src:
	mkdir src
	mkdir src/algorithm
	mkdir src/algorithm/manualSTkWrappers
	mkdir src/basic
	mkdir src/basic/linkTemplates
	mkdir src/basic/STkTemplates
	mkdir src/basic/autogenSTkMethods
	mkdir src/basic/manualSTkMethods
	mkdir src/generator
	mkdir src/generator/manualSTkWrappers
	mkdir src/graph
	mkdir src/graph/linkTemplates
	mkdir src/graph/STkTemplates
	mkdir src/graph/autogenSTkMethods
	mkdir src/graph/manualSTkMethods
	mkdir src/layout
	mkdir src/layout/manualSTkWrappers
	mkdir src/stkWrapper
	mkdir src/userobj
	mkdir src/userobj/linkTemplates
	mkdir src/userobj/STkTemplates
	mkdir src/userobj/autogenSTkMethods
	mkdir src/userobj/manualSTkMethods
	mkdir src/wrappers

stklos:
	mkdir stklos

clean:
	- rm -f config.* Makefile; cd src; make -f Make.src clean

depend:
	cd src; $(MAKE) -f Make.src DEPENDFLAGS=$(DEPENDFLAGS) depend


##########################################################################
## ATTENTION LIBRARY PROGRAMMERS:  LIBRARY_MAKEFILE
##########################################################################
## In order to use this makefile to compile your Link applications,
## add your source files to USER_SOURCE, making sure to end each line
## except the last one with a backslack.  (Replace demo.cc with your
## files).  NOTE:  this makefile links your program with all of the
## Link libraries (layouts, generators, algorithms, graph, and basic).  
## If executable size is a problem for you, edit the LINK_LIBS macro
## below.
##
## The directory $(LINK_PREFIX)/standalone contains the example which this
## makefile is currently set up to build.  The sample programs in this 
## example are demo.cc, demoNoGUI.cc, and linkUserInit.cc.  Try copying 
## this Makefile and those files to an empty directory. Then you can type 
##
##			make demoNoGUI 
##
## to build the first demo.  The GUI
## version is built by switching the comments in USER_SOURCE and 
## EXECUTABLE below and typing 
##
##			make -D STK_GUI=yes demo
##
## Any algorithm you wrap into the user interface can easily be added
## the the "Algorithm" menu of each graph window.  Simply make your own
## copy the file $(LINK_PREFIX)/stklos/graph-menu.stklos and edit it. 
## It will probably not be necessary to learn any Scheme, since you
## should be able to copy the menu entry of an existing algorithm and
## change the name.  If it becomes necessary to make more interesting
## changes, see the STk manual and the GUI part of the Link manual.
## If you put your copy of graph-menu.stklos (and any other interface
## files you wish to customize) in the current directory, they will be
## loaded automatically when the application starts.  If, however, you 
## wish to keep your customized interface files in a separate directory, 
## modify the STK_LOAD_PATH environment variable to include that directory 
## before $(LINK_PREFIX)/stklos.
##########################################################################
USER_SOURCE = \
		demo.cc \
		linkUserInit.cc	# must edit this file and include it 
				# in this list to augment the GUI

#USER_SOURCE = \
#		demoNoGUI.cc  # demoNoGUI.cc is a sample program
#				# using LINK objects, but not the GUI.
## ******************************************************************

## ******************************************************************
## Name your executable file below.
## ******************************************************************
EXECUTABLE = demo
#EXECUTABLE = demoNoGUI
## ******************************************************************

## ******************************************************************
## make -D STK_GUI=yes demo      makes the system with your additions
##
## make demoNoGUI                makes the system with your additions
##				 (assuming you've uncommented the 
##				 appropriate macros above)
## ******************************************************************


######################################################################
###################NO NEED TO CHANGE ANYTHING BELOW THIS POINT########
######################################################################
USER_OBJ = ${USER_SOURCE:.cc=.o}

OP_SYS          = SunOS-4.1.X-sun4
VERSION         = 3.0b2
VERS-OPT        = -DSTK_VERSION=\"$(VERSION)\"
DFLGS           = -DSTk_CODE -DSUNOS4
TK              = -DUSE_TK

prefix          = /usr/local
stklibdir       = /scratch/berryj/tcl/lib/stk/$(VERSION)/$(OP_SYS)
stkincdir       = /scratch/berryj/tcl/lib/stk/$(VERSION)/include
linklibdir      = /scratch/berryj/link/new_link/link/src

STKINCLUDES     = -I$(stkincdir)
STKFLAGS	= $(MACH) $(VERS-OPT) $(DFLGS) \
		  $(TK) -DHAVE_UNISTD_H=1 -DHAVE_SIGACTION=1 -DHAVE_SELECT=1

LINKINCL        = /scratch/berryj/link/new_link/link/include

FLEX =   flex
PARSE = bison

## these are only here to handle nonstandard STk installations
## ***********************************************************
TKINCL          = /scratch/berryj/tcl/lib/stk/3.0b2/include
TCLINCL         = /scratch/berryj/STk-3.0/Tcl
MPINCL         = /scratch/berryj/tcl/lib/stk/3.0b2/include
X11INCL         =  -I/usr/local/X11R5/include

MPLIB           = /scratch/berryj/STk-3.0/Mp/gmp-1.3.2/libgmp.a
TKLIB           = /scratch/berryj/STk-3.0/Tk/libtk.a
TCLLIB          = /scratch/berryj/STk-3.0/Tcl/libtcl.a
## ***********************************************************

## there is some redundancy here.  The reason is that some places might
## not have STk fully installed.  The MPLIB,TKLIB,TCLLIB (and ..INCL) allow
## you to recover.
LIBS =-L$(stklibdir) -L$(linklibdir) -L/scratch/berryj/STk-3.0/Tk    -L/usr/local/X11R5/lib  -lnsl -lXpm -lX11 -lstk -lgmp -ltk -ltcl -ldl -lm

CC = gcc
CCC = c++
CPPFLAGS = -I. -I$(LINKINCL) $(X11INCL) -I$(TCLINCL) -I$(TKINCL) \
           -I$(MPINCL) $(STKINCLUDES)
GNUFLAGS = -v $(STKFLAGS) -fno-implicit-templates
##### will need -fPIC -B/usr/bin/ -fno-gnu-linker if dynloading ever used
##### not using it now since I need stklos in -lstk.a

CCFLAGS = 

#### the following replaces COMPILE.cc, which doesn't seem to be well
#### supported by gnu make.  There should even be the addition:
#### -target $(TARGET_ARCH:-%=%),  but gnu make doesn't support

LINK_COMPILE.cc = $(CCC) $(CCFLAGS) $(CPPFLAGS) -c -DSTK_GUI
LINK_COMPILE_NO_GUI.cc = $(CCC) $(CCFLAGS) $(CPPFLAGS) -c

LINK_LINK_STK.cc = $(LINK_COMPILE.cc:-c=)
LINK_LINK.cc = $(LINK_COMPILE_NO_GUI.cc:-c=)

LINK_LIBS_STK = -lwrappers -llayoutstk -lgenstk -lalgstk -luserobjstk -lgraphstk -lbasicstk -lstkWrapper 

LINK_LIBS = -llayout -lgen -lalg -luserobj -lgraph -lbasic

LDLIBS_STK = $(LIBS) $(LINK_LIBS_STK) $(LINK_LIBS) 
LDLIBS = -L$(linklibdir) $(LINK_LIBS) -lm

SUFFIXES = .cc .o

.cc.o:
	if [ "$(STK_GUI)" = "yes" ]; \
	then \
		$(LINK_COMPILE.cc) $< -o $@; \
	else \
		$(LINK_COMPILE_NO_GUI.cc) $< -o $@; \
	fi

$(EXECUTABLE): $(USER_OBJ) 
	if [ "$(STK_GUI)" = "yes" ]; \
	then \
		$(LINK_LINK_STK.cc) -o $@ $(USER_OBJ) $(LDLIBS_STK); \
	else \
		$(LINK_LINK.cc) -o $@ $(USER_OBJ) $(LDLIBS); \
	fi; \
	strip $@

clean:
	- rm -f *.o $(EXECUTABLE)
