1*cdf0e10cSrcweir#!/usr/bin/perl 2*cdf0e10cSrcweir 3*cdf0e10cSrcweiruse File::Find; 4*cdf0e10cSrcweiruse File::Basename; 5*cdf0e10cSrcweir 6*cdf0e10cSrcweir# creates the help2 makefile for a given 7*cdf0e10cSrcweir# directory including all help xhp files 8*cdf0e10cSrcweir# in that and the subordinate directories 9*cdf0e10cSrcweir# Only help files with the following 10*cdf0e10cSrcweir# 11*cdf0e10cSrcweir# status values are included: 12*cdf0e10cSrcweir# PUBLISH DEPRECATED 13*cdf0e10cSrcweir# 14*cdf0e10cSrcweir# The following status values are 15*cdf0e10cSrcweir# disregarded: 16*cdf0e10cSrcweir# DRAFT FINAL STALLED 17*cdf0e10cSrcweir 18*cdf0e10cSrcweir$makefiletemplate = 'helpers/makefile.template'; 19*cdf0e10cSrcweir$linkmakefiletemplate = 'helpers/linkmakefile.template'; 20*cdf0e10cSrcweir$prj = "helpcontent2"; 21*cdf0e10cSrcweir$helpdirprefix = "$prj/source/"; 22*cdf0e10cSrcweir 23*cdf0e10cSrcweirundef @sbasic; 24*cdf0e10cSrcweirundef @scalc; 25*cdf0e10cSrcweirundef @schart; 26*cdf0e10cSrcweirundef @sdraw; 27*cdf0e10cSrcweirundef @shared; 28*cdf0e10cSrcweirundef @simpress; 29*cdf0e10cSrcweirundef @smath; 30*cdf0e10cSrcweirundef @swriter; 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir$params = join "|", "",@ARGV,""; 33*cdf0e10cSrcweir($params =~ /-dir/) ? ($startdir = $params) =~ (s/.*-dir=([^\|]*).*$/$1/gs) : (($startdir = `pwd`) =~ s/\n//gs); 34*cdf0e10cSrcweir($startdir = $startdir."/source/text") if ($startdir =~ /$prj$/); 35*cdf0e10cSrcweir($params =~ /-linkdir/) ? ($linkdir = $params) =~ (s/.*-linkdir=([^\|]*).*$/$1/gs) : (($linkdir = `pwd`) =~ s/\n//gs); 36*cdf0e10cSrcweir($linkdir = $linkdir."/util") if ($linkdir =~ /$prj$/); 37*cdf0e10cSrcweir$recursive = $params =~ /-recursive/ || 0; 38*cdf0e10cSrcweir$all = $params =~ /-all/ || 0; 39*cdf0e10cSrcweir 40*cdf0e10cSrcweirif (open TMPL, $makefiletemplate) { 41*cdf0e10cSrcweir undef $/; 42*cdf0e10cSrcweir $tmpl = <TMPL>; 43*cdf0e10cSrcweir close TMPL; 44*cdf0e10cSrcweir} else { 45*cdf0e10cSrcweir &terminate("Cannot open $makefiletemplate"); 46*cdf0e10cSrcweir} 47*cdf0e10cSrcweir 48*cdf0e10cSrcweirif (open LINKTMPL, $linkmakefiletemplate) { 49*cdf0e10cSrcweir undef $/; 50*cdf0e10cSrcweir $linktmpl = <LINKTMPL>; 51*cdf0e10cSrcweir close LINKTMPL; 52*cdf0e10cSrcweir} else { 53*cdf0e10cSrcweir &terminate("Cannot open $linkmakefiletemplate"); 54*cdf0e10cSrcweir} 55*cdf0e10cSrcweir 56*cdf0e10cSrcweirprint "Start Directory: $startdir\n"; 57*cdf0e10cSrcweirprint "Link Directory : $linkdir\n"; 58*cdf0e10cSrcweirprint "Recursive : ". ($recursive ? "yes" : "no") . "\n"; 59*cdf0e10cSrcweirprint "All files : ". ($all ? "yes" : "no") . "\n"; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweirif ($recursive) { 62*cdf0e10cSrcweir find(sub{push @dirs, $File::Find::name if (-d and ($File::Find::name!~/\/CVS/));},$startdir); 63*cdf0e10cSrcweir} else { 64*cdf0e10cSrcweir push @dirs, $startdir; 65*cdf0e10cSrcweir} 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir#print join "\n", @dirs; 68*cdf0e10cSrcweir#die; 69*cdf0e10cSrcweir 70*cdf0e10cSrcweirfor $d(@dirs) { 71*cdf0e10cSrcweir opendir DIR, $d; 72*cdf0e10cSrcweir @files = grep {/xhp$/} readdir DIR; 73*cdf0e10cSrcweir undef @files2; 74*cdf0e10cSrcweir closedir DIR; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir ($helpdir = $d) =~ s/.*\/$helpdirprefix/source\//gis; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir ($package = $helpdir) =~ s/^source\///gi; 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir ($target = $package) =~ s/\//_/g; $target =~ s/_$//; 81*cdf0e10cSrcweir ($module = $package) =~ s/^\/*text\/([^\/]+)\/*.*$/$1/; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir for $f(@files) { 84*cdf0e10cSrcweir ($n,$p,$e) = fileparse($f,".xhp"); 85*cdf0e10cSrcweir if (not $all) { 86*cdf0e10cSrcweir if (open XML, $d.'/'.$f) { 87*cdf0e10cSrcweir undef $/; 88*cdf0e10cSrcweir ($status = <XML>) =~ s/.*<topic[^>]*status="([^"]*)"[^>]*>.*$/$1/gs; 89*cdf0e10cSrcweir close XML; 90*cdf0e10cSrcweir } else { 91*cdf0e10cSrcweir die "Error: Cannot open ${d}/$f:$!\n"; 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir if ($status =~ /(DEPRECATED|PUBLISH)/i) { 94*cdf0e10cSrcweir ($p2=$package) =~ s,/,\$/,gis; 95*cdf0e10cSrcweir push @{$module}, $p2.'$/'.$n.'.xhp'; 96*cdf0e10cSrcweir push @files2, ' '.$n.'.xhp '; 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir } else { 99*cdf0e10cSrcweir ($p2=$package) =~ s,/,\$/,gis; 100*cdf0e10cSrcweir push @{$module}, $p2.'$/'.$n.'.xhp'; 101*cdf0e10cSrcweir push @files2, ' '.$n.'.xhp '; 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir printf "%s: %4d files, %4d included in makefile -> ",$d,scalar @files,scalar @files2; 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir if (scalar @files2 > 0) { # don't write makefiles where there are no files to make 108*cdf0e10cSrcweir ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir $auth = "script"; 111*cdf0e10cSrcweir $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec; 112*cdf0e10cSrcweir $prj = '..$/' x ((split "/", $helpdir) -1); $prj = $prj . ".."; 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir $xhpfiles = join "\\\n", sort @files2; 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir ($makefile = $tmpl) =~ s/%([^%]*)%/$$1/gise; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir if (open(MK, ">$d/makefile.mk")) { 120*cdf0e10cSrcweir print MK $makefile; 121*cdf0e10cSrcweir close MK; 122*cdf0e10cSrcweir print "makefile created\n"; 123*cdf0e10cSrcweir } else { 124*cdf0e10cSrcweir &terminate("Cannot write to ${d}/makefile.mk\n"); 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir } else { 127*cdf0e10cSrcweir print "NO makefile created\n"; 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir} 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir@sbasic = sort @sbasic; 132*cdf0e10cSrcweir@schart = sort @schart; 133*cdf0e10cSrcweir@scalc = sort @scalc; 134*cdf0e10cSrcweir@shared = sort @shared; 135*cdf0e10cSrcweir@sdraw = sort @sdraw; 136*cdf0e10cSrcweir@simpress = sort @simpress; 137*cdf0e10cSrcweir@smath = sort @smath; 138*cdf0e10cSrcweir@swriter = sort @swriter; 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir# now create the link makefiles 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir#---------------------------------- 143*cdf0e10cSrcweir# sbasic 144*cdf0e10cSrcweir $module = "sbasic"; 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir $linkaddedfiles = <<"LAF"; 147*cdf0e10cSrcweir -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 148*cdf0e10cSrcweir -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 149*cdf0e10cSrcweir -add $module.jar \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 150*cdf0e10cSrcweirLAF 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir $linkaddeddeps = <<"LAD"; 153*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 154*cdf0e10cSrcweir \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 155*cdf0e10cSrcweir \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 156*cdf0e10cSrcweirLAD 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir $linklinkfiles = ''; 159*cdf0e10cSrcweir for (@sbasic) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 160*cdf0e10cSrcweir for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir $auth = "script"; 163*cdf0e10cSrcweir $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec; 164*cdf0e10cSrcweir $prj = '..$/..' ; 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise; 167*cdf0e10cSrcweir &writelinkmakefile($module,$linkmakefile); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir#------------------------------------- 171*cdf0e10cSrcweir# scalc 172*cdf0e10cSrcweir $module = "scalc"; 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir $linkaddedfiles = <<"LAF"; 175*cdf0e10cSrcweir -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 176*cdf0e10cSrcweir -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 177*cdf0e10cSrcweir -add $module.jar \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 178*cdf0e10cSrcweirLAF 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir $linkaddeddeps = <<"LAD"; 181*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 182*cdf0e10cSrcweir \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 183*cdf0e10cSrcweir \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 184*cdf0e10cSrcweirLAD 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir $linklinkfiles = ''; 187*cdf0e10cSrcweir for (@scalc) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 188*cdf0e10cSrcweir for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 189*cdf0e10cSrcweir for (@schart) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir $auth = "script"; 192*cdf0e10cSrcweir $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec; 193*cdf0e10cSrcweir $prj = '..$/..' ; 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise; 196*cdf0e10cSrcweir &writelinkmakefile($module,$linkmakefile); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir#-------------------------------- 199*cdf0e10cSrcweir# schart 200*cdf0e10cSrcweir $module = "schart"; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir $linkaddedfiles = <<"LAF"; 203*cdf0e10cSrcweir -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 204*cdf0e10cSrcweir -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 205*cdf0e10cSrcweir -add $module.jar \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 206*cdf0e10cSrcweirLAF 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir $linkaddeddeps = <<"LAD"; 209*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 210*cdf0e10cSrcweir \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 211*cdf0e10cSrcweir \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 212*cdf0e10cSrcweirLAD 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir $linklinkfiles = ''; 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 217*cdf0e10cSrcweir for (@schart) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir $auth = "script"; 221*cdf0e10cSrcweir $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec; 222*cdf0e10cSrcweir $prj = '..$/..' ; 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise; 225*cdf0e10cSrcweir &writelinkmakefile($module,$linkmakefile); 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir#------------------------------ 228*cdf0e10cSrcweir# sdraw 229*cdf0e10cSrcweir $module = "sdraw"; 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir $linkaddedfiles = <<"LAF"; 232*cdf0e10cSrcweir -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 233*cdf0e10cSrcweir -add $module.jar \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 234*cdf0e10cSrcweirLAF 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir $linkaddeddeps = <<"LAD"; 237*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 238*cdf0e10cSrcweir \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 239*cdf0e10cSrcweirLAD 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir $linklinkfiles = ''; 242*cdf0e10cSrcweir for (@sdraw) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 243*cdf0e10cSrcweir for (@simpress) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 244*cdf0e10cSrcweir for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 245*cdf0e10cSrcweir for (@schart) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir $auth = "script"; 248*cdf0e10cSrcweir $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec; 249*cdf0e10cSrcweir $prj = '..$/..' ; 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise; 252*cdf0e10cSrcweir &writelinkmakefile($module,$linkmakefile); 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir#------------------------------------- 255*cdf0e10cSrcweir# shared 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir $module = "shared"; 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir $linkaddedfiles = <<"LAF"; 260*cdf0e10cSrcweir -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 261*cdf0e10cSrcweir -add $module.jar \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip \\ 262*cdf0e10cSrcweir -add default.css \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/default.css \\ 263*cdf0e10cSrcweir -add highcontrast1.css \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrast1.css \\ 264*cdf0e10cSrcweir -add highcontrast2.css \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrast2.css \\ 265*cdf0e10cSrcweir -add highcontrastwhite.css \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrastwhite.css \\ 266*cdf0e10cSrcweir -add highcontrastblack.css \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrastblack.css \\ 267*cdf0e10cSrcweir -add err.html \$(COMMONMISC)\$/LANGUAGE\$/text\$/shared\$/05\$/err_html.xhp 268*cdf0e10cSrcweirLAF 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir $linkaddeddeps = <<"LAD"; 271*cdf0e10cSrcweir \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 272*cdf0e10cSrcweir \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip \\ 273*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/default.css \\ 274*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrast1.css \\ 275*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrast2.css \\ 276*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrastwhite.css \\ 277*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/highcontrastblack.css \\ 278*cdf0e10cSrcweir \$(COMMONMISC)\$/LANGUAGE\$/text\$/shared\$/05\$/err_html.xhp 279*cdf0e10cSrcweirLAD 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir $linklinkfiles = ''; 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir $auth = "script"; 284*cdf0e10cSrcweir $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec; 285*cdf0e10cSrcweir $prj = '..$/..' ; 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise; 288*cdf0e10cSrcweir &writelinkmakefile($module,$linkmakefile); 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir#------------------------------- 291*cdf0e10cSrcweir# simpress 292*cdf0e10cSrcweir $module = "simpress"; 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir $linkaddedfiles = <<"LAF"; 295*cdf0e10cSrcweir -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 296*cdf0e10cSrcweir -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 297*cdf0e10cSrcweir -add $module.jar \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 298*cdf0e10cSrcweirLAF 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir $linkaddeddeps = <<"LAD"; 301*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 302*cdf0e10cSrcweir \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 303*cdf0e10cSrcweir \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 304*cdf0e10cSrcweirLAD 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir $linklinkfiles = ''; 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir for (@sdraw) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 309*cdf0e10cSrcweir for (@simpress) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 310*cdf0e10cSrcweir for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 311*cdf0e10cSrcweir for (@schart) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir $auth = "script"; 314*cdf0e10cSrcweir $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec; 315*cdf0e10cSrcweir $prj = '..$/..' ; 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise; 318*cdf0e10cSrcweir &writelinkmakefile($module,$linkmakefile); 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir#------------------------------------- 321*cdf0e10cSrcweir# smath 322*cdf0e10cSrcweir $module = "smath"; 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir $linkaddedfiles = <<"LAF"; 325*cdf0e10cSrcweir -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 326*cdf0e10cSrcweir -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 327*cdf0e10cSrcweir -add $module.jar \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 328*cdf0e10cSrcweirLAF 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir $linkaddeddeps = <<"LAD"; 331*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 332*cdf0e10cSrcweir \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 333*cdf0e10cSrcweir \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 334*cdf0e10cSrcweirLAD 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir $linklinkfiles = ''; 337*cdf0e10cSrcweir for (@smath) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 338*cdf0e10cSrcweir for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir $auth = "script"; 341*cdf0e10cSrcweir $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec; 342*cdf0e10cSrcweir $prj = '..$/..' ; 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise; 345*cdf0e10cSrcweir &writelinkmakefile($module,$linkmakefile); 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir#------------------------------- 348*cdf0e10cSrcweir# swriter 349*cdf0e10cSrcweir $module = "swriter"; 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir $linkaddedfiles = <<"LAF"; 352*cdf0e10cSrcweir -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 353*cdf0e10cSrcweir -add $module.tree \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 354*cdf0e10cSrcweir -add $module.jar \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 355*cdf0e10cSrcweirLAF 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir $linkaddeddeps = <<"LAD"; 358*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 359*cdf0e10cSrcweir \$(COMMONMISC)\$/LANGUAGE\$/$module.tree \\ 360*cdf0e10cSrcweir \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 361*cdf0e10cSrcweirLAD 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir $linklinkfiles = ''; 364*cdf0e10cSrcweir for (@swriter) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 365*cdf0e10cSrcweir for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 366*cdf0e10cSrcweir for (@schart) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 367*cdf0e10cSrcweir $auth = "script"; 368*cdf0e10cSrcweir $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec; 369*cdf0e10cSrcweir $prj = '..$/..' ; 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise; 372*cdf0e10cSrcweir &writelinkmakefile($module,$linkmakefile); 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir#------------------------------- 375*cdf0e10cSrcweir# sdatabase 376*cdf0e10cSrcweir $module = "sdatabase"; 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir $linkaddedfiles = <<"LAF"; 379*cdf0e10cSrcweir -add $module.cfg \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 380*cdf0e10cSrcweir -add $module.jar \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 381*cdf0e10cSrcweirLAF 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir $linkaddeddeps = <<"LAD"; 384*cdf0e10cSrcweir \$(PRJ)\$/source\$/auxiliary\$/LANGUAGE\$/$module.cfg \\ 385*cdf0e10cSrcweir \$(COMMONBIN)\$/xhp_${module}_LANGUAGE.zip 386*cdf0e10cSrcweirLAD 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir $linklinkfiles = ''; 389*cdf0e10cSrcweir for (@shared) { $linklinkfiles = $linklinkfiles . " $_ \\\n"; } 390*cdf0e10cSrcweir $auth = "script"; 391*cdf0e10cSrcweir $date = sprintf "%4d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon,$mday,$hour,$min,$sec; 392*cdf0e10cSrcweir $prj = '..$/..' ; 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir ($linkmakefile = $linktmpl) =~ s/%([^%]*)%/$$1/gise; 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir # remove zip1 targets 397*cdf0e10cSrcweir $linkmakefile =~ s,\n(ZIP1LIST=.*)\n,\nZIP1LIST=\$(LANGDIR)\$/text\$/shared\$/explorer\$/database\$/main.xhp\n,gi; 398*cdf0e10cSrcweir &writelinkmakefile($module,$linkmakefile); 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir 402*cdf0e10cSrcweirprint "sbasic: $#sbasic\n"; 403*cdf0e10cSrcweirprint "scalc : $#scalc\n"; 404*cdf0e10cSrcweirprint "schart: $#schart\n"; 405*cdf0e10cSrcweirprint "sdraw : $#sdraw\n"; 406*cdf0e10cSrcweirprint "shared: $#shared\n"; 407*cdf0e10cSrcweirprint "simpr : $#simpress\n"; 408*cdf0e10cSrcweirprint "smath : $#smath\n"; 409*cdf0e10cSrcweirprint "swrit : $#swriter\n"; 410*cdf0e10cSrcweirprint "sdbase: $#sdatabase\n"; 411*cdf0e10cSrcweir 412*cdf0e10cSrcweirsub terminate { 413*cdf0e10cSrcweir $err = shift; 414*cdf0e10cSrcweir print "$err\n\n"; 415*cdf0e10cSrcweir $msg = <<"MSG"; 416*cdf0e10cSrcweircreatemakefile.pl -dir=[directory name] -linkdir=[directory name] [-recursive] [-all] 417*cdf0e10cSrcweir -dir Directory to start 418*cdf0e10cSrcweir -linkdir Directory to write the link makefiles 419*cdf0e10cSrcweir -recursive Write makefiles recursively 420*cdf0e10cSrcweir -all include files with all status values 421*cdf0e10cSrcweirMSG 422*cdf0e10cSrcweir die "$msg\n"; 423*cdf0e10cSrcweir} 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir 426*cdf0e10cSrcweirsub writelinkmakefile { 427*cdf0e10cSrcweir $module = shift; 428*cdf0e10cSrcweir $content = shift; 429*cdf0e10cSrcweir if (open(MK, ">$linkdir/$module/makefile.mk")) { 430*cdf0e10cSrcweir print MK $content; 431*cdf0e10cSrcweir close MK; 432*cdf0e10cSrcweir } else { 433*cdf0e10cSrcweir &terminate("Cannot write makefile to ${linkdir}/$module\n"); 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir} 436