#
# 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
#

include ../../MakeVars

LDLIBS    = -lmicocoss$(VERSION) -lmico$(VERSION) $(CONFLIBS)
LDFLAGS  := -L.. -L../../orb $(LDFLAGS)
CXXFLAGS := -I. -I../../include $(CXXFLAGS) $(EHFLAGS)
IDLFLAGS := -I../../include --relative-paths

# generated files

OMG_SRCS = CosObjectIdentity.cc CosRelationships.cc
IMPL_SRCS = IdentifiableObject_impl.cc Role_impl.cc Relationship_impl.cc \
  RelationshipIterator_impl.cc
SRCS = $(OMG_SRCS) $(IMPL_SRCS)

STATIC_OBJS = $(SRCS:.cc=.o)
SHARED_OBJS = $(SRCS:.cc=.pic.o)

# normal rules

all: lib prg

ifeq ($(HAVE_SHARED_EXCEPTS), yes)
ifeq ($(HAVE_STATIC), yes)
lib: .depend $(STATIC_OBJS) $(SHARED_OBJS)
else
lib: .depend $(SHARED_OBJS)
endif
else
lib: .depend $(STATIC_OBJS)
endif

prg: .depend

CosObjectIdentity.h CosObjectIdentity.cc: \
		../../include/mico/CosObjectIdentity.idl $(IDL)
	$(IDL) $(IDLFLAGS) --name CosObjectIdentity \
		../../include/mico/CosObjectIdentity.idl
	cp CosObjectIdentity.h ../../include/mico

CosRelationships.h CosRelationships.cc: \
		../../include/mico/CosRelationships.idl $(IDL)
	$(IDL) $(IDLFLAGS) --name CosRelationships \
		../../include/mico/CosRelationships.idl
	cp CosRelationships.h ../../include/mico


# cleaning

clean:
	-$(RM) *.o *.a *~ *.rpo *.objid nsd nsadmin
	-$(RM) .depend TAGS core nohup.out
	-$(RM) CosObjectIdentity.h CosObjectIdentity.cc
	-$(RM) ../../include/mico/CosObjectIdentity.h
	-$(RM) CosRelationships.h CosRelationships.cc
	-$(RM) ../../include/mico/CosRelationships.h

install:

ifeq (.depend, $(wildcard .depend))
include .depend
endif

.depend :
	echo '# Module dependencies' > .depend
	$(MKDEPEND) $(CXXFLAGS) *.cc >> .depend
