[m-rev.] diff: fix --use-grade-subdirs
Simon Taylor
stayl at cs.mu.OZ.AU
Sun Dec 1 00:35:37 AEDT 2002
Estimated hours taken: 0.5
Branches: main, release
compiler/compile_target_code.m:
Fix bugs in the code to link executables and libraries
created with `--use-grade-subdirs' into the user's
directory.
tests/grade_subdirs/Mmakefile:
Check that building libraries with `--use-grade-subdirs'
works.
Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.25.2.3
diff -u -u -r1.25.2.3 compile_target_code.m
--- compiler/compile_target_code.m 20 Nov 2002 12:35:29 -0000 1.25.2.3
+++ compiler/compile_target_code.m 29 Nov 2002 10:12:21 -0000
@@ -935,30 +935,25 @@
maybe_write_string(Verbose, "% Linking...\n"),
( { LinkTargetType = static_library } ->
- globals__io_lookup_string_option(library_extension, LibExt),
- module_name_to_lib_file_name("lib", ModuleName, LibExt,
- yes, LibName),
- create_archive(ErrorStream, LibName, ObjectsList, ArCmdOK),
- maybe_report_stats(Stats),
- ( { ArCmdOK = no } ->
- { Succeeded = no }
- ;
- { Succeeded = yes }
- )
+ globals__io_lookup_string_option(library_extension, Ext),
+ module_name_to_lib_file_name("lib", ModuleName, Ext,
+ yes, OutputFileName),
+ create_archive(ErrorStream, OutputFileName, ObjectsList,
+ LinkSucceeded)
;
( { LinkTargetType = shared_library } ->
{ SharedLibOpt = "--make-shared-lib " },
{ LDFlagsOpt = ld_libflags },
globals__io_lookup_string_option(
- shared_library_extension, SharedLibExt),
+ shared_library_extension, Ext),
module_name_to_lib_file_name("lib", ModuleName,
- SharedLibExt, yes, OutputFileName)
+ Ext, yes, OutputFileName)
;
{ SharedLibOpt = "" },
{ LDFlagsOpt = ld_flags },
globals__io_lookup_string_option(
- executable_file_extension, ExeExt),
- module_name_to_file_name(ModuleName, ExeExt,
+ executable_file_extension, Ext),
+ module_name_to_file_name(ModuleName, Ext,
yes, OutputFileName)
),
globals__io_lookup_bool_option(target_debug, Target_Debug),
@@ -995,29 +990,34 @@
LDFlags, " ", LinkLibraries],
LinkCmd) },
invoke_shell_command(ErrorStream, verbose_commands,
- LinkCmd, LinkSucceeded),
- maybe_report_stats(Stats),
- globals__io_lookup_bool_option(use_grade_subdirs,
- UseGradeSubdirs),
- (
- { LinkSucceeded = yes },
- { UseGradeSubdirs = yes }
- ->
- % Link/copy the executable into the user's directory.
- globals__io_set_option(use_subdirs, bool(no)),
- globals__io_set_option(use_grade_subdirs, bool(no)),
- module_name_to_file_name(ModuleName, "",
- no, UserDirExeName),
- globals__io_set_option(use_subdirs, bool(yes)),
- globals__io_set_option(use_grade_subdirs, bool(yes)),
-
- io__set_output_stream(ErrorStream, OutputStream),
- make_symlink_or_copy_file(OutputFileName,
- UserDirExeName, Succeeded),
- io__set_output_stream(OutputStream, _)
+ LinkCmd, LinkSucceeded)
+ ),
+ maybe_report_stats(Stats),
+ globals__io_lookup_bool_option(use_grade_subdirs,
+ UseGradeSubdirs),
+ (
+ { LinkSucceeded = yes },
+ { UseGradeSubdirs = yes }
+ ->
+ % Link/copy the executable into the user's directory.
+ globals__io_set_option(use_subdirs, bool(no)),
+ globals__io_set_option(use_grade_subdirs, bool(no)),
+ ( { LinkTargetType = executable } ->
+ module_name_to_file_name(ModuleName, Ext,
+ no, UserDirFileName)
;
- { Succeeded = LinkSucceeded }
- )
+ module_name_to_lib_file_name("lib", ModuleName, Ext,
+ no, UserDirFileName)
+ ),
+ globals__io_set_option(use_subdirs, bool(yes)),
+ globals__io_set_option(use_grade_subdirs, bool(yes)),
+
+ io__set_output_stream(ErrorStream, OutputStream),
+ make_symlink_or_copy_file(OutputFileName,
+ UserDirFileName, Succeeded),
+ io__set_output_stream(OutputStream, _)
+ ;
+ { Succeeded = LinkSucceeded }
).
:- pred create_archive(io__output_stream, file_name, list(file_name),
Index: tests/grade_subdirs//Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/grade_subdirs/Mmakefile,v
retrieving revision 1.1
diff -u -u -r1.1 Mmakefile
--- tests/grade_subdirs//Mmakefile 31 Oct 2002 14:47:43 -0000 1.1
+++ tests/grade_subdirs//Mmakefile 30 Nov 2002 13:27:17 -0000
@@ -28,4 +28,6 @@
%.runtest: %.res ;
+hello.out: libhello
+
#-----------------------------------------------------------------------------#
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list