
SUFFIXES += .ice _ice.py
CLEANFILES += *.ice.cc *.ice.h
CLEANFILES += $(patsubst %.ice,%.h, $(filter %.ice, $(SOURCES))) 
CLEANFILES += $(patsubst %.ice,%.cc, $(filter %.ice, $(SOURCES)))
CLEANFILES += $(patsubst %.ice,%_ice.py, $(filter %.ice, $(SOURCES)))
CLEANFILES += $(patsubst %.ice,%_ice.pyc, $(filter %.ice, $(SOURCES)))

SLICE_INC = -I$(srcdir) $(ICE_SLICEFILES) $(NICE_SLICEFILES) -I$(prefix)/slice 
SLICE_COPT = --include-dir $(@D) --output-dir $(@D)
#SLICE_PYOPT = --output-dir $(DESTDIR)${pythondir}/
SLICE_PYOPT = --output-dir $(@D)

BUILT_SOURCES = $(patsubst %.ice, %.cc, $(filter %.ice, $(SOURCES)))


SLICE2PYIT=if ! $(ICE_SLICE2PY) $(SLICE_INC) $(SLICE_PYOPT) $<; then \
            exit -1; \
          fi;

SLICEIT=if ! $(ICE_SLICE2CPP) $(SLICE_INC) $(SLICE_COPT) --source-ext=cc --header-ext=h $<; then \
           exit -1; \
        fi; \
        if test "$(ICE_SLICE2PY)" != "no"; then \
          if ! flock $(ICE_SLICE2PY) -c "$(SLICE2PYIT)"; then \
            exit -1; \
          fi; \
        fi; 


AM_V_SLICE = $(am__v_SLICE_$(V))
am__v_SLICE_ = $(am__v_SLICE_$(AM_DEFAULT_VERBOSITY))
am__v_SLICE_0 = @echo "  SLICE " $@; $(SLICEIT)
am__v_SLICE_1 = $(SLICEIT)


.ice.cc:
	$(AM_V_SLICE)

clean-local-ice: 
	if test "$(ICE_SLICE2PY)" != "no"; then \
     icelist='$(filter %.ice, $(SOURCES))'; \
     if test "x$$icelist" != "x"; then \
      list=`cat $(srcdir)/$$icelist | grep module | sed -e "s/module//"  | tr [:cntrl:] " "`; \
        for i in $$list; do \
          rm -rf $$i/__init__.py; \
          echo "rm -rf $$i/__init__.py"; \
        done; \
    fi; \
   fi;


all-local-ice: 

install-data-hook-ice:
	@list='$(filter %.ice, $(SOURCES))'; \
   if test "x$(NOINSTALL)" == "x"; then \
     for i in $$list; do \
       $(install_sh_DATA) $(srcdir)/$$i $(DESTDIR)${prefix}/slice/$$i; \
       echo "$(install_sh_DATA) $(srcdir)/$$i $(DESTDIR)${prefix}/slice/$$i"; \
     done; \
   fi;
	@list='$(patsubst %.ice,%.h, $(filter %.ice, $(SOURCES)))'; \
   if test "x$(NOINSTALL)" == "x"; then \
     for i in $$list; do \
       $(install_sh_DATA) $$i $(DESTDIR)${includedir}/$$i; \
       echo "$(install_sh_DATA) $$i $(DESTDIR)${includedir}/$$i"; \
     done; \
   fi; 
	@list='$(patsubst %.ice,%_ice.py, $(filter %.ice, $(SOURCES)))'; \
   if test "$(ICE_SLICE2PY)" != "no"; then \
     for i in $$list; do \
       $(install_sh_DATA) $$i $(DESTDIR)${pyexecdir}/$$i; \
       echo "$(install_sh_DATA) $$i $(DESTDIR)${pyexecdir}/$$i"; \
     done; \
   fi; 
	@if test "$(ICE_SLICE2PY)" != "no"; then \
     icelist='$(filter %.ice, $(SOURCES))'; \
     if test "x$$icelist" != "x"; then \
        list=`cat $(srcdir)/$$icelist | grep module | sed -e "s/module//"  | tr [:cntrl:] " "`; \
        for i in $$list; do \
          if test -n "$(DESTDIR)$(pyexecdir)/$$i"; then \
            echo "$(MKDIR_P) $(DESTDIR)$(pyexecdir)/$$i"; \
            $(MKDIR_P) "$(DESTDIR)$(pyexecdir)/$$i" || exit 1; \
          fi; \
          $(install_sh_DATA) $$i/__init__.py $(DESTDIR)${pyexecdir}/$$i/__init__.py; \
          echo "$(install_sh_DATA) $$i/__init__.py $(DESTDIR)${pyexecdir}/$$i/__init__.py"; \
        done; \
    fi; \
   fi;

uninstall-hook-ice:
	@list='$(filter %.ice, $(SOURCES))'; \
     if test "x$(NOINSTALL)" == "x"; then \
       for i in $$list; do \
          rm -f $(DESTDIR)${prefix}/slice/$$i; \
          echo "rm -f $(DESTDIR)${prefix}/slice/$$i"; \
       done; \
     fi; 
	@list='$(patsubst %.ice,%.h, $(filter %.ice, $(SOURCES)))'; \
     if test "x$(NOINSTALL)" == "x"; then \
        for i in $$list; do \
          rm -f $(DESTDIR)${includedir}/$$i; \
          echo "rm -f $(DESTDIR)${includedir}/$$i"; \
        done; \
     echo $(patsubst %.py,%, $(nodist_python_PYTHON)) ${pythondir}; \
    fi;
	@list='$(patsubst %.ice,%_ice.py, $(filter %.ice, $(SOURCES)))'; \
   if test "$(ICE_SLICE2PY)" != "no"; then \
     for i in $$list; do \
       rm -f $(DESTDIR)${pyexecdir}/$$i; \
       echo "rm -f $(DESTDIR)${pyexecdir}/$$i"; \
     done; \
   fi; 
	@if test "$(ICE_SLICE2PY)" != "no"; then \
     icelist='$(filter %.ice, $(SOURCES))'; \
     if test "x$$icelist" != "x"; then \
      list=`cat $(srcdir)/$$icelist | grep module | sed -e "s/module//"  | tr [:cntrl:] " "`; \
        for i in $$list; do \
          rm -rf $(DESTDIR)${pyexecdir}/$$i/__init__.py; \
          echo "rm -rf $(DESTDIR)${pyexecdir}/$$i/__init__.py"; \
          if test -e "$(DESTDIR)$(pyexecdir)/$$i"; then \
           if ! ["$(ls -A $(DESTDIR)$(pyexecdir)/$$i)" ]; then \
            rmdir $(DESTDIR)$(pyexecdir)/$$i; \
            echo "rmdir $(DESTDIR)$(pyexecdir)/$$i"; \
           fi; \
          fi; \
        done; \
    fi; \
   fi;
   
   
