
cmtexe = ..\$(CMTBIN)\cmt.exe
bin = ..\VisualC

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

!if [copy cmt_dependencies.nmake $(bin)] == 0
!endif

!if exist ("$(cmtexe)")
!if [$(cmtexe) -quiet build constituent_makefile cmt] == 0
!endif
!else
!if [echo no cmt] == 0
!endif
!endif

cmt_install_action = echo
cmt_uninstall_action = echo
CMTINSTALLAREA = 

#all ::
#	set include=$(include)
#	set lib=$(lib)

all :: cmt post_build cmttag
	@echo all ok

post_build :: cmt_dependencies.nmake

cmt_dependencies.nmake :: $(cmtexe)
	@echo Rebuilding dependencies.nmake without stamps
	@$(cmtexe) build dependencies cmt -all_sources -no_stamps
	@copy $(bin)\cmt_dependencies.nmake ..\mgr
	@$(cmtexe) build dependencies cmt -all_sources

!include cmt.nmake


cmttag ::
	@echo Rebuilding VisualC.nmake
	@$(cmtexe) build tag_makefile | find /I /V "Arnault" | find /I /V "include=" | find /I /V "lib=" | find /I /V "PATH=" | find /I /V "CMTROOT=" >VisualC.nmake

democlean ::
	-rmdir /Q /S ..\demo

demo :: democlean
	cd ..
	$(cmtexe) create_project demo
	cd demo
	$(cmtexe) create demoA v1
	$(cmtexe) create demoB v1
	$(cmtexe) create demoC v1
	mkdir demoA\v1\demoA
	mkdir demoA\v1\cmt\fragments
	mkdir demoA\v1\cmt\fragments\nmake
	copy ..\src\demo\demoA\requirements demoA\v1\cmt
	copy ..\src\demo\demoA\init.bat demoA\v1\cmt
	copy ..\src\demo\demoA\*.cxx demoA\v1\src
	copy ..\src\demo\demoA\demoA.h demoA\v1\demoA
	copy ..\src\demo\demoA\*.java demoA\v1\src
	copy ..\src\demo\demoA\fragments\rename* demoA\v1\cmt\fragments
	copy ..\src\demo\demoA\fragments\nmake\rename* demoA\v1\cmt\fragments\nmake
	copy ..\src\demo\demoB\requirements demoB\v1\cmt
	copy ..\src\demo\demoB\init.bat demoB\v1\cmt
	copy ..\src\demo\demoB\*.cxx demoB\v1\src
	copy ..\src\demo\demoB\*.java demoB\v1\src
	copy ..\src\demo\demoC\requirements demoC\v1\cmt
	copy ..\src\demo\demoC\*.cxx demoC\v1\src
	set CMTPATH=$(CMTROOT)\demo
	cd demoA\v1\cmt
        call setup.bat
	nmake /f nmake all_groups check
	cd ..\..\..\demoB\v1\cmt
        call setup.bat
	nmake /f nmake all check
	cd ..\..\..\demoC\v1\cmt
        call setup.bat
	$(cmtexe) config
	nmake /f nmake all check


gendoc :
	@cd ../doc
	@\Arnault\Python23\python.exe gendoc.py CMTDoc.xml >CMTDoc.html

