#  Copyright (C) 1997,1998 Shigeru Chiba, University of Tsukuba.
#
#  Permission to use, copy, distribute and modify this software and   
#  its documentation for any purpose is hereby granted without fee,        
#  provided that the above copyright notice appear in all copies and that 
#  both that copyright notice and this permission notice appear in 
#  supporting documentation.
#
#  Shigeru Chiba makes no representations about the suitability of this 
#  software for any purpose.  It is provided "as is" without express or
#  implied warranty.
#
#  Copyright (c) 1995, 1996 Xerox Corporation.
#  All Rights Reserved.
#
#  Use and copying of this software and preparation of derivative works
#  based upon this software are permitted. Any copy of this software or
#  of any derivative work must include the above copyright notice of
#  Xerox Corporation, this paragraph and the one after it.  Any
#  distribution of this software or derivative works must comply with all
#  applicable United States export control laws.
#
#  This software is made available AS IS, and XEROX CORPORATION DISCLAIMS
#  ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#  PURPOSE, AND NOTWITHSTANDING ANY OTHER PROVISION CONTAINED HEREIN, ANY
#  LIABILITY FOR DAMAGES RESULTING FROM THE SOFTWARE OR ITS USE IS
#  EXPRESSLY DISCLAIMED, WHETHER ARISING IN CONTRACT, TORT (INCLUDING
#  NEGLIGENCE) OR STRICT LIABILITY, EVEN IF XEROX CORPORATION IS ADVISED
#  OF THE POSSIBILITY OF SUCH DAMAGES.

# Makefile for Unix platforms

OCC = ../src/Bin/occ

CFLAGS = -g
CXXFLAGS = -g
OCCFLAGS = -I../src -- $(CXXFLAGS)

LIB = ../src/Bin/opencxx.a

%.so : %.mc
	$(OCC) -m $(OCCFLAGS) $<

all : person person2 matrix-test before-test sync-test metaobj-test\
	gclass-test

# VerboseClass

person : VerboseClass.so person.cc
	$(OCC) -- $(CXXFLAGS) -o $@ person.cc

# VerboseClass2

person2 : VerboseClass2.so person2.cc
	$(OCC) -- $(CXXFLAGS) -o $@ person2.cc

# MatrixClass

matrix-test : matrix-test.cc MatrixClass.so matrix.o
	$(OCC) -- $(CXXFLAGS) -o $@ matrix.o matrix-test.cc

matrix.o : MatrixClass.so matrix.cc matrix.h
	$(OCC) -c -- $(CXXFLAGS) matrix.cc

# BeforeClass

before-test : before-test.cc BeforeClass.so
	$(OCC) -- $(CXXFLAGS) -o $@ before-test.cc

# WrapperClass and SyncClass

sync-test : WrapperClass.so SyncClass.so sync-test.cc
	$(OCC) -- $(CXXFLAGS) -o $@ sync-test.cc

# RtmopClass

metaobj-test : RtmopClass.so metaobj.o metaobj-test.cc metaobj.h
	$(OCC) -- $(CXXFLAGS) -o $@ metaobj.o metaobj-test.cc

metaobj.o : RtmopClass.so metaobj.cc metaobj.h
	$(OCC) -c -- $(CXXFLAGS) metaobj.cc

# GraphClass

gclass-test : GraphClass.so baseScript gclass-test.cc
	$(OCC) -- $(CXXFLAGS) -o $@ gclass-test.cc

# House keeping

clean :
	rm -f *~ *.o *.ii *.so *.occ *-init.cc *.exe a.out person person2\
		matrix-test before-test sync-test metaobj-test gclass-test\
		gclass-test.wish
