#=======================================================================
# Begin specific part to omniorb 
# (include from file adm/unix/make_omniorb generated by 
# adm/unix/make_omniorb.in)
#=======================================================================
# -* Makefile *- 
#
# Author : Patrick GOLDBRONN (CEA)
# Date : 29/06/2001
# $Header$
#

# Client and server object are the same with omniorb
# There are one header file and one source file generate

#IDLOBJ=$(IDLSRC:%.idl=%$(IDL_CLN_OBJ))

# dependancies between idl and it's generated files
%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${KERNEL_ROOT_DIR}/idl/salome/%.idl
	$(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<

%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${GUI_ROOT_DIR}/idl/salome/%.idl
	$(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<

%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${top_srcdir}/idl/%.idl
	$(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<

# dependncies between idl files
depend_idl: .depidl

# we use cpp to generate dependencies between idl files.
# we change cpp output to keep only idl file and transform it to get a suitable rule
.depidl: $(IDL_FILES)
	@touch $@
	@for dep in $? dummy; do \
	  if [ $$dep != "dummy" ]; then \
	    echo Building dependencies for $$dep; \
	    basedep=`basename $$dep .idl`; \
	    header="$$basedep"$(IDL_CLN_H); \
	    sed '\%^'"$$header"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \
	    $(CPP) $(C_DEPEND_FLAG) -I$(srcdir) $$dep 2>/dev/null | \
	    sed `echo "s%$$basedep\\.idl%$$header:%g"` | \
	    sed 's% $(srcdir)/% %g' | \
	    sed 's% $(top_srcdir)/% %g' | \
	    sed 's% $(top_builddir)/% %g' | \
	    sed 's%^.*:\.o: *%%' | sed 's%^ *\\ *%%'| sed 's%^ *\(.*\):%\1:%' | \
	    sed 's/\.idl/$(IDL_CLN_H)/' >>$@; \
	    echo ''  >>$@; \
	  fi; \
	done ;

-include .depidl

#=======================================================================
# End specific part to omniorb 
#=======================================================================
