1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789
|
#!/usr/bin/perl
# <copyright>
# Copyright (c) 2013-2014 Intel Corporation. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# </copyright>
# Pragmas.
use strict;
use warnings;
# Standard modules.
use Data::Dumper; # Not actually used, but useful for debugging dumps.
# Enable `libomp/tools/lib/' module directory.
use FindBin;
use lib "$FindBin::Bin/lib";
# LIBOMP modules.
use Build;
use LibOMP;
use Platform ":vars";
use Uname;
use tools;
our $VERSION = "0.017";
# --------------------------------------------------------------------------------------------------
# Important variables.
# --------------------------------------------------------------------------------------------------
my $root_dir = $ENV{ LIBOMP_WORK };
my %makefiles = (
rtl => cat_file( $root_dir, "src", "makefile.mk" ),
timelimit => cat_file( $root_dir, "tools", "src", "timelimit", "makefile.mk" ),
);
# --------------------------------------------------------------------------------------------------
# Parse command line.
# --------------------------------------------------------------------------------------------------
# Possible options.
# * targets: comma separated list of targets the option has meaning for. For example,
# "version" option (4 or 5) has a meaning only for "rtl" target, while "mode" option has
# meaning for all targets.
# * base: If base is true this is a base option. All the possible values of base options are
# iterated if "--all" option is specified. If base is 0, this is an extra option.
# * params: A hash of possible option values. "*" denotes default option value. For example,
# if "versio" option is not specified, "--version=5" will be used implicitly.
# * suffux: Only for extra options. Subroutine returning suffix for build and output
# directories.
my $opts = {
"target" => { targets => "", base => 1, parms => { map( ( $_ => "" ), keys( %makefiles ) ), rtl => "*" }, },
"version" => { targets => "rtl", base => 1, parms => { 5 => "*", 4 => "" }, },
"lib-type" => { targets => "rtl", base => 1, parms => { normal => "*", stubs => "" }, },
"link-type" => { targets => "rtl", base => 1, parms => { dynamic => "*", static => "" }, },
"target-compiler" => { targets => "rtl,dsl", base => 0, parms => { 12 => "*", 11 => "" }, suffix => sub { $_[ 0 ]; } },
"mode" => { targets => "rtl,dsl,timelimit", base => 0, parms => { release => "*", diag => "", debug => "" }, suffix => sub { substr( $_[ 0 ], 0, 3 ); } },
"omp-version" => { targets => "rtl", base => 0, parms => { 40 => "*", 30 => "", 25 => "" }, suffix => sub { $_[ 0 ]; } },
"coverage" => { targets => "rtl", base => 0, parms => { off => "*", on => "" }, suffix => sub { $_[ 0 ] eq "on" ? "c1" : "c0"; } },
"tcheck" => { targets => "rtl", base => 0, parms => { 0 => "*", 1 => "", 2 => "" }, suffix => sub { "t" . $_[ 0 ]; } },
"mic-arch" => { targets => "rtl", base => 0, parms => { knf => "*", knc => "", knl => "" }, suffix => sub { $_[ 0 ]; } },
"mic-os" => { targets => "rtl", base => 0, parms => { bsd => "*", lin => "" }, suffix => sub { $_[ 0 ]; } },
"mic-comp" => { targets => "rtl", base => 0, parms => { native => "*", offload => "" }, suffix => sub { substr( $_[ 0 ], 0, 3 ); } },
};
my $synonyms = {
"debug" => [ qw{ dbg debg } ],
};
# This array specifies order of options to process, so it cannot be initialized with keys( %$opts ).
my @all_opts = qw{ target version lib-type link-type target-compiler mode omp-version coverage tcheck mic-arch mic-os mic-comp };
# This is the list of base options.
my @base_opts = grep( $opts->{ $_ }->{ base } == 1, @all_opts );
# This is the list of extra options.
my @extra_opts = grep( $opts->{ $_ }->{ base } == 0, @all_opts );
sub suffix($$$) {
my ( $opt, $value, $skip_if_default ) = @_;
my $suffix = "";
if ( not $skip_if_default or $value ne $opts->{ $opt }->{ dflt } ) {
$suffix = $opts->{ $opt }->{ suffix }->( $value );
}; # if
return $suffix;
}; # sub suffix
my $scuts = {}; # Shortcuts. Will help to locate proper item in $opts.
foreach my $opt ( keys( %$opts ) ) {
foreach my $parm ( keys( %{ $opts->{ $opt }->{ parms } } ) ) {
if ( $parm !~ m{\A(?:[012]|on|off)\z} ) {
$scuts->{ $parm } = $opts->{ $opt };
}; # if
if ( $opts->{ $opt }->{ parms }->{ $parm } eq "*" ) {
$opts->{ $opt }->{ dflt } = $parm;
}; # if
}; # foreach $parm
}; # foreach $opt
sub parse_option(@) {
# This function is called to process every option. $name is option name, $value is option value.
# For boolean options $value is either 1 or 0,
my ( $name, $value ) = @_;
if ( $name eq "all" or $name eq "ALL" ) {
foreach my $opt ( keys( %$opts ) ) {
if ( $opts->{ $opt }->{ base } or $name eq "ALL" ) {
foreach my $parm ( keys( %{ $opts->{ $opt }->{ parms } } ) ) {
$opts->{ $opt }->{ parms }->{ $parm } = 1;
}; # foreach $parm
}; # if
}; # foreach $opt
return;
}; # if
if ( exists( $opts->{ $name } ) ) {
# Suppose it is option with explicit value, like "target=normal".
if ( $value eq "all" ) {
foreach my $parm ( keys( %{ $opts->{ $name }->{ parms } } ) ) {
$opts->{ $name }->{ parms }->{ $parm } = 1;
}; # foreach
return;
} elsif ( exists( $opts->{ $name }->{ parms }->{ $value } ) ) {
$opts->{ $name }->{ parms }->{ $value } = 1;
return;
} elsif ( $value eq "" and exists( $opts->{ $name }->{ parms }->{ on } ) ) {
$opts->{ $name }->{ parms }->{ on } = 1;
return;
} else {
cmdline_error( "Illegal value of \"$name\" option: \"$value\"" );
}; # if
}; # if
# Ok, it is not an option with explicit value. Try to treat is as a boolean option.
if ( exists( $scuts->{ $name } ) ) {
( $value eq "1" or $value eq "0" ) or die "Internal error; stopped";
$scuts->{ $name }->{ parms }->{ $name } = $value;
return;
}; # if
# No, it is not a valid option at all.
cmdline_error( "Illegal option: \"$name\"" );
}; # sub parse_option
my $clean = 0;
my $clean_common = 0;
my $clobber = 0;
my $test_deps = 1;
my $test_touch = 1;
my @goals;
sub synonyms($) {
my ( $opt ) = @_;
return exists( $synonyms->{ $opt } ) ? "|" . join( "|", @{ $synonyms->{ $opt } } ) : "";
}; # sub synonyms
my @specs = (
map( ( "$_" . synonyms( $_ ) . "=s" => \&parse_option ), keys( %$opts ) ),
map( ( "$_" . synonyms( $_ ) . "!" => \&parse_option ), keys( %$scuts ) ),
);
my $answer;
get_options(
@specs,
Platform::target_options(),
"all" => \&parse_option,
"ALL" => \&parse_option,
"answer=s" => \$answer,
"test-deps!" => \$test_deps,
"test-touch!" => \$test_touch,
"version|ver:s" =>
sub {
# It is a tricky option. It specifies library version to build and it is also a standard
# option to request tool version.
if ( $_[ 1 ] eq "" ) {
# No arguments => version request.
print( "$tool version $VERSION\n" );
exit( 0 );
} else {
# Arguments => version to build.
parse_option( @_ )
};
},
);
@goals = @ARGV;
if ( grep( $_ eq "clobber", @goals ) ) {
$clobber = 1;
}; # if
if ( grep( $_ eq "clean", @goals ) ) {
$clean = 1;
}; # if
# Ok, now $opts is fulfilled with 0, 1 (explicitly set by the user) and "" and "*" (original
# values). In each option at least one 1 should be present (otherwise there is nothing to build).
foreach my $opt ( keys( %$opts ) ) {
if ( not grep( $_ eq "1", values( %{ $opts->{ $opt }->{ parms } } ) ) ) {
# No explicit "1" found. Enable default choice by replacing "*" with "1".
foreach my $parm ( keys( %{ $opts->{ $opt }->{ parms } } ) ) {
if ( $opts->{ $opt }->{ parms }->{ $parm } eq "*" ) {
$opts->{ $opt }->{ parms }->{ $parm } = 1;
}; # if
}; # foreach $parm
}; # if
}; # foreach $opt
# Clear $opts. Leave only "1".
foreach my $opt ( keys( %$opts ) ) {
foreach my $parm ( keys( %{ $opts->{ $opt }->{ parms } } ) ) {
if ( $opts->{ $opt }->{ parms }->{ $parm } ne "1" ) {
delete( $opts->{ $opt }->{ parms }->{ $parm } );
}; # if
}; # foreach $parm
}; # foreach $opt
# --------------------------------------------------------------------------------------------------
# Fill job queue.
# --------------------------------------------------------------------------------------------------
sub enqueue_jobs($$@);
sub enqueue_jobs($$@) {
my ( $jobs, $set, @rest ) = @_;
if ( @rest ) {
my $opt = shift( @rest );
if (
exists( $set->{ target } )
and
$opts->{ $opt }->{ targets } !~ m{(?:\A|,)$set->{ target }(?:,|\z)}
) {
# This option does not have meananing for the target,
# do not iterate, just use default value.
enqueue_jobs( $jobs, { $opt => $opts->{ $opt }->{ dflt }, %$set }, @rest );
} else {
foreach my $parm ( sort( keys( %{ $opts->{ $opt }->{ parms } } ) ) ) {
enqueue_jobs( $jobs, { $opt => $parm, %$set }, @rest );
}; # foreach $parm
}; # if
} else {
my $makefile = $makefiles{ $set->{ target } };
my @base = map( substr( $set->{ $_ }, 0, 3 ), @base_opts );
my @extra = map( suffix( $_, $set->{ $_ }, 0 ), @extra_opts );
my @ex = grep( $_ ne "", map( suffix( $_, $set->{ $_ }, 1 ), @extra_opts ) );
# Shortened version of @extra -- only non-default values.
my $suffix = ( @extra ? "." . join( ".", @extra ) : "" );
my $knights = index( $suffix, "kn" ) - 1;
if ( $target_platform !~ "lrb" and $knights > 0 ) {
$suffix = substr( $suffix, 0, $knights );
}
my $suf = ( @ex ? "." . join( ".", @ex ) : "" );
# Shortened version of $siffix -- only non-default values.
my $build_dir = join( "-", $target_platform, join( "_", @base ) . $suffix, Uname::host_name() );
my $out_arch_dir = cat_dir( $ENV{ LIBOMP_EXPORTS }, $target_platform . $suf );
my $out_cmn_dir = cat_dir( $ENV{ LIBOMP_EXPORTS }, "common" );
push(
@$jobs,
{
makefile => $makefile,
make_args => [
"os=" . $target_os,
"arch=" . $target_arch,
"MIC_OS=" . $set->{ "mic-os" },
"MIC_ARCH=" . $set->{ "mic-arch" },
"MIC_COMP=" . $set->{ "mic-comp" },
"date=" . Build::tstr( $Build::start ),
"TEST_DEPS=" . ( $test_deps ? "on" : "off" ),
"TEST_TOUCH=" . ( $test_touch ? "on" : "off" ),
"CPLUSPLUS=on",
"COVERAGE=" . $set->{ coverage },
# Option "mode" controls 3 make flags:
# debug => Full debugging : diagnostics, debug info, no optimization.
# diag => Only diagnostics : diagnostics, debug info, optimization.
# release => Production build : no diagnostics, no debug info, optimization.
"DEBUG_INFO=" . ( $set->{ mode } ne "release" ? "on" : "off" ),
"DIAG=" . ( $set->{ mode } ne "release" ? "on" : "off" ),
"OPTIMIZATION=" . ( $set->{ mode } ne "debug" ? "on" : "off" ),
"LIB_TYPE=" . substr( $set->{ "lib-type" }, 0, 4 ),
"LINK_TYPE=" . substr( $set->{ "link-type" }, 0, 4 ),
"OMP_VERSION=" . $set->{ "omp-version" },
"USE_TCHECK=" . $set->{ tcheck },
"VERSION=" . $set->{ version },
"TARGET_COMPILER=" . $set->{ "target-compiler" },
"suffix=" . $suf,
@goals,
],
build_dir => $build_dir
}
); # push
}; # if
}; # sub enqueue_jobs
my @jobs;
enqueue_jobs( \@jobs, {}, @all_opts );
# --------------------------------------------------------------------------------------------------
# Do the work.
# --------------------------------------------------------------------------------------------------
my $exit = 0;
Build::init();
if ( $clobber ) {
my @dirs = ( $ENV{ LIBOMP_TMP }, $ENV{ LIBOMP_EXPORTS }, cat_dir( $root_dir, "tools", "bin" ) );
my $rc = 0;
question(
"Clobber " . join( ", ", map( "\"" . Build::shorter( $_ ) . "\"", @dirs ) ) . " dirs? ",
$answer,
qr{\A(y|yes|n|no)\z}i
);
if ( $answer =~ m{\Ay}i ) {
info( "Clobbering..." );
$rc = Build::clean( @dirs );
info( Build::rstr( $rc ) );
}; # if
if ( $rc != 0 ) {
$exit = 3;
}; # if
} else { # Build or clean.
if ( @jobs ) {
my $total = @jobs; # Total number of jobs.
my $n = 0; # Current job number.
Build::progress( "", "" ); # Output empty line to log file.
my $goals = join( " ", @goals );
Build::progress( "Goals", $goals eq "" ? "(all)" : $goals );
Build::progress( "Configurations", scalar( @jobs ) );
foreach my $job ( @jobs ) {
++ $n;
my $base = get_file( $job->{ build_dir } );
Build::progress( "Making", "%3d of %3d : %s", $n, $total, $base );
$job->{ rc } = Build::make( $job, $clean, sprintf( "%d/%d", $n, $total ) );
}; # my $job
my $failures = Build::summary();
if ( $failures > 0 ) {
$exit = 3;
}; # if
} else {
info( "Nothing to do." );
}; # if
}; # if
# And exit.
exit( $exit );
__END__
=pod
=head1 NAME
B<build.pl> -- Build one or more configurations of OMP RTL libraries.
=head1 SYNOPSIS
B<build.pl> I<option>... [B<-->] I<make-option>... I<variable>... I<goal>...
=head1 OPTIONS
=over
=item B<--all>
Build all base configurations.
=item B<--ALL>
Build really all configurations, including extra ones.
=item B<--answer=>I<str>
Use specified string as default answer to all questions.
=item B<--architecture=>I<arch>
Specify target architecture to build. Default is architecture of host machine. I<arch> can be C<32>,
C<32e>, or one of known aliases like C<IA32>.
If architecture is not specified explicitly, value of LIBOMP_ARCH environment variable is used.
If LIBOMP_ARCH is not defined, host architecture detected.
=item B<--os=>I<os>
Specify target OS. Default is OS of host machine. I<os> can be C<lin>, C<lrb>, C<mac>, C<win>,
or one of known aliases like C<Linux>, C<WinNT>, etc.
=item B<--mic-os=>I<os>
Specify OS on Intel(R) Many Integrated Core Architecture card. Default is C<bsd>. I<os> can be C<bsd>, C<lin>.
=item B<--mic-arch=>I<arch>
Specify architecture of Intel(R) Many Integrated Core Architecture card. Default is C<knf>. I<arch> can be C<knf>, C<knc>, C<knl>.
=item B<--mic-comp=>I<compiler-type>
Specify whether the Intel(R) Many Integrated Core Compiler is native or offload. Default is C<native>.
I<compiler-type> can be C<native> or C<offload>.
=item B<-->[B<no->]B<test-deps>
Enable or disable C<test-deps>. The test runs in any case, but result of disabled test is ignored.
By default, test is enabled.
=item B<-->[B<no->]B<test-touch>
Enable or disable C<test-touch>. The test runs in any case, but result of disabled test is ignored.
By default, test is enabled.
=item Base Configuration Selection Options
=over
=item B<--target=>I<target>
Build specified target, either C<rtl> (OMP Runtime Library; default),
or C<timelimit> (program used in testing), or C<all>.
=item B<--lib-type=>I<lib>
Build specified library, either C<normal> (default), or C<stubs>, or C<all>.
=item B<--link-type=>I<type>
Build specified link type, either C<dynamic> (default) or C<all>.
=back
=item Extra Configuration Selection Options
=over
=item B<--cover=>I<switch>
Build for code coverage data collection. I<switch> can be C<off> (default), C<on>
or C<all>.
=item B<--mode=>I<mode>
Build library of specified I<mode>, either C<debug>, C<diag>, C<release> (default), or C<all>.
Mode controls 3 features:
---------------------------------------------------
feature/mode debug diag release
---------------------------------------------------
debug info o o
diagnostics (asserts, traces) o o
code optimization o o
---------------------------------------------------
=item B<--target-compiler=>I<version>
Build files for specified target compiler, C<11> or C<12>.
=back
=item Shortcuts
If option with C<no> prefix is used, corresponding configuration will B<not> be built.
Useful for excluding some configurations if one or more other options specified with C<all>
value (see Examples).
=over
=item B<-->[B<no>]B<11>
Build files for compiler C<11>.
=item B<-->[B<no>]B<12>
Build files for compiler C<12>.
=item B<-->[B<no>]B<debug>
=item B<-->[B<no>]B<debg>
=item B<-->[B<no>]B<dbg>
Build debuggable library.
=item B<-->[B<no>]B<diag>
Build library with diagnostics enabled.
=item B<-->[B<no>]B<dynamic>
Build dynamic library (default).
=item B<-->[B<no>]B<normal>
Build normal library (default).
=item B<-->[B<no>]B<release>
Build release library (default).
=item B<-->[B<no>]B<rtl>
Build OMP RTL (default).
=item B<-->[B<no>]B<stubs>
Build stubs library.
=item B<-->[B<no>]B<timelimit>
Build timelimit utility program.
=back
=item Standard Options
=over
=item B<--doc>
=item B<--manual>
Print full help message and exit.
=item B<--help>
Print short help message and exit.
=item B<--usage>
Print very short usage message and exit.
=item B<--verbose>
Do print informational messages.
=item B<--version>
Print program version and exit.
=item B<--quiet>
Work quiet, do not print informational messages.
=back
=back
=head1 ARGUMENTS
=over
=item I<make-option>
Any option for makefile, for example C<-k> or C<-n>. If you pass some options to makefile, C<-->
delimiter is mandatory, otherwise C<build.pl> processes all the options internally.
=item I<variable>
Define makefile variable in form I<name>B<=>I<value>. Most makefile capabilities are
accessible through C<build.pl> options, so there is no need in defining make variables in command
line.
=item I<goal>
Makefile goal to build (or clean).
=over
=item B<all>
Build C<lib>, C<tests>, C<inc>.
=item B<common>
Build common (architecture-independent) files. Common files are not configuration-dependent, so
there is no point in building it for more than one configuration (thought it is harmless).
However, do not build common files on many machines simultaneously.
=item B<clean>
Delete the export files and clean build directory of configuration(s) specified by options. Note
that C<clean> goal cannot be mixed with other goals (except for C<clean-common>).
=item B<clean-common>
Delete the common files in F<exports/> directory.
=item B<clobber>
Clean F<export/> and F<tmp/> directories. If C<clobber> is specified, other goals and/or options
do not matter.
Note: Clobbering is potentialy dangerous operation, because it deletes content of directory
pointed by If C<LIBOMP_TMP> environment variable, so C<build.pl> asks a confirmation before
clobbering. To suppress the question, use option C<--answer=yes>.
=item B<fat>
C<mac_32e> only: Build fat libraries for both mac_32 and mac_32e. Should be run when C<lib>
goal is built on both C<mac_32> and C<mac_32e>.
=item I<file.o>
(Windows* OS: I<file.obj>) Build specified object file only.
=item I<file.i>
Create preprocessed source file.
=item B<force-tests>
Force performing tests.
=item B<force-test-deps>
Force performing test-deps.
=item B<force-test-instr>
Force performing test-instr.
=item B<force-test-relo>
Force performing test-relo.
=item B<force-test-touch>
Force performing test-touch.
=item B<inc>
Build Fortran include files, omp_lib.h, omp_lib.mod and omp_lib_kinds.mod.
=item B<lib>
Build library (on Windows* OS in case of dynamic linking, it also builds import library).
=item B<tests>
Perform tests: C<test-deps>, C<test-instr>, C<test-relo>, and C<test-touch>.
=item B<test-deps>
Check the library dependencies.
=item B<test-instr>
Intel(R) Many Integrated Core Architecture only: check the library does not contain undesired instructions.
=item B<test-relo>
Linux* OS with dynamic linking only: check the library does not contain position-dependent
code.
=item B<test-touch>
Build a very simple application with native compiler (GNU on Linux* OS and OS X*, MS
on Windows* OS), check it does not depend on C<libirc> library, and run it.
=back
=back
=head1 DESCRIPTION
C<build.pl> constructs the name of a build directory, creates the directory if it
does not exist, changes to it, and runs make to build the goals in specified configuration.
If more than one configuration are specified in command line C<build.pl> builds them all.
Being run with C<clean> goal, C<build.pl> does not build but deletes export files and
cleans build directories of configuration specified by other options. For example,
C<build.pl --all clean> means "clean build directories for all configurations",
it does B<not> mean "clean then build all".
C<clear-common> goal deletes common files in F<exports/> directory.
Since common files are really common and not architecture and/or configuration dependent,
there are no much meaning in combining C<clear-common> with configuration selection options.
For example, C<build.pl --all clean-common> deletes the same files 13 times.
However, it does not hurt and can be used in conjunction with C<clear> goal.
C<clobber> goal instructs C<build.pl> to clean exports and all build
directories, e. g. clean everything under F<exports/> and F<tmp/> directories.
Logs are saved automatically, there is no need in explicit output redirection.
Log file for each particular configuration is named F<build.log> and located in build directory.
Summary log file (just result of each configuration) is saved in F<tmp/> directory.
Log files are never overwritten. C<build.pl> always appends output to log files.
However (obviously), C<clear> deletes log file for cleared configurations,
and C<clobber> deletes all summary log files.
=head2 Environment Variables
=over
=item B<LIBOMP_ARCH>
Specifies target architecture. If not present, host architecture is used. Environment variable may
be overriden by C<--architecture> command line option.
=item B<LIBOMP_EXPORTS>
Specifies directory for output files. If not set, C<$LIBOMP_WORK/exports/> used by default.
=item B<LIBOMP_OS>
Specifies target OS. If not present, host OS is used. Environment variable may
be overriden by C<--os> command line option.
=item B<LIBOMP_TMP>
Directory for temporary files. C<build.pl> creates build directories there. If not set,
C<$LIBOMP_WORK/tmp/> used by default.
On Windows* OS F<tmp/> directory on local drive speeds up the build process.
=item B<LIBOMP_WORK>
Root of libomp directory tree, contains F<src/>, F<tools/>, and F<exports/> subdirs.
If not set, C<build.pl> guesses the root dir (it is a parent of dir containing C<build.pl>).
Note: Guessing it not reliable. Please set C<LIBOMP_WORK> environment variable appropriately.
=back
=head1 EXAMPLES
=head2 Development
Build normal (performance) dynamic library for debugging:
$ build.pl --debug
Build all libraries (normal, stub; dynamic RTL) for debugging:
$ build.pl --all --debug
Do a clean build for all:
$ build.pl --all --debug clean && build.pl --all --debug
Debugging libraries are saved in F<exports/I<platform>.deb/>.
=head2 Promotion
=over
=item 1
Clobber everything; on one machine:
$ build.pl clobber
=item 2
Build common headers, on one machine:
$ build.pl common
=item 3
Build all platform-dependent files, on all machines:
$ build.pl --all
=item 4
Build OS X* universal (fat) libraries, on C<mac_32e>:
$ build.pl fat
=back
=cut
# end of file #
|