#-- start of constituent ------

cmt_${CONSTITUENT}_${HASTARGETTAG} = 1

#--------------------------------------------------------

ifdef cmt_${CONSTITUENT}_has_target_tag

ifdef READONLY
cmt_local_tagfile_${CONSTITUENT} = /tmp/CMT_$(${PACKAGE}_tag)_${CONSTITUENT}.make$(cmt_lock_pid)
cmt_final_setup_${CONSTITUENT} = /tmp/CMT_${PACKAGE}_${CONSTITUENT}setup.make
cmt_local_${CONSTITUENT}_makefile = /tmp/CMT_${CONSTITUENT}$(cmt_lock_pid).make
else
cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.make
cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}_${CONSTITUENT}setup.make
cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
endif

${CONSTITUENT}_extratags = -tag_add=target_${CONSTITUENT}

$(cmt_local_tagfile_${CONSTITUENT}) : $(cmt_lock_setup)
	@/bin/echo "------> (constituents.make) Rebuilding setup.make $(cmt_local_tagfile_${CONSTITUENT})"
	@if test -f $(cmt_local_tagfile_${CONSTITUENT}); then /bin/rm -f $(cmt_local_tagfile_${CONSTITUENT}); fi ; \
	  $(cmtexe) -quiet -tag=$(tags) $(${CONSTITUENT}_extratags) build tag_makefile >>$(cmt_local_tagfile_${CONSTITUENT}); \
	  if test -f $(cmt_final_setup_${CONSTITUENT}); then /bin/rm -f $(cmt_final_setup_${CONSTITUENT}); fi; \
	  $(cmtexe) -quiet -tag=$(tags) $(${CONSTITUENT}_extratags) show setup >>$(cmt_final_setup_${CONSTITUENT})
	@/bin/echo setup.make ok

else

ifdef READONLY
cmt_local_tagfile_${CONSTITUENT} = /tmp/CMT_$(${PACKAGE}_tag).make$(cmt_lock_pid)
cmt_final_setup_${CONSTITUENT} = /tmp/CMT_${PACKAGE}setup.make
cmt_local_${CONSTITUENT}_makefile = /tmp/CMT_${CONSTITUENT}$(cmt_lock_pid).make
else
cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).make
cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}setup.make
cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
endif

endif

$(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) build_library_links dirs
	@echo "------> (constituents.make) Building ${CONSTITUENT}.make"; \
	  $(cmtexe) -quiet -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile ${CONSTITUENT} ; \
	  if test ! "$(bin)" = "./"; then /bin/mv -f ${CONSTITUENT}.make $(cmt_local_${CONSTITUENT}_makefile); fi

${CONSTITUENT} :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
	@echo "------> (constituents.make) Starting ${CONSTITUENT}"
	@$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} ${CONSTITUENT}
	@echo "------> (constituents.make) ${CONSTITUENT} done"

clean :: ${CONSTITUENT}clean

${CONSTITUENT}clean :: $(${CONSTITUENT}clean_dependencies) ##$(cmt_local_${CONSTITUENT}_makefile)
	@-if test -f $(cmt_local_${CONSTITUENT}_makefile); then \
	  echo "------> (constituents.make) Starting ${CONSTITUENT}clean"; \
	  $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} ${CONSTITUENT}clean; \
	fi

##	  /bin/rm -f $(cmt_local_${CONSTITUENT}_makefile) $(bin)${CONSTITUENT}_dependencies.make

install :: ${CONSTITUENT}install

${CONSTITUENT}install :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
	@echo "------> (constituents.make) Starting install ${CONSTITUENT}"
	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} install
	@echo "------> (constituents.make) install ${CONSTITUENT} done"

uninstall :: ${CONSTITUENT}uninstall

${CONSTITUENT}uninstall :: $(cmt_local_${CONSTITUENT}_makefile)
	@echo "------> (constituents.make) Starting uninstall ${CONSTITUENT}"
	@-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) cmt_lock_pid=$${cmt_lock_pid} uninstall
	@echo "------> (constituents.make) uninstall ${CONSTITUENT} done"

ifndef PEDANTIC
.DEFAULT::
	@echo "------> (constituents.make) Starting $@ ${CONSTITUENT}"
	@echo Using default action for $@
	@echo "------> (constituents.make) $@ ${CONSTITUENT} done"
endif


#-- end of constituent ------
