`mmc --make --use-grade-subdirs <linked-target>' makes symlinks/copies of the

Estimated hours taken: 2
Branches: main

`mmc --make --use-grade-subdirs <linked-target>' makes symlinks/copies of the
linked target into the current directory, but doesn't do so if the linked
target is already up to date.  This patch makes it always make the
symlink/copy, so that it is easy to switch between two or more grades even if
no source files were modified.

compiler/compile_target_code.m:
	Separate out the code to make symlinks/copies of linked targets from
	the `link' predicate into a predicate `post_link_make_symlink_or_copy'.

	Move `shared_libraries_supported' from make.program_target.m into
	compile_target_code.m.

compiler/make.program_target.m:
	Call `post_link_make_symlink_or_copy' if `--use-grade-subdirs' is
	enabled, and the linked target is otherwise up-to-date.
	Write out a message in `--verbose-make' mode.

	Conform to the move of `shared_libraries_supported'.

compiler/make.util.m:
	Add a predicate `maybe_symlink_or_copy_linked_target_message'.
This commit is contained in:
Peter Wang
2006-02-13 03:04:36 +00:00
parent 7864c75130
commit cdcdf90ac8
3 changed files with 144 additions and 73 deletions

View File

@@ -357,9 +357,20 @@ build_linked_target_2(MainModuleName, FileType, OutputFileName, MaybeTimestamp,
Succeeded = no
;
DepsResult = up_to_date,
maybe_warn_up_to_date_target(MainModuleName - linked_target(FileType),
!Info, !IO),
Succeeded = yes
globals__io_lookup_bool_option(use_grade_subdirs, UseGradeSubdirs,
!IO),
(
UseGradeSubdirs = yes,
maybe_symlink_or_copy_linked_target_message(
MainModuleName - linked_target(FileType), !IO),
compile_target_code__post_link_make_symlink_or_copy(ErrorStream,
FileType, MainModuleName, Succeeded, !IO)
;
UseGradeSubdirs = no,
maybe_warn_up_to_date_target(
MainModuleName - linked_target(FileType), !Info, !IO),
Succeeded = yes
)
;
DepsResult = out_of_date,
maybe_make_linked_target_message(OutputFileName, !IO),
@@ -556,7 +567,8 @@ make_misc_target(MainModuleName - TargetType, _, Succeeded, !Info, !IO) :-
InitSucceeded = yes,
make_linked_target(MainModuleName - static_library,
StaticSucceeded, !Info, !IO),
shared_libraries_supported(SharedLibsSupported, !IO),
compile_target_code__shared_libraries_supported(
SharedLibsSupported, !IO),
(
StaticSucceeded = yes,
(
@@ -689,16 +701,6 @@ reset_analysis_registry_dependency_status(ModuleName, Info,
Info ^ dependency_status ^ elem(Dep) := not_considered) :-
Dep = target(ModuleName - analysis_registry).
:- pred shared_libraries_supported(bool::out, io::di, io::uo) is det.
shared_libraries_supported(Supported, !IO) :-
% XXX This seems to be the standard way to check whether shared libraries
% are supported but it's not very nice.
globals__io_lookup_string_option(library_extension, LibExt, !IO),
globals__io_lookup_string_option(shared_library_extension, SharedLibExt,
!IO),
Supported = (if LibExt \= SharedLibExt then yes else no).
%-----------------------------------------------------------------------------%
:- pred install_library(module_name::in, bool::out,