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