Commit a7b6f740 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Cleaned up pwre.pl

parent e9177f1b
...@@ -4,3 +4,6 @@ build_pwr : ...@@ -4,3 +4,6 @@ build_pwr :
@ if ./build.sh; then \ @ if ./build.sh; then \
echo "Proview built"; \ echo "Proview built"; \
fi fi
clean:
@ find rls/ -iname "*.o" -delete
\ No newline at end of file
...@@ -60,16 +60,14 @@ $desc = $user. "'s environment"; ...@@ -60,16 +60,14 @@ $desc = $user. "'s environment";
@vars; @vars;
$varstr; $varstr;
if (($dbname = $ENV{"pwre_env_db"}) eq "") { if (($dbname = $ENV{"pwre_env_db"}) eq "") {
$dbname = $ENV{"HOME"} . "/pwre/pwre"; $dbname = $ENV{"HOME"} . "/pwre/pwre";
} }
$os = substr( $ENV{"pwre_os"}, 3, 100); $os = substr($ENV{"pwre_os"}, 3, 100);
$hw = substr( $ENV{"pwre_hw"}, 3, 100); $hw = substr($ENV{"pwre_hw"}, 3, 100);
$configfile = $ENV{"pwre_broot"} . "/pwre_" . $hw . "_" . $os . ".cnf"; $configfile = $ENV{"pwre_broot"} . "/pwre_" . $hw . "_" . $os . ".cnf";
$parallel = $ENV{"PWRE_CONF_PARALLEL"}; $parallel = $ENV{"PWRE_CONF_PARALLEL"};
$arg1 = $ARGV[0]; $arg1 = $ARGV[0];
shift; shift;
...@@ -77,8 +75,6 @@ if ($arg1 eq "") { ...@@ -77,8 +75,6 @@ if ($arg1 eq "") {
help(); help();
} }
$amb = 0; $amb = 0;
$found = 0; $found = 0;
@ambs; @ambs;
...@@ -110,11 +106,9 @@ if ($amb == 1) { ...@@ -110,11 +106,9 @@ if ($amb == 1) {
} }
print("\n"); print("\n");
exit 1; exit 1;
} elsif ($found == 1) { } elsif ($found == 1) {
&$verb(@ARGV); &$verb(@ARGV);
exit 0; exit 0;
} else { } else {
help(); help();
exit 1; exit 1;
...@@ -123,13 +117,11 @@ if ($amb == 1) { ...@@ -123,13 +117,11 @@ if ($amb == 1) {
# #
# Verb subroutines # Verb subroutines
# #
# add() # add()
# #
sub add () sub add()
{ {
use DB_File; use DB_File;
tie(%envdb, "DB_File", $dbname, O_CREAT|O_RDWR, 0644) || die "++ can't tie $dbname!"; tie(%envdb, "DB_File", $dbname, O_CREAT|O_RDWR, 0644) || die "++ can't tie $dbname!";
$label = $_[0]; $label = $_[0];
...@@ -156,22 +148,20 @@ sub configure() ...@@ -156,22 +148,20 @@ sub configure()
if ($hw eq "x86" && $real_hw eq "x86_64") { if ($hw eq "x86" && $real_hw eq "x86_64") {
$ENV{"cross_compile"} = "-m32"; $ENV{"cross_compile"} = "-m32";
} }
my $fname = $ENV{"pwre_bin"} . "/pwre_configure.sh"." ".$_[0]." ".$_[1]." ".$_[2]; system($ENV{"pwre_bin"} . "/pwre_configure.sh"." ".$_[0]." ".$_[1]." ".$_[2]);
system( $fname);
} }
# #
# build() # build()
# #
sub build () # args: branch, subbranch, flavour, phase sub build() # args: branch, subbranch, flavour, phase
{ {
if (!defined($ENV{"pwre_env"})) { if (!defined($ENV{"pwre_env"})) {
print("++ Environment is not initialized!\n"); print("++ Environment is not initialized!\n");
exit 1; exit 1;
} }
if ( ! -e $configfile ) { if (! -e $configfile ) {
print("++ Environment is not configured!\n"); print("++ Environment is not configured!\n");
exit 1; exit 1;
} }
...@@ -181,17 +171,17 @@ sub build () # args: branch, subbranch, flavour, phase ...@@ -181,17 +171,17 @@ sub build () # args: branch, subbranch, flavour, phase
read_vars(); read_vars();
if ( $_[0] eq "-v") { if ($_[0] eq "-v") {
$ver = 1; $ver = 1;
shift(@_); shift(@_);
} }
if ( $_[0] eq "all") { if ($_[0] eq "all") {
build_all_modules(); build_all_modules();
return; return;
} }
if ( $_[0] eq "module" || $_[0] eq "") { if ($_[0] eq "module" || $_[0] eq "") {
build_module(); build_module();
return; return;
} }
...@@ -211,10 +201,9 @@ sub build () # args: branch, subbranch, flavour, phase ...@@ -211,10 +201,9 @@ sub build () # args: branch, subbranch, flavour, phase
shift(@_); shift(@_);
shift(@_); shift(@_);
if ( $_[0] eq "") { if ($_[0] eq "") {
$flavour = "src"; $flavour = "src";
} } else {
else {
$flavour = $_[0]; $flavour = $_[0];
shift(@_); shift(@_);
} }
...@@ -232,11 +221,10 @@ sub build () # args: branch, subbranch, flavour, phase ...@@ -232,11 +221,10 @@ sub build () # args: branch, subbranch, flavour, phase
printf("\n--\n"); printf("\n--\n");
_build($branch, $subbranch, $flavour, @_); _build($branch, $subbranch, $flavour, @_);
} }
# #
# build_kernel () # build_kernel()
# #
sub build_kernel # args: flavour sub build_kernel # args: flavour
{ {
...@@ -306,55 +294,23 @@ sub ebuild # args: pass flavour ...@@ -306,55 +294,23 @@ sub ebuild # args: pass flavour
my $fname = $ENV{"pwre_bin"} . "/ebuild.dat"; my $fname = $ENV{"pwre_bin"} . "/ebuild.dat";
open FILE, $fname or die $!; open FILE, $fname or die $!;
my $build_bcomp = 0; my %to_build = ();
my $build_java = 0;
my $build_remote = 0; printf("-- Building modules\n");
my $build_nmps = 0; while (<FILE>) {
my $build_sev = 0; my @value = split(' ', $_);
my $build_opc = 0; if ($value[1] eq "1") {
my $build_profibus = 0; $to_build{$value[0]} = 1;
my $build_otherio = 0; printf("-- " . $value[0] . "\n");
my $build_simul = 0; }
my $build_misc = 0; }
my $build_ssabox = 0; printf("\n");
my $build_tlog = 0;
my $build_othermanu = 0;
my $build_abb = 0;
my $build_siemens = 0;
my $build_klocknermoeller = 0;
my $build_inor = 0;
my $build_telemecanique = 0;
printf( "-- Building modules\n");
while ( <FILE>) {
my @value = split( ' ', $_);
if ( $value[0] eq "bcomp" && $value[1] eq "1" ) { $build_bcomp = 1; printf( "-- bcomp\n");}
elsif ( $value[0] eq "remote" && $value[1] eq "1" ) { $build_remote = 1; printf( "-- remote\n");}
elsif ( $value[0] eq "java" && $value[1] eq "1" ) { $build_java = 1; printf( "-- java\n");}
elsif ( $value[0] eq "nmps" && $value[1] eq "1" ) { $build_nmps = 1; printf( "-- nmps\n");}
elsif ( $value[0] eq "sev" && $value[1] eq "1" ) { $build_sev = 1; printf( "-- sev\n");}
elsif ( $value[0] eq "opc" && $value[1] eq "1" ) { $build_opc = 1; printf( "-- opc\n");}
elsif ( $value[0] eq "profibus" && $value[1] eq "1" ) { $build_profibus = 1; printf( "-- profibus\n");}
elsif ( $value[0] eq "otherio" && $value[1] eq "1" ) { $build_otherio = 1; printf( "-- otherio\n");}
elsif ( $value[0] eq "simul" && $value[1] eq "1" ) { $build_simul = 1; printf( "-- simul\n");}
elsif ( $value[0] eq "misc" && $value[1] eq "1" ) { $build_misc = 1; printf( "-- misc\n");}
elsif ( $value[0] eq "ssabox" && $value[1] eq "1" ) { $build_ssabox = 1; printf( "-- ssabox\n");}
elsif ( $value[0] eq "tlog" && $value[1] eq "1" ) { $build_tlog = 1; printf( "-- tlog\n");}
elsif ( $value[0] eq "othermanu" && $value[1] eq "1" ) { $build_othermanu = 1; printf( "-- othermanu\n");}
elsif ( $value[0] eq "abb" && $value[1] eq "1" ) { $build_abb = 1; printf( "-- abb\n");}
elsif ( $value[0] eq "siemens" && $value[1] eq "1" ) { $build_siemens = 1; printf( "-- siemens\n");}
elsif ( $value[0] eq "klocknermoeller" && $value[1] eq "1" ) { $build_klocknermoeller = 1; printf( "-- klocknermoeller\n");}
elsif ( $value[0] eq "inor" && $value[1] eq "1" ) { $build_inor = 1; printf( "-- inor \n");}
elsif ( $value[0] eq "telemecanique" && $value[1] eq "1" ) { $build_telemecanique = 1; printf( "-- telemecanique\n");}
}
printf( "\n");
close FILE; close FILE;
my $pass = $_[0]; my $pass = $_[0];
my $flavour = $_[1]; my $flavour = $_[1];
if ( $pass eq "rt" ) { if ($pass eq "rt" ) {
_module("rt"); _module("rt");
_build("exp", "inc", "src", "all"); _build("exp", "inc", "src", "all");
_build("exp", "com", "src", "all"); _build("exp", "com", "src", "all");
...@@ -405,108 +361,107 @@ sub ebuild # args: pass flavour ...@@ -405,108 +361,107 @@ sub ebuild # args: pass flavour
_build("exe", "rt*", "src", "all"); _build("exe", "rt*", "src", "all");
_build("exe", "co*", $flavour, "all"); _build("exe", "co*", $flavour, "all");
_build("exe", "pwr_user", "src", "all"); _build("exe", "pwr_user", "src", "all");
if ( $build_nmps == 1) { if ($to_build{"nmps"}) {
merge(); merge();
_module("nmps"); _module("nmps");
_build("lib", "nmps", "src", "all"); _build("lib", "nmps", "src", "all");
merge(); merge();
} }
if ( $build_bcomp == 1) { if ($to_build{"bcomp"}) {
_module("profibus"); _module("profibus");
merge(); merge();
_module("bcomp"); _module("bcomp");
_build("lib", "rt", "src", "all"); _build("lib", "rt", "src", "all");
merge(); merge();
} }
if ( $build_simul == 1) { if ($to_build{"simul"}) {
_module("simul"); _module("simul");
_build("lib", "simul", "src", "all"); _build("lib", "simul", "src", "all");
merge(); merge();
} }
if ( $build_misc == 1) { if ($to_build{"misc"}) {
_module("misc"); _module("misc");
_build("lib", "misc", "src", "all"); _build("lib", "misc", "src", "all");
merge(); merge();
} }
if ( $build_ssabox == 1) { if ($to_build{"ssabox"}) {
_module("ssabox"); _module("ssabox");
_build("lib", "rt", "src", "all"); _build("lib", "rt", "src", "all");
_build("lib", "ssabox", "src", "all"); _build("lib", "ssabox", "src", "all");
merge(); merge();
} }
if ( $build_otherio == 1) { if ($to_build{"otherio"}) {
_module("otherio"); _module("otherio");
_build("lib", "rt", "src", "all"); _build("lib", "rt", "src", "all");
merge(); merge();
} }
if ( $build_profibus == 1) { if ($to_build{"profibus"}) {
_module("profibus"); _module("profibus");
_build("lib", "rt", "src", "all"); _build("lib", "rt", "src", "all");
_build("lib","pnak_dummy","src","init lib"); _build("lib","pnak_dummy","src","init lib");
merge(); merge();
} }
if ( $build_remote == 1) { if ($to_build{"remote"}) {
_module("remote"); _module("remote");
_build("lib", "remote", "src", "all"); _build("lib", "remote", "src", "all");
_build("exe", "*", "src", "all"); _build("exe", "*", "src", "all");
merge(); merge();
} }
if ( $build_opc == 1) { if ($to_build{"opc"}) {
_module("opc"); _module("opc");
_build("lib", "opc", "src", "all"); _build("lib", "opc", "src", "all");
_build("exe", "*", "src", "all"); _build("exe", "*", "src", "all");
merge(); merge();
} }
if ( $build_tlog == 1) { if ($to_build{"tlog"}) {
_module("tlog"); _module("tlog");
_build("lib", "tlog", "src", "all"); _build("lib", "tlog", "src", "all");
merge(); merge();
} }
if ( $build_java == 1) { if ($to_build{"java"}) {
_module("java"); _module("java");
_build("exe", "jpwr_rt_gdh", "src", "all"); _build("exe", "jpwr_rt_gdh", "src", "all");
merge(); merge();
} }
if ( $build_sev == 1) { if ($to_build{"sev"}) {
_module("sev"); _module("sev");
_build("lib", "sev", "src", "all"); _build("lib", "sev", "src", "all");
_build("exe", "sev_server", "src", "all"); _build("exe", "sev_server", "src", "all");
merge(); merge();
} }
if ( $build_abb == 1) { if ($to_build{"abb"}) {
_module("abb"); _module("abb");
merge(); merge();
} }
if ( $build_siemens == 1) { if ($to_build{"siemens"}) {
_module("siemens"); _module("siemens");
merge(); merge();
} }
if ( $build_othermanu == 1) { if ($to_build{"othermanu"}) {
_module("othermanu"); _module("othermanu");
merge(); merge();
} }
if ( $build_inor == 1) { if ($to_build{"inor"}) {
_module("inor"); _module("inor");
merge(); merge();
} }
if ( $build_klocknermoeller == 1) { if ($to_build{"klocknermoeller"}) {
_module("klocknermoeller"); _module("klocknermoeller");
merge(); merge();
} }
if ( $build_telemecanique == 1) { if ($to_build{"telemecanique"}) {
_module("telemecanique"); _module("telemecanique");
merge(); merge();
} }
if ( $build_simul == 1) { if ($to_build{"simul"}) {
_module("simul"); _module("simul");
merge(); merge();
} }
if ( $build_misc == 1) { if ($to_build{"misc"}) {
_module("misc"); _module("misc");
merge(); merge();
} }
} } elsif ($pass eq "op" ) {
elsif ( $pass eq "op" ) {
_module("xtt"); _module("xtt");
_build("lib", "*", "src", "init copy"); _build("lib", "*", "src", "init copy");
_build("lib", "*", $flavour, "copy"); _build("lib", "*", $flavour, "copy");
...@@ -526,12 +481,12 @@ sub ebuild # args: pass flavour ...@@ -526,12 +481,12 @@ sub ebuild # args: pass flavour
_build("exe", "co*", $flavour, "all"); _build("exe", "co*", $flavour, "all");
_build("exe", "pwr*", $flavour, "all"); _build("exe", "pwr*", $flavour, "all");
merge(); merge();
if ( $build_bcomp == 1) { if ($to_build{"bcomp"}) {
_module("bcomp"); _module("bcomp");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_profibus == 1) { if ($to_build{"profibus"}) {
_module("profibus"); _module("profibus");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
_build("lib", "cow", "src", "init copy lib"); _build("lib", "cow", "src", "init copy lib");
...@@ -540,83 +495,82 @@ sub ebuild # args: pass flavour ...@@ -540,83 +495,82 @@ sub ebuild # args: pass flavour
_build("lib", "xtt", $flavour, "init copy lib"); _build("lib", "xtt", $flavour, "init copy lib");
merge(); merge();
} }
if ( $build_opc == 1) { if ($to_build{"opc"}) {
_module("opc"); _module("opc");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_otherio == 1) { if ($to_build{"otherio"}) {
_module("otherio"); _module("otherio");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_sev == 1) { if ($to_build{"sev"}) {
_module("sev"); _module("sev");
_build("exe", "sev_xtt", "src", "all"); _build("exe", "sev_xtt", "src", "all");
_build("exe", "sev_xtt", $flavour, "all"); _build("exe", "sev_xtt", $flavour, "all");
merge(); merge();
} }
if ( $build_othermanu == 1) { if ($to_build{"othermanu"}) {
_module("othermanu"); _module("othermanu");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_abb == 1) { if ($to_build{"abb"}) {
_module("abb"); _module("abb");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_inor == 1) { if ($to_build{"inor"}) {
_module("inor"); _module("inor");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_siemens == 1) { if ($to_build{"siemens"}) {
_module("siemens"); _module("siemens");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_klocknermoeller == 1) { if ($to_build{"klocknermoeller"}) {
_module("klocknermoeller"); _module("klocknermoeller");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_simul == 1) { if ($to_build{"simul"}) {
_module("simul"); _module("simul");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_misc == 1) { if ($to_build{"misc"}) {
_module("misc"); _module("misc");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_ssabox == 1) { if ($to_build{"ssabox"}) {
_module("ssabox"); _module("ssabox");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
if ( $build_telemecanique == 1) { if ($to_build{"telemecanique"}) {
_module("telemecanique"); _module("telemecanique");
_build("mmi", "*", "src", "copy"); _build("mmi", "*", "src", "copy");
merge(); merge();
} }
method_build( "rt_io_comm", $flavour); method_build("rt_io_comm", $flavour);
method_build( "rt_xtt", $flavour); method_build("rt_xtt", $flavour);
} }
} }
# #
# import() # import()
# #
sub import () sub import()
{ {
my $flavour = $_[1]; my $flavour = $_[1];
my($vmsinc) = $ENV{"pwre_vmsinc"}; my($vmsinc) = $ENV{"pwre_vmsinc"};
if ( $vmsinc ne "" ) { if ($vmsinc ne "" ) {
copy($_[0], $flavour);
copy( $_[0], $flavour);
_module("rt"); _module("rt");
merge(); merge();
...@@ -633,75 +587,74 @@ sub import () ...@@ -633,75 +587,74 @@ sub import ()
_module("remote"); _module("remote");
merge(); merge();
} }
} }
# #
# build_all_modules() # build_all_modules()
# #
sub build_all_modules () sub build_all_modules()
{ {
my $flavour = $_[0]; my $flavour = $_[0];
build_kernel( $flavour); build_kernel($flavour);
_module("nmps"); _module("nmps");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("tlog"); _module("tlog");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("remote"); _module("remote");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("profibus"); _module("profibus");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("bcomp"); _module("bcomp");
build_module( $flavour); build_module($flavour);
merge(); merge();
if ( $ENV{"PWRE_CONF_JNI"} eq "1") { if ($ENV{"PWRE_CONF_JNI"} eq "1") {
_module("java"); _module("java");
build_module( $flavour); build_module($flavour);
merge(); merge();
} }
_module("opc"); _module("opc");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("simul"); _module("simul");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("misc"); _module("misc");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("ssabox"); _module("ssabox");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("otherio"); _module("otherio");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("othermanu"); _module("othermanu");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("sev"); _module("sev");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("abb"); _module("abb");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("siemens"); _module("siemens");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("inor"); _module("inor");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("klocknermoeller"); _module("klocknermoeller");
build_module( $flavour); build_module($flavour);
merge(); merge();
_module("telemecanique"); _module("telemecanique");
build_module( $flavour); build_module($flavour);
merge(); merge();
method_build( $flavour); method_build($flavour);
build_documentation(); build_documentation();
} }
...@@ -715,7 +668,7 @@ sub build_documentation() ...@@ -715,7 +668,7 @@ sub build_documentation()
# #
# clean_exe_all() # clean_exe_all()
# #
sub clean_exe_all () sub clean_exe_all()
{ {
_module("xtt"); _module("xtt");
_build("exe","*","src","clean_exe"); _build("exe","*","src","clean_exe");
...@@ -732,18 +685,16 @@ sub clean_exe_all () ...@@ -732,18 +685,16 @@ sub clean_exe_all ()
_module("remote"); _module("remote");
_build("exe","*","src","clean_exe"); _build("exe","*","src","clean_exe");
_module("rt"); _module("rt");
} }
# #
# build_all_wbl() # build_all_wbl()
# #
sub build_all_wbl () sub build_all_wbl()
{ {
_module("rt"); _module("rt");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "pwrs", "src", "lib"); _build("wbl", "pwrs", "src", "lib");
_build("wbl", "pwrb", "src", "lib"); _build("wbl", "pwrb", "src", "lib");
_build("wbl", "wb", "src", "lib"); _build("wbl", "wb", "src", "lib");
...@@ -751,108 +702,106 @@ sub build_all_wbl () ...@@ -751,108 +702,106 @@ sub build_all_wbl ()
merge(); merge();
_module("nmps"); _module("nmps");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "nmps", "src", "lib"); _build("wbl", "nmps", "src", "lib");
merge(); merge();
_module("tlog"); _module("tlog");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "tlog", "src", "lib"); _build("wbl", "tlog", "src", "lib");
merge(); merge();
_module("profibus"); _module("profibus");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib"); _build("wbl", "mcomp", "src", "lib");
merge(); merge();
_module("opc"); _module("opc");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib"); _build("wbl", "mcomp", "src", "lib");
merge(); merge();
_module("remote"); _module("remote");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "remote", "src", "lib"); _build("wbl", "remote", "src", "lib");
merge(); merge();
_module("bcomp"); _module("bcomp");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "bcomp", "src", "lib"); _build("wbl", "bcomp", "src", "lib");
merge(); merge();
_module("otherio"); _module("otherio");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib"); _build("wbl", "mcomp", "src", "lib");
merge(); merge();
_module("simul"); _module("simul");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "simul", "src", "lib"); _build("wbl", "simul", "src", "lib");
merge(); merge();
_module("misc"); _module("misc");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "misc", "src", "lib"); _build("wbl", "misc", "src", "lib");
merge(); merge();
_module("ssabox"); _module("ssabox");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib"); _build("wbl", "mcomp", "src", "lib");
merge(); merge();
_module("abb"); _module("abb");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib"); _build("wbl", "mcomp", "src", "lib");
merge(); merge();
_module("siemens"); _module("siemens");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib"); _build("wbl", "mcomp", "src", "lib");
merge(); merge();
_module("telemecanique"); _module("telemecanique");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib"); _build("wbl", "mcomp", "src", "lib");
merge(); merge();
_module("inor"); _module("inor");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib"); _build("wbl", "mcomp", "src", "lib");
merge(); merge();
_module("klocknermoeller"); _module("klocknermoeller");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib"); _build("wbl", "mcomp", "src", "lib");
merge(); merge();
_module("othermanu"); _module("othermanu");
my($load_dir) = $ENV{"pwr_load"}; my($load_dir) = $ENV{"pwr_load"};
system( "rm $load_dir/*.dbs"); system("rm $load_dir/*.dbs");
_build("wbl", "mcomp", "src", "lib"); _build("wbl", "mcomp", "src", "lib");
merge(); merge();
_module("rt"); _module("rt");
} }
sub method_build () sub method_build()
{ {
my $flavour; my $flavour;
my $program; my $program;
if ( $_[0] eq "motif" || $_[0] eq "gtk" || $_[0] eq "qt" ) { if ($_[0] eq "motif" || $_[0] eq "gtk" || $_[0] eq "qt" ) {
$flavour = $_[0]; $flavour = $_[0];
} } else {
else {
$program = $_[0]; $program = $_[0];
$flavour = $_[1]; $flavour = $_[1];
} }
if (!defined($program)) { if (!defined($program)) {
printf("-- Relink method dependent programs %s\n", $flavour); printf("-- Relink method dependent programs %s\n", $flavour);
method_build( "rt_io_comm"); method_build("rt_io_comm");
method_build( "wb", $flavour); method_build("wb", $flavour);
method_build( "rt_xtt", $flavour); method_build("rt_xtt", $flavour);
return; return;
} }
if ( $_[0] eq "rt_io_comm" ) { if ($_[0] eq "rt_io_comm" ) {
printf("-- Method build %s\n", $program); printf("-- Method build %s\n", $program);
_module("rt"); _module("rt");
$ENV{"export_type"} = "exp"; $ENV{"export_type"} = "exp";
...@@ -861,10 +810,10 @@ sub method_build () ...@@ -861,10 +810,10 @@ sub method_build ()
_build("exe", "rt_io_comm", "src", "all"); _build("exe", "rt_io_comm", "src", "all");
merge(); merge();
} }
if ( $flavour eq "") { if ($flavour eq "") {
$flavour = "gtk"; $flavour = "gtk";
} }
if ( $_[0] eq "wb" ) { if ($_[0] eq "wb" ) {
printf("-- Method build %s %s\n", $program, $flavour); printf("-- Method build %s %s\n", $program, $flavour);
_module("wb"); _module("wb");
...@@ -875,7 +824,7 @@ sub method_build () ...@@ -875,7 +824,7 @@ sub method_build ()
_build("exe", "wb", "src", "all"); _build("exe", "wb", "src", "all");
merge(); merge();
} }
if ( $_[0] eq "rt_xtt" ) { if ($_[0] eq "rt_xtt" ) {
printf("-- Method build %s %s\n", $program, $flavour); printf("-- Method build %s %s\n", $program, $flavour);
_module("xtt"); _module("xtt");
...@@ -888,9 +837,9 @@ sub method_build () ...@@ -888,9 +837,9 @@ sub method_build ()
} }
} }
sub create_all_modules () sub create_all_modules()
{ {
if ( ! -e $configfile ) { if (! -e $configfile ) {
configure(); configure();
} }
...@@ -941,29 +890,29 @@ sub create_all_modules () ...@@ -941,29 +890,29 @@ sub create_all_modules ()
# #
# build_module() # build_module()
# #
sub build_module () sub build_module()
{ {
$copy = 0; $copy = 0;
$lib = 0; $lib = 0;
$exe = 0; $exe = 0;
if ( $_[0] eq "copy" || $_[1] eq "copy" || $_[2] eq "copy") { if ($_[0] eq "copy" || $_[1] eq "copy" || $_[2] eq "copy") {
$copy = 1; $copy = 1;
} }
if ( $_[0] eq "lib" || $_[1] eq "lib" || $_[2] eq "lib") { if ($_[0] eq "lib" || $_[1] eq "lib" || $_[2] eq "lib") {
$lib = 1; $lib = 1;
} }
if ( $_[0] eq "exe" || $_[1] eq "exe" || $_[2] eq "exe") { if ($_[0] eq "exe" || $_[1] eq "exe" || $_[2] eq "exe") {
$exe = 1; $exe = 1;
} }
if ( $copy == 0 && $lib == 0 && $exe == 0) { if ($copy == 0 && $lib == 0 && $exe == 0) {
$copy = 1; $copy = 1;
$lib = 1; $lib = 1;
$exe = 1; $exe = 1;
} }
if ( $_[0] eq "motif" || $_[1] eq "motif" || $_[2] eq "motif" || $_[3] eq "motif") { if ($_[0] eq "motif" || $_[1] eq "motif" || $_[2] eq "motif" || $_[3] eq "motif") {
$flavour = "motif"; $flavour = "motif";
} elsif ( $_[0] eq "qt" || $_[1] eq "qt" || $_[2] eq "qt" || $_[3] eq "qt") { } elsif ($_[0] eq "qt" || $_[1] eq "qt" || $_[2] eq "qt" || $_[3] eq "qt") {
$flavour = "qt"; $flavour = "qt";
} else { } else {
$flavour = "gtk"; $flavour = "gtk";
...@@ -981,14 +930,14 @@ sub build_module () ...@@ -981,14 +930,14 @@ sub build_module ()
my($bcompclasses) = $einc . "/pwr_basecomponentsclasses.h"; my($bcompclasses) = $einc . "/pwr_basecomponentsclasses.h";
my($otherioclasses) = $einc . "/pwr_otherioclasses.h"; my($otherioclasses) = $einc . "/pwr_otherioclasses.h";
if ( $ver == 1) { if ($ver == 1) {
printf("\n"); printf("\n");
} }
printf("-- Build module %s\n", $module); printf("-- Build module %s\n", $module);
#show(); #show();
if ( $module eq "rt") { if ($module eq "rt") {
if ( $copy == 1) { if ($copy == 1) {
_build("exp", "inc", "src", "all"); _build("exp", "inc", "src", "all");
_build("exp", "com", "src", "all"); _build("exp", "com", "src", "all");
_build("tools/exe", "*", "src", "all"); _build("tools/exe", "*", "src", "all");
...@@ -1016,32 +965,32 @@ sub build_module () ...@@ -1016,32 +965,32 @@ sub build_module ()
_build("exp", "stdsoap2", "src", "copy"); _build("exp", "stdsoap2", "src", "copy");
} }
if ( $lib == 1) { if ($lib == 1) {
if ( ! -e $nmpsclasses ) { if (! -e $nmpsclasses ) {
_module("nmps"); _module("nmps");
_build("wbl", "nmps", "src", "init"); _build("wbl", "nmps", "src", "init");
_build("wbl", "nmps", "src", "copy"); _build("wbl", "nmps", "src", "copy");
merge("inc/pwr_nmpsclasses.h"); merge("inc/pwr_nmpsclasses.h");
} }
if ( ! -e $remoteclasses ) { if (! -e $remoteclasses ) {
_module("remote"); _module("remote");
_build("wbl", "remote", "src", "init"); _build("wbl", "remote", "src", "init");
_build("wbl", "remote", "src", "copy"); _build("wbl", "remote", "src", "copy");
merge("inc/pwr_remoteclasses.h"); merge("inc/pwr_remoteclasses.h");
} }
if ( ! -e $profibusclasses ) { if (! -e $profibusclasses ) {
_module("profibus"); _module("profibus");
_build("wbl", "mcomp", "src", "init"); _build("wbl", "mcomp", "src", "init");
_build("wbl", "mcomp", "src", "copy"); _build("wbl", "mcomp", "src", "copy");
merge("inc/pwr_profibusclasses.h"); merge("inc/pwr_profibusclasses.h");
} }
if ( ! -e $bcompclasses ) { if (! -e $bcompclasses ) {
_module("bcomp"); _module("bcomp");
_build("wbl", "bcomp", "src", "init"); _build("wbl", "bcomp", "src", "init");
_build("wbl", "bcomp", "src", "copy"); _build("wbl", "bcomp", "src", "copy");
merge("inc/pwr_basecomponentclasses.h"); merge("inc/pwr_basecomponentclasses.h");
} }
if ( ! -e $otherioclasses ) { if (! -e $otherioclasses ) {
_module("otherio"); _module("otherio");
_build("wbl", "mcomp", "src", "init"); _build("wbl", "mcomp", "src", "init");
_build("wbl", "mcomp", "src", "copy"); _build("wbl", "mcomp", "src", "copy");
...@@ -1055,7 +1004,7 @@ sub build_module () ...@@ -1055,7 +1004,7 @@ sub build_module ()
_build("lib", "statussrv", "src", "all"); _build("lib", "statussrv", "src", "all");
_build("exp", "stdsoap2", "src", "all"); _build("exp", "stdsoap2", "src", "all");
} }
if ( $exe == 1) { if ($exe == 1) {
_build("exe", "wb_rtt", "src", "all"); _build("exe", "wb_rtt", "src", "all");
_build("lib", "dtt", "src", "all"); _build("lib", "dtt", "src", "all");
_build("exe", "rt*", "src", "all"); _build("exe", "rt*", "src", "all");
...@@ -1078,23 +1027,21 @@ sub build_module () ...@@ -1078,23 +1027,21 @@ sub build_module ()
_build("wbl", "pwrs", "src", "exe"); _build("wbl", "pwrs", "src", "exe");
_build("wbl", "pwrb", "src", "exe"); _build("wbl", "pwrb", "src", "exe");
} }
} } elsif ($module eq "java") {
elsif ( $module eq "java") { if ($copy == 1) {
if ( $copy == 1) {
_build("jsw", "*", "src", "all"); _build("jsw", "*", "src", "all");
} }
if ( $lib == 1) { if ($lib == 1) {
_build("jpwr", "rt", "src", "all"); _build("jpwr", "rt", "src", "all");
_build("jpwr", "jopg", "src", "all"); _build("jpwr", "jopg", "src", "all");
_build("jpwr", "jop", "src", "all"); _build("jpwr", "jop", "src", "all");
_build("jpwr", "rt_client", "src", "all"); _build("jpwr", "rt_client", "src", "all");
} }
if ( $exe == 1) { if ($exe == 1) {
_build("exe", "jpwr_rt_gdh", "src", "all"); _build("exe", "jpwr_rt_gdh", "src", "all");
} }
} } elsif ($module eq "profibus") {
elsif ( $module eq "profibus") { if ($copy == 1) {
if ( $copy == 1) {
_build("wbl", "*", "src", "init"); _build("wbl", "*", "src", "init");
_build("wbl", "*", "src", "copy"); _build("wbl", "*", "src", "copy");
_build("lib", "*", "src", "init"); _build("lib", "*", "src", "init");
...@@ -1106,23 +1053,22 @@ sub build_module () ...@@ -1106,23 +1053,22 @@ sub build_module ()
_build("mmi", "*", $flavour, "copy"); _build("mmi", "*", $flavour, "copy");
_build("exe", "*", "src", "copy"); _build("exe", "*", "src", "copy");
} }
if ( $lib == 1) { if ($lib == 1) {
_build("lib", "*", "src", "lib"); _build("lib", "*", "src", "lib");
_build("lib", "*", $flavour, "lib"); _build("lib", "*", $flavour, "lib");
_build("exp", "*", "src", "lib"); _build("exp", "*", "src", "lib");
} }
if ( $exe == 1) { if ($exe == 1) {
_build("wbl", "*", "src", "lib"); _build("wbl", "*", "src", "lib");
_build("wbl", "*", "src", "exe"); _build("wbl", "*", "src", "exe");
if ( $lib == 1) { if ($lib == 1) {
merge(); merge();
} }
_build("exe", "*", "src", "all"); _build("exe", "*", "src", "all");
_build("exe", "*", $flavour, "all"); _build("exe", "*", $flavour, "all");
} }
} } else {
else { if ($copy == 1) {
if ( $copy == 1) {
_build("wbl", "*", "src", "init"); _build("wbl", "*", "src", "init");
_build("wbl", "*", "src", "copy"); _build("wbl", "*", "src", "copy");
_build("lib", "*", "src", "init"); _build("lib", "*", "src", "init");
...@@ -1134,12 +1080,12 @@ sub build_module () ...@@ -1134,12 +1080,12 @@ sub build_module ()
_build("mmi", "*", $flavour, "copy"); _build("mmi", "*", $flavour, "copy");
_build("exe", "*", "src", "copy"); _build("exe", "*", "src", "copy");
} }
if ( $lib == 1) { if ($lib == 1) {
_build("lib", "*", "src", "lib"); _build("lib", "*", "src", "lib");
_build("lib", "*", $flavour, "lib"); _build("lib", "*", $flavour, "lib");
_build("exp", "*", "src", "lib"); _build("exp", "*", "src", "lib");
} }
if ( $exe == 1) { if ($exe == 1) {
_build("wbl", "*", "src", "lib"); _build("wbl", "*", "src", "lib");
_build("wbl", "*", "src", "exe"); _build("wbl", "*", "src", "exe");
_build("exe", "*", "src", "all"); _build("exe", "*", "src", "all");
...@@ -1150,11 +1096,10 @@ sub build_module () ...@@ -1150,11 +1096,10 @@ sub build_module ()
} }
} }
# #
# copy() # copy()
# #
sub copy () sub copy()
{ {
if (!defined($ENV{"pwre_env"})) { if (!defined($ENV{"pwre_env"})) {
print("++ Environment is not initialized!\n"); print("++ Environment is not initialized!\n");
...@@ -1171,41 +1116,33 @@ sub copy () ...@@ -1171,41 +1116,33 @@ sub copy ()
printf("-- Import root: %s\n", $vmsinc); printf("-- Import root: %s\n", $vmsinc);
printf("--\n"); printf("--\n");
if ( $_[0] eq "doc" ) { if ($_[0] eq "doc" ) {
my($cmd) = "cp -r " . $vmsinc . "/exp/doc/* " . $docroot; system("cp -r " . $vmsinc . "/exp/doc/* " . $docroot);
system("$cmd"); } elsif ($_[0] eq "dbs" ) {
} system("$bindir/import_dbs.sh " . $vmsinc . " " . $exproot);
elsif ( $_[0] eq "dbs" ) { } else {
my($cmd) = "$bindir/import_dbs.sh " . $vmsinc . " " . $exproot;
system("$cmd");
}
else {
if ($hw eq "x86" && $real_hw eq "x86_64") { if ($hw eq "x86" && $real_hw eq "x86_64") {
$ENV{"cross_compile"} = "-m32"; $ENV{"cross_compile"} = "-m32";
} }
my($cmd) = "make -f $bindir/import_files.mk" . " " . $_[0]; system("make -f $bindir/import_files.mk" . " " . $_[0]);
system("$cmd");
my $flavour = $_[1]; my $flavour = $_[1];
if ($flavour eq "") {
if ( $flavour eq "") {
$flavour = "gtk"; $flavour = "gtk";
} }
my($cmd) = "make -f $bindir/import_files.mk" . " " . $_[0] . "_" . $flavour; system("make -f $bindir/import_files.mk" . " " . $_[0] . "_" . $flavour);
system("$cmd");
} }
} }
sub create() sub create()
{ {
if ( $_[0] eq "all" || $_[0] eq "") { if ($_[0] eq "all" || $_[0] eq "") {
create_all_modules(); create_all_modules();
return; return;
} }
if ( $_[0] eq "module" || $_[0] eq "") { if ($_[0] eq "module" || $_[0] eq "") {
create_module(); create_module();
return; return;
} }
...@@ -1222,7 +1159,6 @@ sub create_module() ...@@ -1222,7 +1159,6 @@ sub create_module()
my($root) = $ENV{"pwre_broot"}; my($root) = $ENV{"pwre_broot"};
my($module) = $ENV{"pwre_bmodule"}; my($module) = $ENV{"pwre_bmodule"};
if (!defined($root)) { if (!defined($root)) {
printf("++\n++ No build root is defined\n"); printf("++\n++ No build root is defined\n");
exit 1; exit 1;
...@@ -1236,7 +1172,7 @@ sub create_module() ...@@ -1236,7 +1172,7 @@ sub create_module()
$root .= "/" . $ENV{"pwre_hw"}; $root .= "/" . $ENV{"pwre_hw"};
create_dir($root); create_dir($root);
printf( "-- Creating build tree %s/%s\n", $root, $module); printf("-- Creating build tree %s/%s\n", $root, $module);
$newdir = $root . "/bld"; $newdir = $root . "/bld";
create_dir($newdir); create_dir($newdir);
...@@ -1261,9 +1197,8 @@ sub create_module() ...@@ -1261,9 +1197,8 @@ sub create_module()
# #
# dele() # dele()
# #
sub dele () sub dele()
{ {
use DB_File; use DB_File;
tie(%envdb, "DB_File", $dbname, O_CREAT|O_RDWR, 0644) || die "++ can't tie $dbname!"; tie(%envdb, "DB_File", $dbname, O_CREAT|O_RDWR, 0644) || die "++ can't tie $dbname!";
...@@ -1289,7 +1224,7 @@ sub dele () ...@@ -1289,7 +1224,7 @@ sub dele ()
# #
# help # help
# #
sub help () sub help()
{ {
my($key); my($key);
...@@ -1301,6 +1236,7 @@ sub help () ...@@ -1301,6 +1236,7 @@ sub help ()
foreach $key (sort keys (%verbs)) { foreach $key (sort keys (%verbs)) {
($verb, $usage) = split(/:/, $verbs{$key}); ($verb, $usage) = split(/:/, $verbs{$key});
if (!($verb =~ /^_/)) { if (!($verb =~ /^_/)) {
printf("++\n");
&$usage(); &$usage();
} }
} }
...@@ -1309,11 +1245,10 @@ sub help () ...@@ -1309,11 +1245,10 @@ sub help ()
exit 1; exit 1;
} }
# #
# list() # list()
# #
sub list () sub list()
{ {
my($env); my($env);
printf("Using Database:%s\n",$dbname); printf("Using Database:%s\n",$dbname);
...@@ -1331,14 +1266,12 @@ sub list () ...@@ -1331,14 +1266,12 @@ sub list ()
print("--\n"); print("--\n");
untie(%envdb)|| die "++ can't untie $dbname!"; untie(%envdb)|| die "++ can't untie $dbname!";
} }
# #
# modify() # modify()
# #
sub modify () sub modify()
{ {
use DB_File; use DB_File;
tie(%envdb, "DB_File", $dbname, O_CREAT|O_RDWR, 0644) || die "++ can't tie $dbname!"; tie(%envdb, "DB_File", $dbname, O_CREAT|O_RDWR, 0644) || die "++ can't tie $dbname!";
...@@ -1354,13 +1287,11 @@ sub modify () ...@@ -1354,13 +1287,11 @@ sub modify ()
untie(%envdb)|| die "++ can't untie $dbname!"; untie(%envdb)|| die "++ can't untie $dbname!";
} }
# #
# show # show
# #
sub show () sub show()
{ {
if ($_[0] ne "") { if ($_[0] ne "") {
$label = $_[0]; $label = $_[0];
} else { } else {
...@@ -1376,7 +1307,6 @@ sub show () ...@@ -1376,7 +1307,6 @@ sub show ()
read_vars(); read_vars();
if ($varstr ne "") { if ($varstr ne "") {
print("--\n"); print("--\n");
printf("-- Environment : %s\n", $label); printf("-- Environment : %s\n", $label);
show_vars(); show_vars();
...@@ -1390,7 +1320,7 @@ sub show () ...@@ -1390,7 +1320,7 @@ sub show ()
# #
# tags() # tags()
# #
sub tags () sub tags()
{ {
if (!defined($ENV{"pwre_env"})) { if (!defined($ENV{"pwre_env"})) {
print("++ Environment is not initialized!\n"); print("++ Environment is not initialized!\n");
...@@ -1400,16 +1330,13 @@ sub tags () ...@@ -1400,16 +1330,13 @@ sub tags ()
printf("--\n"); printf("--\n");
printf("-- Creating a CRiSP tag-file named ~/pwre/tags\n"); printf("-- Creating a CRiSP tag-file named ~/pwre/tags\n");
system("pwr_tags") && exit; system("pwr_tags") && exit;
} }
# #
# _build() # _build()
# #
sub _build () # args: branch, subbranch, flavour, phase sub _build() # args: branch, subbranch, flavour, phase
{ {
my($branch) = $_[0]; my($branch) = $_[0];
if (!defined($branch)) { if (!defined($branch)) {
usage_build(); usage_build();
...@@ -1426,8 +1353,8 @@ sub _build () # args: branch, subbranch, flavour, phase ...@@ -1426,8 +1353,8 @@ sub _build () # args: branch, subbranch, flavour, phase
shift(@_); shift(@_);
shift(@_); shift(@_);
if ( $ver == 1) { if ($ver == 1) {
printf( "-- Build %s %s %s\n", $branch, $subbranch, $flavor); printf("-- Build %s %s %s\n", $branch, $subbranch, $flavor);
} }
my($grepstr) = $ENV{"pwre_target"}; my($grepstr) = $ENV{"pwre_target"};
...@@ -1445,6 +1372,9 @@ sub _build () # args: branch, subbranch, flavour, phase ...@@ -1445,6 +1372,9 @@ sub _build () # args: branch, subbranch, flavour, phase
$ENV{"cross_compile"} = "-m32"; $ENV{"cross_compile"} = "-m32";
} }
chomp(my $cpu_count = `grep -c -P '^processor' /proc/cpuinfo`);
$cpu_count = $cpu_count * 2;
foreach $dir1 (@dirs1) { foreach $dir1 (@dirs1) {
$globstr1 = "$dir1" . "/$subbranch/$flavour"; $globstr1 = "$dir1" . "/$subbranch/$flavour";
@dirs2 = glob($globstr1); @dirs2 = glob($globstr1);
...@@ -1461,11 +1391,11 @@ sub _build () # args: branch, subbranch, flavour, phase ...@@ -1461,11 +1391,11 @@ sub _build () # args: branch, subbranch, flavour, phase
$makefile = $ENV{"pwre_croot"} . "/src/tools/bld/src/generic_makefile"; $makefile = $ENV{"pwre_croot"} . "/src/tools/bld/src/generic_makefile";
} }
if (($parallel eq "1" && $branch eq "lib" && $subbranch ne "dtt") || $branch eq "wbl") { if ($parallel eq "1" && (($branch eq "lib" && $subbranch ne "dtt") || $branch eq "wbl")) {
# All libraries and wbl files can be compiled in parallel # All libraries and wbl files can be compiled in parallel
system("make --debug=n -f $makefile -j8 -l8 @_") && exit 1; system("make -f $makefile -j$cpu_count -l$cpu_count @_") && exit 1;
} else { } else {
system("make --debug=n -f $makefile @_") && exit 1; system("make -f $makefile @_") && exit 1;
} }
} }
} }
...@@ -1474,14 +1404,14 @@ sub _build () # args: branch, subbranch, flavour, phase ...@@ -1474,14 +1404,14 @@ sub _build () # args: branch, subbranch, flavour, phase
# #
# merge() # merge()
# #
sub merge () sub merge()
{ {
if (!defined($ENV{"pwre_env"})) { if (!defined($ENV{"pwre_env"})) {
print("++ Environment is not initialized!\n"); print("++ Environment is not initialized!\n");
exit 1; exit 1;
} }
if ( $_[0] eq "-v") { if ($_[0] eq "-v") {
$ver = 1; $ver = 1;
shift(@_); shift(@_);
} }
...@@ -1503,20 +1433,18 @@ sub merge () ...@@ -1503,20 +1433,18 @@ sub merge ()
my($mroot) = $eroot; my($mroot) = $eroot;
$mroot .= "/" . $ENV{"pwre_module"}; $mroot .= "/" . $ENV{"pwre_module"};
$eroot .= "/exp"; $eroot .= "/exp";
if ( $ver == 1) { if ($ver == 1) {
printf("\n"); printf("\n");
printf("-- Merge %s %s\n", $module, $file); printf("-- Merge %s %s\n", $module, $file);
} }
my($cmd) = $ENV{pwre_bin} . "/pwre_merge.sh " . $ver . " " . $mroot . " " . $eroot . " " . $file; system($ENV{pwre_bin} . "/pwre_merge.sh " . $ver . " " . $mroot . " " . $eroot . " " . $file);
system("$cmd");
} }
# #
# _exists() # _exists()
# #
sub _exists () sub _exists()
{ {
my($ret) = 1; my($ret) = 1;
use DB_File; use DB_File;
...@@ -1535,9 +1463,8 @@ sub _exists () ...@@ -1535,9 +1463,8 @@ sub _exists ()
# #
# _print() # _print()
# #
sub _print () sub _print()
{ {
use DB_File; use DB_File;
tie(%envdb, "DB_File", $dbname, O_CREAT|O_RDWR, 0644) || die "++ can't tie $dbname!"; tie(%envdb, "DB_File", $dbname, O_CREAT|O_RDWR, 0644) || die "++ can't tie $dbname!";
...@@ -1559,8 +1486,8 @@ sub _print () ...@@ -1559,8 +1486,8 @@ sub _print ()
sub _module() sub _module()
{ {
if ( $ver == 1) { if ($ver == 1) {
printf( "-- Set module %s\n", $_[0]); printf("-- Set module %s\n", $_[0]);
} }
my($modu) = $_[0]; my($modu) = $_[0];
...@@ -1571,11 +1498,10 @@ sub _module() ...@@ -1571,11 +1498,10 @@ sub _module()
$ENV{"pwre_module"} = $modu; $ENV{"pwre_module"} = $modu;
$ENV{"pwre_bmodule"} = $modu; $ENV{"pwre_bmodule"} = $modu;
if ( $modu eq "rt") { if ($modu eq "rt") {
# $ENV{"pwre_bmodule"} = "exp"; # $ENV{"pwre_bmodule"} = "exp";
$ENV{"pwre_sroot"} = $sroot . "/src"; $ENV{"pwre_sroot"} = $sroot . "/src";
} } else {
else {
$ENV{"pwre_sroot"} = $sroot . "/" . $modu; $ENV{"pwre_sroot"} = $sroot . "/" . $modu;
} }
$ENV{"pwr_exe"} = $broot . "/" . $ENV{"pwre_bmodule"} . "/exe"; $ENV{"pwr_exe"} = $broot . "/" . $ENV{"pwre_bmodule"} . "/exe";
...@@ -1636,8 +1562,7 @@ sub create_dir() ...@@ -1636,8 +1562,7 @@ sub create_dir()
} }
} }
sub get_vars()
sub get_vars ()
{ {
if ($_[1] eq "") { if ($_[1] eq "") {
$sroot = get_var(" Source root [%s]? ", $sroot); $sroot = get_var(" Source root [%s]? ", $sroot);
...@@ -1676,10 +1601,8 @@ sub get_vars () ...@@ -1676,10 +1601,8 @@ sub get_vars ()
} }
$varstr = join(";", ($sroot, $vmsinc, $broot, $btype, $os, $hw, $desc)); $varstr = join(";", ($sroot, $vmsinc, $broot, $btype, $os, $hw, $desc));
} }
sub get_var() sub get_var()
{ {
my($tmp); my($tmp);
...@@ -1690,25 +1613,22 @@ sub get_var() ...@@ -1690,25 +1613,22 @@ sub get_var()
$tmp = $_[1]; $tmp = $_[1];
} }
return $tmp; return $tmp;
} }
sub read_vars () sub read_vars()
{ {
$varstr = $envdb{$label}; $varstr = $envdb{$label};
($sroot, $vmsinc, $broot, $btype, $os, $hw, $desc) = split(/;/, $varstr); ($sroot, $vmsinc, $broot, $btype, $os, $hw, $desc) = split(/;/, $varstr);
@vars = ($sroot, $vmsinc, $broot, $btype, $os, $hw, $desc); @vars = ($sroot, $vmsinc, $broot, $btype, $os, $hw, $desc);
} }
sub show_vars()
sub show_vars ()
{ {
my($module) = $ENV{"pwre_module"}; my($module) = $ENV{"pwre_module"};
printf("-- Module.........: %s\n", $module); printf("-- Module.........: %s\n", $module);
printf("-- Source root....: %s\n", $sroot); printf("-- Source root....: %s\n", $sroot);
if ( $vmsinc ne "") { if ($vmsinc ne "") {
printf("-- Import root....: %s\n", $vmsinc); printf("-- Import root....: %s\n", $vmsinc);
} }
printf("-- Build root.....: %s\n", $broot); printf("-- Build root.....: %s\n", $broot);
...@@ -1718,146 +1638,122 @@ sub show_vars () ...@@ -1718,146 +1638,122 @@ sub show_vars ()
printf("-- Description....: %s\n", $desc); printf("-- Description....: %s\n", $desc);
} }
sub update_db () sub update_db()
{ {
$envdb{$label} = $varstr; $envdb{$label} = $varstr;
} }
sub usage_add () sub usage_add()
{ {
printf("++\n");
printf("++ add env : Adds an environment to the database\n"); printf("++ add env : Adds an environment to the database\n");
} }
sub usage_configure () sub usage_configure()
{ {
printf("++\n");
printf("++ configure : Configures an environment\n"); printf("++ configure : Configures an environment\n");
} }
sub usage_build () sub usage_build()
{ {
printf("++\n");
printf("++ build 'branch' 'subbranch' ['flavour']['phase']: Build, eg. pwre build exe rt* src all\n"); printf("++ build 'branch' 'subbranch' ['flavour']['phase']: Build, eg. pwre build exe rt* src all\n");
} }
sub usage_build_module () sub usage_build_module()
{ {
printf("++\n");
printf("++ build_module : Builds all in current module\n"); printf("++ build_module : Builds all in current module\n");
} }
sub usage_build_kernel () sub usage_build_kernel()
{ {
printf("++\n");
printf("++ build_kernel : Builds all in kernel modules (kernel, xtt, wb)\n"); printf("++ build_kernel : Builds all in kernel modules (kernel, xtt, wb)\n");
} }
sub usage_build_all_modules () sub usage_build_all_modules()
{ {
printf("++\n");
printf("++ build_all_modules : Builds all in all modules\n"); printf("++ build_all_modules : Builds all in all modules\n");
} }
sub usage_build_all_wbl () sub usage_build_all_wbl()
{ {
printf("++\n");
printf("++ build_all_wbl : Builds wbl in all modules\n"); printf("++ build_all_wbl : Builds wbl in all modules\n");
} }
sub usage_ebuild () sub usage_ebuild()
{ {
printf("++\n");
printf("++ ebuild 'block' 'flavour' : Builds rt or op block\n"); printf("++ ebuild 'block' 'flavour' : Builds rt or op block\n");
} }
sub usage_clean_exe_all () sub usage_clean_exe_all()
{ {
printf("++\n");
printf("++ clean_exe_all : Cleans all exe in all modules\n"); printf("++ clean_exe_all : Cleans all exe in all modules\n");
} }
sub usage_method_build () sub usage_method_build()
{ {
printf("++\n");
printf("++ method_build : Rebuild method dependent programs\n"); printf("++ method_build : Rebuild method dependent programs\n");
} }
sub usage_create_all_modules () sub usage_create_all_modules()
{ {
printf("++\n");
printf("++ create_all_modules : Create build trees for all modules\n"); printf("++ create_all_modules : Create build trees for all modules\n");
} }
sub usage_copy () sub usage_copy()
{ {
printf("++\n");
printf("++ copy : Copy Proview include files from the VMS host\n"); printf("++ copy : Copy Proview include files from the VMS host\n");
} }
sub usage_create () sub usage_create()
{ {
printf("++\n");
printf("++ create : Creates the build directory tree\n"); printf("++ create : Creates the build directory tree\n");
} }
sub usage_dele () sub usage_dele()
{ {
printf("++\n");
printf("++ delete 'env' : Deletes an environment from the database\n"); printf("++ delete 'env' : Deletes an environment from the database\n");
} }
sub usage_help () sub usage_help()
{ {
printf("++\n");
printf("++ help : Lists all command verbs\n"); printf("++ help : Lists all command verbs\n");
} }
sub usage_list () sub usage_list()
{ {
printf("++\n");
printf("++ list : Lists all environments in the database\n"); printf("++ list : Lists all environments in the database\n");
} }
sub usage_init () sub usage_init()
{ {
printf("++\n");
printf("++ init 'env' : Inits an environment\n"); printf("++ init 'env' : Inits an environment\n");
} }
sub usage_import () sub usage_import()
{ {
printf("++\n");
printf("++ import 'block' ['flavour'] : Import files from import root, block dbs, rt, op, java, doc\n"); printf("++ import 'block' ['flavour'] : Import files from import root, block dbs, rt, op, java, doc\n");
} }
sub usage_module () sub usage_module()
{ {
printf("++\n");
printf("++ module 'module' : Set module\n"); printf("++ module 'module' : Set module\n");
} }
sub usage_merge () sub usage_merge()
{ {
printf("++\n");
printf("++ merge : Merge module base to exp base\n"); printf("++ merge : Merge module base to exp base\n");
} }
sub usage_modify () sub usage_modify()
{ {
printf("++\n");
printf("++ modify 'env' : Modfies an existing environment\n"); printf("++ modify 'env' : Modfies an existing environment\n");
} }
sub usage_show()
sub usage_show ()
{ {
printf("++\n");
printf("++ show [env] : Shows current or given environment\n"); printf("++ show [env] : Shows current or given environment\n");
} }
sub usage_tags () sub usage_tags()
{ {
printf("++\n");
printf("++ tags : Creates a CRiSP tag-file named ~/pwre/tags\n"); printf("++ tags : Creates a CRiSP tag-file named ~/pwre/tags\n");
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment