SubDir P4W Help ;

# See the README file in this directory 
# to find out how to update P4Web help files.

NOTFILE manual ;

HELP_BATCH1 =
   actioncodes.html
   add.html   
   addselect.html   
   auth.html
   bitb.html
   branch.html
   browsemodes.html
   browseonly.html
   client.html
   commands.html
   controlpanel.html
   defs.html
   delete.html
   deletespec.html
   describe.html
   diffing.html
   edit.html     
   editbranch.html  
   editclient.html
   editjob.html
   editlabel.html
   editpending.html
   edituser.html
   errors.html
   filebrowser.html
   filelog.html
   filetype.html
   findfiles.html
   index.html
   integrate.html
   integpb.html
   integfb.html
   help_filetypes.html
   helper.html
   howto.html
   job.html
   jobfields.html
   launcheditor.html
   label.html
   labelsync.html
   lock.html
   pathbrowser.html
   pendingchangelists.html
   remove.html
   resolve.html
   restrictfiles.html
   result.html
   revert.html
   roadmap.html
   rss.html
   settings.html
   serverinfo.html
   submit.html
   submittedchangelists.html
   sync.html
   thumbnails.html
   tips.html
   unlock.html
   user.html
   xml.html
   ;

HELP_BATCH2 =
   quickstart.html
   ;

HELP_FILES = $(HELP_BATCH1) $(HELP_BATCH2) ;

HELPGRINDER = helpgrinder.py ;
SEARCH on $(HELPGRINDER) = $(SEARCH_SOURCE) ;

rule GrindHelpFiles
{
   # $(1) is output .h file
   # $(2) is list of input .html files

   local i m md ;

   Depends all : $(1) ;
   LOCATE on $(1) = $(SEARCH_SOURCE) ;
   RmGeneratedHeader $(1) ;
   Clean clean : $(1) ;

   for i in $(2:G=input)
   {
		GenerateHelp $(1) : $(i) ;
		Depends $(1) : $(i) $(HELPGRINDER) ;
   		LOCATE on $(i) = $(SEARCH_SOURCE) ;

		m = $(i:G=manual) 	;
		Depends manual : $(m) ;
		Depends $(m) : $(i) ;
		GenerateHelp $(m) : $(i) ;
		makeDirName md : $(P4WEBMANUALDIR) help ;
		MakeLocate $(m) : $(md) ;
   		Clean clean : $(m) ;
   }
}

actions ignore RmGeneratedHeader
{
   $(RM) $(<) 
}

actions GenerateHelp 
{
   $(PYTHON) $(HELPGRINDER) $(>) $(<)
}

GrindHelpFiles p4wHelp1.h :  $(HELP_BATCH1) ;
GrindHelpFiles p4wHelp2.h :  $(HELP_BATCH2) ;