#
# MICO --- a free CORBA implementation
# Copyright (C) 1997 Kay Roemer & Arno Puder
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Send comments and/or bug reports to:
#                mico@informatik.uni-frankfurt.de
#

all: .depend everything

include ../MakeVars

CXXFLAGS  := $(COS_CXXFLAGS) $(CXXFLAGS)
LDLIBS    := $(COS_LDLIBS) $(LDLIBS)
LDFLAGS   := -L. $(COS_LDFLAGS) $(LDFLAGS)
DEPS      := $(COS_DEPS) $(DEPS)

INSTALL_DIR     = relship
INSTALL_SRCS    = Makefile Bank.idl Person.idl Ownership.idl Employment.idl \
  Documents.idl Containment.idl Reference.idl \
  Bank_impl.cc Person_impl.cc Ownership_impl.cc Employment_impl.cc \
  Documents_impl.cc Containment_impl.cc Reference_impl.cc \
  InterfaceDefsHelper.cc NamedRoleTypesHelper.cc \
  Bank_impl.h Person_impl.h Ownership_impl.h Employment_impl.h \
  Documents_impl.h Containment_impl.h Reference_impl.h \
  InterfaceDefsHelper.h NamedRoleTypesHelper.h \
  BankServer.cc PersonServer.cc RelationshipIteratorServer.cc \
  RoleFactoryServer.cc RelationshipFactoryServer.cc EmployerRoleServer.cc \
  EmployeeRoleServer.cc EmploymentServer.cc OwnerRoleServer.cc \
  OwnedByRoleServer.cc OwnershipServer.cc FigureServer.cc TextServer.cc \
  ContainsRoleServer.cc ContainedInRoleServer.cc ContainmentServer.cc \
  ReferencesRoleServer.cc ReferencedByRoleServer.cc ReferenceServer.cc \
  simple-client.cc test-client.cc interactive-client.cc
INSTALL_SCRIPTS = interactive simple test start-servers stop-servers

LIB_SRCS := Bank.cc Person.cc Ownership.cc Employment.cc Documents.cc \
  Containment.cc Reference.cc \
  Bank_impl.cc Person_impl.cc Ownership_impl.cc Employment_impl.cc \
  Documents_impl.cc Containment_impl.cc Reference_impl.cc \
  InterfaceDefsHelper.cc NamedRoleTypesHelper.cc

LIB_OBJS := $(LIB_SRCS:.cc=.pic.o)


PRGS := BankServer.elf PersonServer.elf RelationshipIteratorServer.elf \
  RoleFactoryServer.elf RelationshipFactoryServer.elf EmployerRoleServer.elf \
  EmployeeRoleServer.elf EmploymentServer.elf OwnerRoleServer.elf \
  OwnedByRoleServer.elf OwnershipServer.elf FigureServer.elf TextServer.elf \
  ContainsRoleServer.elf ContainedInRoleServer.elf ContainmentServer.elf \
  ReferencesRoleServer.elf ReferencedByRoleServer.elf ReferenceServer.elf \
  simple-client.elf test-client.elf interactive-client.elf

everything: libdemo.$(SOEXT) $(PRGS)

libdemo.$(SOEXT): $(LIB_OBJS)
ifeq ($(HAVE_REPO), yes)
	-$(LD) $(CXXFLAGS) $(LIB_OBJS) $(LDFLAGS) $(LDLIBS)
endif
	rm -f $@
	$(LDSO) -o libdemo $(LIB_OBJS) $(LDFLAGS) $(LDLIBS)

%.elf: %.o
	$(LD) $(CXXFLAGS) -L. $(LDFLAGS) $< -ldemo $(LDLIBS) -o $@

%.cc %.h: %.idl
	$(IDL) $(IDLFLAGS) $<

clean:
	rm -f .depend *.o core *.elf *~ *.$(SOEXT) *.pid imr-db ir-db.idl
	rm -f Bank.cc Bank.h Person.cc Person.h Ownership.cc Ownership.h \
	  Employment.cc Employment.h Documents.cc Documents.h \
	  Containment.cc Containment.h Reference.cc Reference.h

