mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-14 13:23:53 +00:00
The compiler generates several kinds of files (including .d, .dv, and
.dep files) that contain mmakefile fragments. Imposing structure on
those fragments makes it easier to compare different versions
of those fragments. This should make it easier to find the reason
why modifications to a module in a directory that is compiled with
intermodule optimization (such as the library directory) usually requires
rebuilding those mmakefile fragments via an "mmake depend".
One advantage of the new way of creating mmakefile fragments
is that the internal representation makes it clear where the code
that constructs one mmakefile entry ends and code that constructs
the next one begins. With the old approach, this was often significantly
less clear than one would expect and want.
compiler/mmakefiles.m:
A new module that defines a representation for mmakefiles and mmakefile
fragments, and for printing them out.
It provides the means for a gradual transition from the current code
writing out mmakefile fragments directly to printing them out
via this module. The main technique it uses for this is to let both
the manually-written and the generated-from-internal-representation
versions of a mmakefile fragment be printed, with one version
or the other being disabled via the make equivalent of C's "#ifdef 0".
compiler/libs.m:
Add mmakefiles.m to the libs package.
compiler/notes/compiler_design.html:
Document mmakefiles.m.
compiler/write_deps_file.m:
After each piece of code that prints out a part of an mmakefile,
add code to construct the internal representation of that part,
and let mmakefiles.m print it if that the current state of the transition
calls for it.
This change duplicates a significant amount of functionality.
However, this should be only a short time. After a transition period,
we can delete the old version of each such piece of code.
The new versions of the code use "some [!StateVar]" scopes
reasonably extensively. I refrained from indenting the bodies
of those scopes to avoid having to wrap the code inside them,
since that would make this diff harder to review.
Put a vim modeline at the top of generated mmakefile fragments,
to make it easier to look at them with vim.
Move all the code that opens and closes I/O streams to one predicate.
Delete the tests of the assume_gmake option. While this was useful
at one time in the past, we have, for a long time now, generated
mmakefile fragments that assumed gmake even when assume_gmake
was NOT set.
In several places, give variables more meaningful names.
compiler/file_names.m:
Provide versions of some predicates that are easier to use
with higher-order code.
compiler/Mercury.options:
Specify --warn-implicit-stream-calls for both mmakefiles.m and
write_deps_file.m
53 lines
1.7 KiB
Mathematica
53 lines
1.7 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 2002-2003, 2005, 2008-2009 The University of Melbourne.
|
|
% This file may only be copied under the terms of the GNU General
|
|
% Public License - see the file COPYING in the Mercury distribution.
|
|
%-----------------------------------------------------------------------------%
|
|
%
|
|
% This package contains general utilities that are used by other packages.
|
|
%
|
|
|
|
:- module libs.
|
|
:- interface.
|
|
|
|
% Option handling.
|
|
:- include_module globals.
|
|
:- include_module options.
|
|
:- include_module handle_options.
|
|
:- include_module op_mode.
|
|
:- include_module compute_grade.
|
|
:- include_module trace_params.
|
|
|
|
% Error handling.
|
|
:- include_module compiler_util.
|
|
|
|
% Representation of mmakefile fragments.
|
|
:- include_module mmakefiles.
|
|
|
|
% Generic algorithms and data structures that are not quite useful enough
|
|
% or otherwise aren't in the standard library.
|
|
% :- include_module atsort. % currently unused
|
|
:- include_module dependency_graph.
|
|
:- include_module file_util.
|
|
:- include_module graph_colour.
|
|
:- include_module int_emu.
|
|
:- include_module md4.
|
|
:- include_module pickle.
|
|
:- include_module uint_emu.
|
|
|
|
% OS interfaces not provided by the standard library.
|
|
:- include_module process_util.
|
|
:- include_module timestamp.
|
|
|
|
% Constraint machinery for the termination analysers.
|
|
:- include_module lp.
|
|
:- include_module lp_rational.
|
|
:- include_module polyhedron.
|
|
:- include_module rat.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
:- end_module libs.
|
|
%-----------------------------------------------------------------------------%
|