mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-11 08:41:48 -07:00
80 lines
1.8 KiB
Perl
80 lines
1.8 KiB
Perl
#!/usr/local/perl
|
|
#
|
|
# provides subroutines to compile or compile and link
|
|
# tests and test libraries.
|
|
#
|
|
# In future, this will probably do some clever stuff
|
|
# depending on the platform &c, but for now it's just
|
|
# what works on SunOS.
|
|
#
|
|
|
|
1;
|
|
|
|
%plat_link = ();
|
|
$plat_link{"sol2.4_sparc"} = "-lm";
|
|
|
|
sub compiler_settings {
|
|
if ($PLATFORM =~ "^nt_") {
|
|
$cc_command = "cl";
|
|
$cc_opts = "/DWIN32 /D_WINDOWS /W3 /Z7 /DMMQA_VERS_$INTERFACE_VERSION";
|
|
$cc_link = "$obj_dir/platform.o";
|
|
$cc_include = "/I$testlib_dir /I$MPS_INCLUDE_DIR";
|
|
$cc_conly = "/c";
|
|
$cc_obj = "/Fo";
|
|
$cc_exe = "/Fe";
|
|
$run_command = "";
|
|
} elsif ($PLATFORM =~ "^(sun|sol)") {
|
|
if ($PLATFORM =~ "^sol") {
|
|
$cc_link = "$obj_dir/platform.o -lm";
|
|
} else {
|
|
$cc_link = "$obj_dir/platform.o";
|
|
}
|
|
$cc_command = "gcc";
|
|
$cc_opts = "-ansi -pedantic -Wall -Wstrict-prototypes ".
|
|
"-Winline -Waggregate-return -Wnested-externs -Wcast-qual ".
|
|
"-Wshadow -Wmissing-prototypes -Wredundant-decls -Wcast-align ".
|
|
"-O -g -ggdb3 -DMMQA_VERS_$INTERFACE_VERSION";
|
|
$cc_include = "-I$testlib_dir -I$MPS_INCLUDE_DIR";
|
|
$cc_conly = "-c";
|
|
$cc_obj = "-o ";
|
|
$cc_exe = "-o ";
|
|
$run_command = "sh -c ";
|
|
} else {
|
|
die "Sorry: I don't know how to compile on ".$PLATFORM."\n";
|
|
}
|
|
}
|
|
|
|
sub compile {
|
|
local($srcfile, $objfile) = @_;
|
|
|
|
&compiler_settings;
|
|
$command = "$cc_command $cc_conly $cc_opts $cc_obj$objfile ".
|
|
"$srcfile $cc_include";
|
|
|
|
if (system($command)) {
|
|
return 0;
|
|
} else {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
sub compile_and_link {
|
|
local($srcfile, $exefile, $linkfiles) = @_;
|
|
|
|
&compiler_settings;
|
|
$command = "$cc_command $cc_opts $cc_exe$exefile $srcfile ".
|
|
"$linkfiles $MPS_LINK_OBJ $cc_link $cc_include";
|
|
|
|
if (system($command)) {
|
|
return 0;
|
|
} else {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
sub try_test {
|
|
local ($exefile) = @_;
|
|
|
|
system($run_command.$exefile);
|
|
}
|
|
|