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

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

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

!if defined (cmt_${CONSTITUENT}_has_target_tag)

cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.nmake
cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}_${CONSTITUENT}_setup.nmake
cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.nmake

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

!if [if not exist $(bin) mkdir $(bin)] == 0
!endif

!if [cmt -quiet -tag=$(tags) $(${CONSTITUENT}_extratags) build tag_makefile >$(cmt_local_tagfile_${CONSTITUENT})] == 0
!endif

!if [$(cmtexe) -quiet -tag=$(tags) $(${CONSTITUENT}_extratags) show setup >$(cmt_final_setup_${CONSTITUENT})] == 0
!endif

!else

cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).nmake
cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}_setup.nmake
cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.nmake

!endif

$(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) dirs
	@echo (constituents.nmake) Building ${CONSTITUENT}.nmake
	@set include=$(include)
	@set lib=$(lib)
	@$(cmtexe) -quiet -tag=$(tags) $(${CONSTITUENT}_extratags) build -nmake constituent_makefile ${CONSTITUENT}
	@move ${CONSTITUENT}.nmake $(bin)
	@echo (constituents.nmake) ${CONSTITUENT}.nmake done

${CONSTITUENT} :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
	@echo (constituents.nmake) Starting ${CONSTITUENT}
	@set include=$(include)
	@set lib=$(lib)
	@$(MAKE) /nologo /f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) build_strategy=keep_makefiles ${CONSTITUENT} tag=$(tag)
	@echo (constituents.nmake) ${CONSTITUENT} done

clean :: ${CONSTITUENT}clean

${CONSTITUENT}clean :: $(${CONSTITUENT}clean_dependencies) ##$(cmt_local_${CONSTITUENT}_makefile)
	@echo (constituents.nmake) Starting ${CONSTITUENT}clean
	@set include=$(include)
	@set lib=$(lib)
	@-if exist $(cmt_local_${CONSTITUENT}_makefile) $(MAKE) /nologo /f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) build_strategy=keep_makefiles ${CONSTITUENT}clean tag=$(tag)
	@echo (constituents.nmake) ${CONSTITUENT}clean done

install :: ${CONSTITUENT}install

${CONSTITUENT}install :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
	@echo (constituents.nmake) Starting install ${CONSTITUENT}
	@set include=$(include)
	@set lib=$(lib)
	@-$(MAKE) /nologo /f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) build_strategy=keep_makefiles install tag=$(tag)
	@echo (constituents.nmake) install ${CONSTITUENT} done

uninstall :: ${CONSTITUENT}uninstall

${CONSTITUENT}uninstall :: $(cmt_local_${CONSTITUENT}_makefile)
	@echo (constituents.nmake) Starting uninstall ${CONSTITUENT}"
	@set include=$(include)
	@set lib=$(lib)
	@-$(MAKE) /nologo /f $(cmt_local_${CONSTITUENT}_makefile) $(MAKEFLAGS) build_strategy=keep_makefiles uninstall tag=$(tag)
	@echo (constituents.nmake) uninstall ${CONSTITUENT} done

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