## Copyright (C) 1996 DIMACS Center, Rutgers, The State University of New Jersey
## Author(s): Jonathan Berry

## This software is copyrighted by the DIMACS Center at Rutgers, The State
## University of New Jersey.  IT IS PROVIDED AS IS, AND THE AUTHORS, DIMACS, AND
## RUTGERS, THE STATE UNIVERSITY OF NEW JERSEY  DISCLAIM
## ALL LIABILITY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
## DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
## DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
## POSSIBILITY OF SUCH DAMAGE.

## THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
## INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
## IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
## NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
## MODIFICATIONS.

## The authors hereby grant permission to use, copy, modify, distribute,
## and license this software and its documentation for any purpose, provided
## that existing copyright notices are retained in all copies and that this
## notice is included verbatim in any distributions. No written agreement,
## license, or royalty fee is required for any of the authorized uses.
## Modifications to this software may be copyrighted by their authors
## and need not follow the licensing terms described here, provided that
## the new terms are clearly indicated on the first page of each file where
## they apply.

## Last File Update: 31-Jul-1996
## 
# Parameters.

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

UI = 
PROGRAM = Link

# Compiler flags.

LINK_LIBS = libwrappers.a liblayoutstk.a liblayout.a libgenstk.a libgen.a libalgstk.a libalg.a libuserobjstk.a libuserobj.a libgraphstk.a libgraph.a libbasicstk.a libbasic.a libstkWrapper.a 

LDLIBS += $(LINK_LIBS) $(LIBS) 

# Standard targets.

all:	 objects $(PROGRAM)

objects:
	cd basic; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f Make.basic \
						../libbasic.a
	cd basic; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f Make.basic \
						../libbasicstk.a
	cd graph; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" \
			  LINK_COMPILE.c="$(LINK_COMPILE.c)" -f Make.graph \
						../libgraph.a
	cd graph; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f Make.graph \
						../libgraphstk.a
	cd userobj; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" \
					-f Make.userobj ../libuserobj.a
	cd userobj; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" \
					-f Make.userobj ../libuserobjstk.a
	$(NEWLINKBASE)/bin/genInitFiles basic
	$(NEWLINKBASE)/bin/genInitFiles graph
	$(NEWLINKBASE)/bin/genInitFiles userobj
	cd stkWrapper; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" \
					-f Make.stkWrapper libstkWrapper.a
	cd wrappers; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" \
					-f Make.wrappers libwrappers.a
	cd algorithm;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.algorithm libalg.a
	cd algorithm;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.algorithm libalgstk.a
	cd generator;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.generator libgen.a
	cd generator;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.generator libgenstk.a
	cd layout;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.layout liblayout.a
	cd layout;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.layout liblayoutstk.a


libs:
	cd basic; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f Make.basic \
						../libbasic.a
	cd basic; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f Make.basic \
						../libbasicstk.a
	cd graph; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f Make.graph \
						../libgraph.a
	cd graph; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f Make.graph \
						../libgraphstk.a
	cd userobj; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" \
					-f Make.userobj ../libuserobj.a
	cd userobj; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" \
					-f Make.userobj ../libuserobjstk.a
	cd stkWrapper; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" \
					-f Make.stkWrapper libstkWrapper.a
	cd wrappers; $(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" \
					-f Make.wrappers libwrappers.a
	cd algorithm;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.algorithm libalg.a
	cd algorithm;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE_NO_GUI.cc)" -f \
                                                Make.algorithm libalgstk.a
	cd generator;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.generator libgen.a
	cd generator;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.generator libgenstk.a
	cd layout;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.layout liblayout.a
	cd layout;$(MAKE) LINK_COMPILE.cc="$(LINK_COMPILE.cc)" -f \
                                                Make.layout liblayoutstk.a

depend:
	cd basic; $(MAKE) -f Make.basic depend
	cd graph; $(MAKE) -f Make.graph depend
	cd stkWrapper; $(MAKE) -f Make.stkWrapper depend
	cd wrappers; $(MAKE) -f Make.wrappers depend
	cd userobj; $(MAKE) -f Make.userobj depend
	cd algorithm; $(MAKE) -f Make.algorithm depend
	cd generator; $(MAKE) -f Make.generator depend
	cd layout; $(MAKE) -f Make.layout depend

$(PROGRAM): stkWrapper/userinit.o  $(LINK_LIBS)
	$(LINK_LINK.cc) -o $@ stkWrapper/userinit.o $(LDLIBS)

libgraph.a:
	cd graph; $(MAKE) -f Make.graph libgraph.a

libgraphstk.a:
	cd graph; $(MAKE) -f Make.graph libgraphstk.a

libbasic.a:
	cd basic; $(MAKE) -f Make.basic libbasic.a

libbasicstk.a:
	cd basic; $(MAKE) -f Make.basic libbasicstk.a

libstkWrapper.a:
	cd stkWrapper; $(MAKE) -f Make.stkWrapper libstkWrapper.a

libwrappers.a:
	cd wrappers; $(MAKE) -f Make.wrappers libwrappers.a

libuserobj.a:
	cd userobj; $(MAKE) -f Make.userobj libuserobj.a

libalg.a:
	cd algorithm; $(MAKE) -f Make.algorithm libalg.a

libalgstk.a:
	cd algorithm; $(MAKE) -f Make.algorithm libalgstk.a

libgen.a:
	cd generator; $(MAKE) -f Make.generator libgen.a

libgenstk.a:
	cd generator; $(MAKE) -f Make.generator libgenstk.a

liblayout.a:
	cd layout; $(MAKE) -f Make.layout liblayout.a

liblayoutstk.a:
	cd layout; $(MAKE) -f Make.layout liblayoutstk.a

clean:
	cd basic; make -f Make.basic clean
	cd graph;  make -f Make.graph clean
	cd stkWrapper;  make -f Make.stkWrapper clean
	cd wrappers;  make -f Make.wrappers clean
	cd userobj;  make -f Make.userobj clean
	cd algorithm;  make -f Make.algorithm clean
	cd generator;  make -f Make.generator clean
	cd layout;  make -f Make.layout clean
	-rm -r ptrepository
	-rm liblayout.a liblayoutstk.a libgen.a libgenstk.a libalg.a libalgstk.a libalg.a libbasicstk.a libbasic.a libgraphstk.a libgraph.a libstkWrapper.a libwrappers.a libuserobjstk.a libuserobj.a
