6 # creates the help2 makefile for a given
7 # directory including all help xhp files
8 # in that and the subordinate directories
9 # Only help files with the following
11 # status values are included:
14 # The following status values are
18 $makefiletemplate = 'helpers/makefile.template';
19 $linkmakefiletemplate = 'helpers/linkmakefile.template';
20 $prj = "helpcontent2";
21 $helpdirprefix = "$prj/source/";
32 $params = join "|", "",@ARGV,"";
33 ($params =~ /-dir/) ?
($startdir = $params) =~ (s/.*-dir=([^\|]*).*$/$1/gs) : (($startdir = `pwd`) =~ s/\n//gs);
34 ($startdir = $startdir."/source/text") if ($startdir =~ /$prj$/);
35 ($params =~ /-linkdir/) ?
($linkdir = $params) =~ (s/.*-linkdir=([^\|]*).*$/$1/gs) : (($linkdir = `pwd`) =~ s/\n//gs);
36 ($linkdir = $linkdir."/util") if ($linkdir =~ /$prj$/);
37 $recursive = $params =~ /-recursive/ || 0;
38 $all = $params =~ /-all/ || 0;
40 if (open TMPL
, $makefiletemplate) {
45 &terminate
("Cannot open $makefiletemplate");
48 if (open LINKTMPL
, $linkmakefiletemplate) {
50 $linktmpl = <LINKTMPL
>;
53 &terminate
("Cannot open $linkmakefiletemplate");
56 print "Start Directory: $startdir\n";
57 print "Link Directory : $linkdir\n";
58 print "Recursive : ". ($recursive ?
"yes" : "no") . "\n";
59 print "All files : ". ($all ?
"yes" : "no") . "\n";
62 find
(sub{push @dirs, $File::Find
::name
if (-d
and ($File::Find
::name
!~/\/CVS
/));},$startdir);
64 push @dirs, $startdir;
67 #print join "\n", @dirs;
72 @files = grep {/xhp$/} readdir DIR
;
76 ($helpdir = $d) =~ s/.*\/$helpdirprefix/source\
//gis;
78 ($package = $helpdir) =~ s/^source\///gi
;
80 ($target = $package) =~ s/\//_
/g; $target =~ s/_
$//;
81 ($module = $package) =~ s/^\/*text\/([^\
/]+)\/*.*$/$1/;
84 ($n,$p,$e) = fileparse
($f,".xhp");
86 if (open XML
, $d.'/'.$f) {
88 ($status = <XML
>) =~ s/.*<topic[^>]*status="([^"]*)"[^>]*>.*$/$1/gs;
91 die "Error: Cannot open ${d}/$f:$!\n";
93 if ($status =~ /(DEPRECATED|PUBLISH)/i) {
94 ($p2=$package) =~ s
,/,\$/,gis
;
95 push @
{$module}, $p2.'$/'.$n.'.xhp';
96 push @files2, ' '.$n.'.xhp ';
99 ($p2=$package) =~ s
,/,\$/,gis
;
100 push @
{$module}, $p2.'$/'.$n.'.xhp';
101 push @files2, ' '.$n.'.xhp ';
105 printf "%s: %4d files, %4d included in makefile -> ",$d,scalar @files,scalar @files2;
107 if (scalar @files2 > 0) { # don't write makefiles where there are no files to make
108 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
111 $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec;
112 $prj = '..$/' x
((split "/", $helpdir) -1); $prj = $prj . "..";
115 $xhpfiles = join "\\\n", sort @files2;
117 ($makefile = $tmpl) =~ s/%([^%]*)%/$$1/gise;
119 if (open(MK
, ">$d/makefile.mk")) {
122 print "makefile created\n";
124 &terminate
("Cannot write to ${d}/makefile.mk\n");
127 print "NO makefile created\n";
131 @sbasic = sort @sbasic;
132 @schart = sort @schart;
133 @scalc = sort @scalc;
134 @shared = sort @shared;
135 @sdraw = sort @sdraw;
136 @simpress = sort @simpress;
137 @smath = sort @smath;
138 @swriter = sort @swriter;
140 # now create the link makefiles
142 #----------------------------------
146 $linkaddedfiles = <<"LAF";
147 -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
148 -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
149 -add $module.jar \$(BIN)\$/xhp_${module}_LANGUAGE.zip
152 $linkaddeddeps = <<"LAD";
153 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
154 \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
155 \$(BIN)\$/xhp_${module}_LANGUAGE.zip
159 for (@sbasic) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
160 for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
163 $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec;
166 ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise;
167 &writelinkmakefile
($module,$linkmakefile);
170 #-------------------------------------
174 $linkaddedfiles = <<"LAF";
175 -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
176 -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
177 -add $module.jar \$(BIN)\$/xhp_${module}_LANGUAGE.zip
180 $linkaddeddeps = <<"LAD";
181 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
182 \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
183 \$(BIN)\$/xhp_${module}_LANGUAGE.zip
187 for (@scalc) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
188 for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
189 for (@schart) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
192 $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec;
195 ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise;
196 &writelinkmakefile
($module,$linkmakefile);
198 #--------------------------------
202 $linkaddedfiles = <<"LAF";
203 -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
204 -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
205 -add $module.jar \$(BIN)\$/xhp_${module}_LANGUAGE.zip
208 $linkaddeddeps = <<"LAD";
209 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
210 \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
211 \$(BIN)\$/xhp_${module}_LANGUAGE.zip
216 for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
217 for (@schart) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
221 $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec;
224 ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise;
225 &writelinkmakefile
($module,$linkmakefile);
227 #------------------------------
231 $linkaddedfiles = <<"LAF";
232 -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
233 -add $module.jar \$(BIN)\$/xhp_${module}_LANGUAGE.zip
236 $linkaddeddeps = <<"LAD";
237 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
238 \$(BIN)\$/xhp_${module}_LANGUAGE.zip
242 for (@sdraw) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
243 for (@simpress) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
244 for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
245 for (@schart) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
248 $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec;
251 ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise;
252 &writelinkmakefile
($module,$linkmakefile);
254 #-------------------------------------
259 $linkaddedfiles = <<"LAF";
260 -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
261 -add $module.jar \$(BIN)\$/xhp_${module}_LANGUAGE.zip \\
262 -add default.css \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/default.css \\
263 -add highcontrast1.css \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrast1.css \\
264 -add highcontrast2.css \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrast2.css \\
265 -add highcontrastwhite.css \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrastwhite.css \\
266 -add highcontrastblack.css \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrastblack.css \\
267 -add err.html \$(COMMONMISC)\$/LANGUAGE\$/text\$/shared\$/05\$/err_html.xhp
270 $linkaddeddeps = <<"LAD";
271 \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
272 \$(BIN)\$/xhp_${module}_LANGUAGE.zip \\
273 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/default.css \\
274 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrast1.css \\
275 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrast2.css \\
276 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrastwhite.css \\
277 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrastblack.css \\
278 \$(COMMONMISC)\$/LANGUAGE\$/text\$/shared\$/05\$/err_html.xhp
284 $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec;
287 ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise;
288 &writelinkmakefile
($module,$linkmakefile);
290 #-------------------------------
292 $module = "simpress";
294 $linkaddedfiles = <<"LAF";
295 -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
296 -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
297 -add $module.jar \$(BIN)\$/xhp_${module}_LANGUAGE.zip
300 $linkaddeddeps = <<"LAD";
301 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
302 \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
303 \$(BIN)\$/xhp_${module}_LANGUAGE.zip
308 for (@sdraw) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
309 for (@simpress) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
310 for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
311 for (@schart) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
314 $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec;
317 ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise;
318 &writelinkmakefile
($module,$linkmakefile);
320 #-------------------------------------
324 $linkaddedfiles = <<"LAF";
325 -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
326 -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
327 -add $module.jar \$(BIN)\$/xhp_${module}_LANGUAGE.zip
330 $linkaddeddeps = <<"LAD";
331 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
332 \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
333 \$(BIN)\$/xhp_${module}_LANGUAGE.zip
337 for (@smath) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
338 for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
341 $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec;
344 ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise;
345 &writelinkmakefile
($module,$linkmakefile);
347 #-------------------------------
351 $linkaddedfiles = <<"LAF";
352 -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
353 -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
354 -add $module.jar \$(BIN)\$/xhp_${module}_LANGUAGE.zip
357 $linkaddeddeps = <<"LAD";
358 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
359 \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\
360 \$(BIN)\$/xhp_${module}_LANGUAGE.zip
364 for (@swriter) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
365 for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
366 for (@schart) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
368 $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec;
371 ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise;
372 &writelinkmakefile
($module,$linkmakefile);
374 #-------------------------------
376 $module = "sdatabase";
378 $linkaddedfiles = <<"LAF";
379 -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
380 -add $module.jar \$(BIN)\$/xhp_${module}_LANGUAGE.zip
383 $linkaddeddeps = <<"LAD";
384 \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\
385 \$(BIN)\$/xhp_${module}_LANGUAGE.zip
389 for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; }
391 $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec;
394 ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise;
396 # remove zip1 targets
397 $linkmakefile =~ s
,\n(ZIP1LIST
=.*)\n,\nZIP
1LIST
=\
$(LANGDIR
)\
$/text\$/shared\
$/explorer\$/database\
$/main
.xhp
\n,gi
;
398 &writelinkmakefile
($module,$linkmakefile);
402 print "sbasic: $#sbasic\n";
403 print "scalc : $#scalc\n";
404 print "schart: $#schart\n";
405 print "sdraw : $#sdraw\n";
406 print "shared: $#shared\n";
407 print "simpr : $#simpress\n";
408 print "smath : $#smath\n";
409 print "swrit : $#swriter\n";
410 print "sdbase: $#sdatabase\n";
416 createmakefile.pl -dir=[directory name] -linkdir=[directory name] [-recursive] [-all]
417 -dir Directory to start
418 -linkdir Directory to write the link makefiles
419 -recursive Write makefiles recursively
420 -all include files with all status values
426 sub writelinkmakefile
{
429 if (open(MK
, ">$linkdir/$module/makefile.mk")) {
433 &terminate
("Cannot write makefile to ${linkdir}/$module\n");