Commit Graph

623 Commits

Author SHA1 Message Date
Fergus Henderson
20d4ab3dda Be consistent about using -' rather than /' for options to cl.
Estimated hours taken: 1
Branches: main, release

scripts/Mmake.rules:
compiler/compile_target_code.m:
	Be consistent about using `-' rather than `/' for options to cl.
	Use `-o ' rather than `-link -out:'.
	Ensure that `-o' comes before $(MS_CL_LIBS).
	Resynchronize the release branch with the main branch.
2002-11-20 12:33:02 +00:00
Simon Taylor
5158b782e1 Search /usr/local/lib for shared libraries.
Estimated hours taken: 1
Branches: main, release

Search /usr/local/lib for shared libraries. This fixes
problems linking debugging executables on mundroo.

configure.in:
aclocal.m4:
	Check for /usr/local/lib.

scripts/ml.in:
	Document why we don't default to static linking for
	all libraries on Solaris/x86.
2002-11-19 08:16:07 +00:00
Peter Ross
dc060b2ed3 Fix a bug in my previous change to fix a bug in fjh's previous change.
Estimated hours taken: 0.5
Branches: main

Fix a bug in my previous change to fix a bug in fjh's previous change.
Revert back to using '/out:', and instead add the flag '/link' so that '/out:'
is passed to the linker instead to avoid problems compiling the library.

scripts/Mmake.rules:
compiler/compile_target_code.m:
	Add '/link' before the '/out:'.

scripts/Mmake.rules:
	Also add fjh's change for /LD to other rules building .dlls.
2002-11-15 12:09:18 +00:00
Peter Ross
e79cb48f1d Fix a bug in fjh's previous change where we are passing the linker
Estimated hours taken: 0.5
Branches: main

Fix a bug in fjh's previous change where we are passing the linker
flag for naming the output file to the C compiler, not the C compiler
flag.

scripts/Mmake.rules:
	'-o' is the flag for naming the output file for the C compiler.
2002-11-15 10:11:02 +00:00
Fergus Henderson
29679e979a When invoking $(MS_CL) to create DLLs, use the option "/LD" which
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.rules:
	When invoking $(MS_CL) to create DLLs, use the option "/LD" which
	is documented in the help message, rather than the (undocumented?)
	options "-link -noentry mscoree.lib -dll".
2002-11-06 04:24:22 +00:00
Simon Taylor
8687a17aea Fix "cygpath: command not found" errors with `mmake --use-mmc-make'.
Estimated hours taken: 0.25
Branches: main

Fix "cygpath: command not found" errors with `mmake --use-mmc-make'.

configure.in:
bindist/bindist.configure.in:
scripts/Mmake.vars.in:
	Check that `cygpath' exists, rather than hard-coding
	it in Mmake.vars.in.
2002-11-04 01:49:10 +00:00
Peter Ross
adf0488373 Make --c-debug work correctly when using MSVC as your C compiler.
Estimated hours taken: 1
Branches: main

Make --c-debug work correctly when using MSVC as your C compiler.

compiler/compile_target_code.m:
scripts/mgnuc.in:
	Use /Zi when --c-debug is enabled and we are using MSVC for
	our C compiler.

scripts/ml.in:
	Pass /DEBUG to the linker when --c-debug is enabled and we
	are using MSVC for our C compiler.

runtime/Mmakefile:
	Pass --c-debug to mgnuc rather than passing -g through to the
	underlying C compiler.
2002-10-30 16:35:37 +00:00
Fergus Henderson
6d7c9629a4 Fix a bug where `mercury.dll' was not being found by the C# compiler.
Estimated hours taken: 3
Branches: main

Fix a bug where `mercury.dll' was not being found by the C# compiler.
when you configured with a non-MS C compiler.  This bug broke
tests/hard_coded/foreign_type in grade il.

configure.in:
bindist/bindist.build_vars.in:
	Rename CYGPATH as FIX_PATH_FOR_CC.

scripts/Mmake.vars.in:
	Rename CYGPATH as FIX_PATH_FOR_CC,
	and add new variables FIX_PATH_FOR_CL and FIX_PATH_FOR_CSC.
	The new variables are currently hard-wired as `cygpath -w',
	since currently we only support the MS versions of CL and CSC.

	Also, change the definition of MERC_DLL_DIR to use $(GRADE)
	rather than hard-coding "ilc".

scripts/Mmake.rules:
	Use the new variables, rather than $(CYGPATH).

	Also, update various comments, and delete the unnecessary version
	number from the MS_VC7_INCLUDES_DIR and MS_VC7_INCLUDES variable
	names.

scripts/ml.in:
	Use @FIX_PATH_FOR_CC@ rather than @CYGPATH@.
2002-10-24 09:16:11 +00:00
Fergus Henderson
9aa7de6f56 Fix a bug where `mercury.dll' was not being found by the C# compiler.
Estimated hours taken: 3
Branches: main

Fix a bug where `mercury.dll' was not being found by the C# compiler.
when you configured with a non-MS C compiler.  This bug broke
tests/hard_coded/foreign_type in grade il.

configure.in:
bindist/bindist.build_vars.in:
	Rename CYGPATH as FIX_PATH_FOR_CC.

scripts/Mmake.vars.in:
	Rename CYGPATH as FIX_PATH_FOR_CC,
	and add new variables FIX_PATH_FOR_CL and FIX_PATH_FOR_CSC.
	The new variables are currently hard-wired as `cygpath -w',
	since currently we only support the MS versions of CL and CSC.

	Also, change the definition of MERC_DLL_DIR to use $(GRADE)
	rather than hard-coding "ilc".

scripts/Mmake.rules:
	Use the new variables, rather than $(CYGPATH).

	Also, update various comments, and delete the unnecessary version
	number from the MS_VC7_INCLUDES_DIR and MS_VC7_INCLUDES variable
	names.

scripts/ml.in:
	Use @FIX_PATH_FOR_CC@, rather than @CYGPATH@.
2002-10-24 07:36:19 +00:00
Fergus Henderson
1af57b2855 Run $(RANLIB) on the installed libraries.
Estimated hours taken: 0.75
Branches: main

scripts/Mmake.rules:
boehm_gc/Mmakefile:
runtime/Mmakefile:
library/Mmakefile:
trace/Mmakefile:
	Run $(RANLIB) on the installed libraries.
	This is needed on MacOS 10.1, where the linker checks the date
	stamp on the .a file, refusing to link if this date is greater
	than the date when ranlib was run.  Since installing the
	libraries with `cp' updates their timestamp, we need to rerun ranlib.

scripts/Mmake.rules:
	Change some hard-coded occurrences of `.a' to `.$A'.  This is
	probably needed to make things work properly when building with MSVC.
2002-10-18 04:16:18 +00:00
Fergus Henderson
ffee30fa53 Change things so that LIBGRADES includes the default grade.
Estimated hours taken: 1
Branches: main

Change things so that LIBGRADES includes the default grade.
This fixes a bug that sometimes caused the libraries not to be
installed in the default grade, e.g. when $(GRADE) is set in Mmake.params.

configure.in:
	Don't delete $(GRADE) from $(LIBGRADES).

Mmakefile:
scripts/Mmake.rules:
compiler/make.program_target.m:
	Change the loops over $(ALL_LIBGRADES) so that they skip $(GRADE).

scripts/Mmake.vars.in:
	Delete an bogus assignment setting LIBGRADES to empty, since it
	wasn't being used (LIBGRADES was being assigned again below).
	Update the documentation for LIBGRADES.
2002-10-15 16:23:57 +00:00
Fergus Henderson
e412866758 Avoid warnings with gcc 3.1, 3.1.1 and 3.2: don't add -I/usr/local/include for
Estimated hours taken: 3
Branches: main

Avoid warnings with gcc 3.1, 3.1.1 and 3.2: don't add -I/usr/local/include for
gcc.  Also don't add -I/usr/local/include or -L/usr/local/lib if those
directories don't exist, because that too can result in annoying warnings.

configure.in:
	Move the code to check whether to add -I/usr/local/include from
	configure.in to a new macro MERCURY_CHECK_LOCAL_INCL_DIRS in
	aclocal.m4, so that it can also be used by
	bindist/bindist.configure.in.
	Also, don't add /usr/local/lib to LIBS if that doesn't exist.

aclocal.m4:
	Define the new macro.
	Change that code so that it does not add -I/usr/local/include
	if the C compiler is GCC, or if /usr/local/include doesn't exist.
	Record whether or not to add -I/usr/local/include in a new autoconf
	substitution variable ALL_LOCAL_INCL_DIRS.

bindist/bindist.configure.in
	Call the new macro.

scripts/mgnuc.in:
	Use @ALL_LOCAL_INCL_DIRS@ rather than -I$MERCURY_LOCAL_C_INCL_DIR or
	-I/usr/local/include.  (The ability to set the MERCURY_LOCAL_C_INCL_DIR
	environment variable was not documented and was not used anywhere else
	in the Mercury distribution.)
2002-10-06 15:45:30 +00:00
Fergus Henderson
700b983325 Update to include recently added generated files.
Branches: main
Estimated hours taken: 0.25

scripts/.cvsignore:
deep_profiler/.cvsignore:
extras/dynamic_linking/.cvsignore:
	Update to include recently added generated files.

compiler/.cvsignore:
	Fix a typo: s/aditi_backend/aditi_backend.m/
2002-10-02 06:59:19 +00:00
Fergus Henderson
411f5a427d Fix missing ";;" in case statement.
Estimated hours taken: 0.1
Branches: main

scripts/mgnuc.in:
	Fix missing ";;" in case statement.
	(This only showed up when trying to build GCC-related grades
	with a non-GCC C compiler.)
2002-10-02 06:40:04 +00:00
Fergus Henderson
16cbea5ca7 Define ERR_REDIRECT in Mmake.vars.in, rather than Mmake.rules,
Branches: main
Estimated hours taken: 0.25

scripts/Mmake.rules:
scripts/Mmake.vars.in:
	Define ERR_REDIRECT in Mmake.vars.in, rather than Mmake.rules,
	so that it can be overridden by the user's Mmakefile.
2002-09-15 10:01:51 +00:00
Fergus Henderson
bf5a95b6d7 Make the redirection of errors into `.err' files configurable,
Branches: main
Estimated hours taken: 1

scripts/Mmake.rules:
	Make the redirection of errors into `.err' files configurable,
	by abstracting out the code to redirect errors into a variable
	ERR_REDIRECT.  By default the behaviour remains the same, but if
	you run `mmake ERR_REDIRECT=', then errors will not be redirected.
2002-09-13 18:51:40 +00:00
Fergus Henderson
935fd45bd3 Support shared libraries on mundroo.
Estimated hours taken: 6
Branches: main

Support shared libraries on mundroo.

configure.in:
	Add support for shared libraries on x*86-*-solaris2.*.

boehm_gc/Makefile:
	Compile mach_dep.c with $(CFLAGS_FOR_PIC), like we do all the
	other C files in this directory.  This is needed for Solaris/x86,
	and should hopefully be harmless on other systems.

scripts/ml.in:
	Make static linking the default for x*86-*-solaris2.*,
	for the same reason as for Linux.
	Also, pass -L/usr/local/lib, even when `--mercury-libs none' or
	`--no-mercury-stdlib-dir' is specified.  This is needed to ensure
	that we find libreadline.a when building the Mercury standard
	library, if libreadline.a is installed in /usr/local/lib.
	(The Mercury configure script searches /usr/local/lib.)

runtime/Mmakefile:
trace/Mmakefile:
	Include -L/usr/local/lib in LDFLAGS, for the same reason as above.
2002-09-11 19:00:19 +00:00
Fergus Henderson
f33605beed Allow "__ppc__" as another alternative to "__powerpc__" and "_POWER"
Estimated hours taken: 2
Branches: main

runtime/mercury_regs.h:
	Allow "__ppc__" as another alternative to "__powerpc__" and "_POWER"
	for recognizing Power PC processors.

scripts/mgnuc.in:
	If $COMPILER is "unknown" (e.g. because $CC is "cc"),
	don't disable grades such as "reg.gc".
2002-09-09 18:07:39 +00:00
Zoltan Somogyi
c0f4d93a3c Add a new grade component, .decldebug. It is as proposed on mercury-developers,
Estimated hours taken: 2
Branches: main

Add a new grade component, .decldebug. It is as proposed on mercury-developers,
minus the implications about I/O tabling. Those will come later.

compiler/options.m:
	Add a new option, --decl-debug, that switches on declarative debugging.

compiler/trace_params.m:
	The procedure that converts strings representing trace levels to trace
	levels themselves now has an extra argument, which gives the value of
	the --decl-debug option. If set, it raises the minimum trace level,
	and turn explicitly specifying trace levels `shallow' and `deep'
	into errors (since they are not sufficient for declarative debugging).

compiler/handle_options.m:
	Pass the value of the --decl-debug option to trace_params, and handle
	the errors that may result. Handle the implications of --decl-debug
	and the .decldebug grade component.

compiler/compile_target_code.m:
	Define MR_DECL_DEBUG when invoking the C compiler if --decl-debug is
	set.

runtime/mercury_conf_param.h:
	Document MR_DECL_DEBUG, which is defined iff the grade is a .decldebug
	grade.

runtime/mercury_grade.h:
	Take MR_DECL_DEBUG into account when computing the grade component
	related to debugging.

	Update the list of places that need to be modified when adding new
	grade components.

doc/user_guide.texi:
	Document --decl-debug and the .decldebug grade component.

	Document the events used by declarative debugging, since Mark didn't.

	Fix some minor unrelated omissions.

scripts/init_grade.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade.sh-subr:
scripts/canonical_grade.sh-subr:
scripts/mgnuc.in:
scripts/ml.in:
	Add a new shell variable, decl_debug, to represent the value of
	MR_DECL_DEBUG, and handle it as appropriate.

tests/debugger/Mmakefile:
	Do not execute shallow traced tests in .decldebug grades, since we
	don't support shallow tracing in such grades.

	Specify --trace decl instead of --trace deep in .decldebug grades
	when compiling the other tests, since we don't support --trace deep
	in .decldebug grades.
2002-09-01 06:05:20 +00:00
Simon Taylor
634193dc4b Fix errors caused by attempting to move nonexistent files
Estimated hours taken: 0.2
Branches: main

scripts/Mmake.rules:
	Fix errors caused by attempting to move nonexistent files
	when installing libraries.
2002-08-24 11:54:26 +00:00
Simon Taylor
a77d488245 In the presence of foreign code the .opt' and .trans_opt' files
Estimated hours taken: 10
Branches: main

In the presence of foreign code the `.opt' and `.trans_opt' files
aren't grade independent, so install them in grade-dependent
directories.

scripts/Mmake.vars.in:
	Define $(INSTALL_GRADE_INT_DIR), which holds `.opt'
	and `.trans_opt' files.

	Pass the extra libraries to mmc using `--ml' and `--mld'
	(`--mercury-library' and `--mercury-library-directory')
	options, rather than just a `-I' option. This is needed
	so that $(INSTALL_GRADE_INT_DIR) is searched for `.opt'
	files before $(INSTALL_INT_DIR)

	Fix a bug -- the `-I' options for libraries should
	go in CFLAGS, not MGNUCFLAGS.

scripts/Mmake.rules:
	Create INSTALL_GRADE_INT_DIR in the install_grade_dirs target.

compiler/modules.m:
	Install `.opt' and `.trans_opt' files in $(INSTALL_GRADE_INT_DIR).

	`.int0' files are needed by `.opt' files for sub-modules, so
	install them.

	<module>.int0s now only contains the names of modules with sub-modules
	(this is needed to avoid attempting to install nonexistent `.int0'
	files).

compiler/handle_options.m:
	Add $(INSTALL_GRADE_INT_DIR) for each `--mercury-library' option
	to `--intermod-directories'.

Mmakefile:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
	Simplify the code to copy/remove the grade dependent files
	before building the libraries in a new grade when installing.

	Copy/remove all grade-dependent files, including `.opt' files
	and `.dv' files.
2002-08-22 02:34:21 +00:00
Fergus Henderson
c536e2516a A couple of additional parts of my change to add support for the
Estimated hours taken: 0.25
Branches: main

A couple of additional parts of my change to add support for the
MPS garbage collector which I forgot to commit in my previous change.

util/mkinit.c:
	Define the stack_bottom parameter of `mercury_init' to have type
	`void *' rather than `char *', and make sure that it is word-aligned.
	MPS requires that it be word-aligned.

scripts/mgnuc.in:
        Handle the new `mps' GC method.
2002-08-21 16:01:45 +00:00
Fergus Henderson
94f3e96ed1 Fix a bug in my previous change: handle the case where $gc_method
Estimated hours taken: 0.25
Branches: main

scripts/mgnuc.in:
	Fix a bug in my previous change: handle the case where $gc_method
	is `boehm' rather than `conservative', and pass -DMR_BOEHM_GC
	as well as -DMR_CONSERVATIVE_GC.
2002-08-21 15:34:15 +00:00
Fergus Henderson
17d5aa732e Add support for interfacing Mercury with the MPS garbage collector.
Estimated hours taken: 20
Branches: main

Add support for interfacing Mercury with the MPS garbage collector.

This change is broken into three parts:

	1. Import version 1.100.1 of the MPS kit into the Mercury
	   CVS repository, in the directory `mps_gc'.

	2. Make some changes to the MPS kit for Mercury,
	   to support fully-conservative collection and tagged pointers,
	   and to wrap it in an interface that is similar to that of
	   the Boehm collector.

	3. Modify the rest of the Mercury implementation
	   to support linking with the MPS kit instead
	   of the Boehm collector.  This involved defining
	   `mps' as a new GC method and a new grade component.

This is part 3 of 3.

Mmake.workspace:
	Include the MPS directories in the header file and library search
	paths.

tools/bootcheck:
	Link the mps_gc directory into the stage2 and stage3 directories.

Mmake.workspace:
runtime/Mmakefile:
scripts/ml.in:
	For *.mps grades, link in mps.a.
	(XXX ml.in is linking in libmps.a, which is wrong.)

runtime/Mmakefile:
trace/Mmakefile:
	In the rule for `check_headers', which checks macro namespace
	cleanliness, allow names to start with `MPS_' or `mps_'.

runtime/RESERVED_MACRO_NAMES:
	Add `mercury_mps_h', which is used by mps_gc/code/mercury_mps.h
	for its header guard.  (Normally it would be better to use
	uppercase for header guard macro names, but that would be
	inconsistent with the coding style used in mps_gc/code.)

scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/canonical_grade.sh-subr:
	Handle the new `mps' GC method and grade component.

compiler/globals.m:
compiler/options.m:
doc/user_guide.texi:
	Replace gc_method `conservative' with two alternatives
	`boehm' and `mps'. ("--gc conservative" is still allowed,
	and treated as equivalent to "--gc boehm".)
	Add new function `gc_is_conservative' to globals.m.

compiler/mercury_compile.m:
compiler/handle_options.m:
	Use `gc_is_conservative' rather than `= conservative'.

compiler/handle_options.m:
	Handle the "mps" grade component.
	(XXX need to document this in options.m and user_guide.texi)

compiler/compile_target_code.m:
	Pass the appropriate C defines for the new GC methods.

compiler/mercury_compile.m:
	Wrap the work-around for a Boehm GC bug inside `#ifndef MR_MPS_GC'.

library/array.m:
	Use GC_FREE() rather than GC_free().
	This is needed for two reasons:
	- so that it works with MPS, which only defines GC_FREE
	- so that it works with then Boehm collector when
	  GC debugging is enabled

library/benchmarking.m:
	Output GC statistics for the MPS collector.

runtime/mercury.h:
runtime/mercury_heap.h:
runtime/mercury_init.h:
runtime/mercury_memory.h:
	If MR_MPS_GC is defined, use mercury_mps.h rather than gc.h.

runtime/mercury_conf_param.h:
	Add configuration macros MR_BOEHM_GC and MR_MPS_GC.
	Set MR_CONSERVATIVE_GC if either of these is set.
	Default to MR_BOEHM_GC if only MR_CONSERVATIVE_GC is set.

runtime/mercury_context.h:
runtime/mercury_deep_copy.h:
runtime/mercury_engine.h:
runtime/mercury_float.h:
runtime/mercury_heap.h:
	Explictly #include "mercury_conf.h", so that
	MR_CONSERVATIVE_GC will be set properly before it is tested.

runtime/mercury_grade.h:
	Handle the .mps grade component.

runtime/mercury_memory.c:
runtime/mercury_wrapper.c:
runtime/mercury_memory_handlers.c:
	Move the call to MR_setup_signals() earlier in the
	initialization sequence, so that the MPS signal handlers
	get installed after our signal handlers.  This is needed
	because our signal handlers assume that any signals that
	they can't handle are fatal errors, which interfere's
	with MPS's use of signal handlers for memory barriers.

runtime/mercury_wrapper.c:
	Add code to initialize the MPS collector.
	Put code which is specific to the Boehm collector inside
	#ifdef MR_BOEHM_GC rather than #ifdef MR_CONSERVATIVE_GC.

runtime/mercury_wrapper.h:
	Update a comment.
2002-08-21 11:28:01 +00:00
Simon Taylor
3e448ade11 The code to pass the grade dependent C macros to the C compiler
Estimated hours taken: 0.1
Branches: main

scripts/mgnuc.in:
runtime/mercury_grade.h:
	The code to pass the grade dependent C macros to the C compiler
	recently moved from mercury_compile.m to compile_target_code.m,
	so update the pointers to places that need to be changed when a
	new grade is added.
2002-08-20 10:40:43 +00:00
Simon Taylor
f93cb36f0f Add lib*.install to the list of targets that should
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.vars.in:
	Add lib*.install to the list of targets that should
	be handled by mmc with `--use-mmc-make'.
2002-08-16 02:05:12 +00:00
Simon Taylor
7620b07c54 Use `DEFAULT_MCFLAGS=${DEFAULT_MCFLAGS-...}' rather than
Estimated hours taken: 0.25
Branches: main, release

scripts/mmc:
	Use `DEFAULT_MCFLAGS=${DEFAULT_MCFLAGS-...}' rather than
	`DEFAULT_MCFLAGS=${DEFAULT_MCFLAGS=...}'. The latter form
	causes /bin/sh on mundroo (Solaris/x86 2.8) to crash when
	the RHS of the assignment is very long.
2002-08-08 06:22:00 +00:00
Simon Taylor
44ef4e118b Library installation with `mmc --make'.
Estimated hours taken: 10
Branches: main

Library installation with `mmc --make'.

compiler/make.m:
compiler/make.program_target.m:
	Handle `mmc --make lib<module>.install'.

compiler/options.m:
	Add an option `--use-grade-subdirs', which causes
	all grade-dependenent files to be placed in
	`Mercury/<grade>/<ext>s' subdirectories, even
	those files that are intended for use by the user.

	`--use-grade-subdirs' is not documented because it
	is only intended for use in library installation
	with `mmc --make' (it doesn't work at all with Mmake).
	Documenting it would require documenting (and setting
	in stone) the layout of the `Mercury' directory, which
	is probably a bad idea.

Mmake.workspace:
compiler/handle_options.m:
scripts/Mmake.rules:
	Header files are now always searched for using the plain
	file name (not Mercury/mihs/module.mih), so add a
	`--c-include-directory' option to search Mercury/mihs
	in the current directory.

compiler/modules.m:
compiler/intermod.m:
compiler/make.module_dep_file.m:
compiler/mercury_compile.m:
compiler/mlds_to_c.m:
compiler/trans_opt.m:
	Handle `--use-grade-subdirs' in module_name_to_file_name.

	Add module_name_to_search_file_name, which should be
	used to generate the names of files that might be part
	of an installed library. This is needed because installation
	and local directory hierarchies have a different layout,
	A better long-term fix would be to change things so that
	the installation and local directory layouts are the same.

compiler/make.util.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
	Add an extra argument to get_target_timestamp and
	get_file_name to specify whether the file should
	be searched for.

compiler/options_file.m:
scripts/Mmake.vars.in:
	Handle the LIBGRADES and INSTALL_PREFIX make variables.

doc/user_guide.texi:
	Remove the statement that library installation is
	not supported with `mmc --make'.
2002-08-07 13:12:11 +00:00
Simon Taylor
7de0228bcc Fix the code to add extra initialization functions to library/mer_std.init.
Estimated hours taken: 1.5
Branches: main

Fix the code to add extra initialization functions to library/mer_std.init.

compiler/options.m:
doc/user_guide.texi:
compiler/compile_target_code.m:
	Rename the `--make-init-file-command' as `--extra-init-command'.
	This should now only generated the extra entries in the `.init'
	file, not the whole file.

scripts/Mmake.vars.in:
compiler/modules.m:
	Allow $(EXTRA_INIT_COMMAND) as the Mmake equivalent
	of `--extra-init-command'. Append the output of
	$(EXTRA_INIT_COMMAND) to the `.init' file.

library/Mmakefile:
	Set EXTRA_INIT_COMMAND rather than overriding the
	libmer_std.init rule.
2002-07-29 07:51:07 +00:00
Simon Taylor
0c437e9ad0 Fix a bug -- the grade-specific `inc' directory
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.vars.in:
compiler/handle_options.m:
	Fix a bug -- the grade-specific `inc' directory
	for an installed library must be searched first.
	`.mih' files are installed into the non-grade-specific
	directory to avoid adding an extra entry in VPATH,
	but those files won't necessarily be the right ones
	for the current grade.
2002-07-15 07:03:53 +00:00
Simon Taylor
e3fd7e0c21 Pass INSTALL_PREFIX and LIBGRADES to mmc.
Estimated hours taken: 0.2
Branches: main

configure.in:
scripts/mmc.in:
	Pass INSTALL_PREFIX and LIBGRADES to mmc.
2002-07-05 13:51:06 +00:00
Simon Taylor
571e3318a1 In the presence of foreign code the .opt' and .trans_opt' files
Estimated hours taken: 0.2
Branches: main

scripts/Mmake.rules:
compiler/modules.m:
	In the presence of foreign code the `.opt' and `.trans_opt' files
	aren't grade independent, so pass $(ALL_GRADEFLAGS) to mmc
	when creating them.
2002-06-26 08:20:58 +00:00
Simon Taylor
81db7bb118 My change to fix the handling of target specific MCFLAGS
Estimated hours taken: 1.5
Branches: main

My change to fix the handling of target specific MCFLAGS
variables didn't work with `--split-c-files'.

compiler/modules.m:
	Fix some bugs in the handling of `--split-c-files':

	- Make `--split-c-files' work where the module name doesn't
	  match the file name.

	- $(MCFLAGS-module) wasn't being passed to mmc when `module.dir/*.o'
	  were being rebuilt (it was being passed when the files were
	  being built from scratch).

scripts/Mmake.rules:
	The pattern rule for `%.dir/*.o' is now redundant, so remove it.
2002-06-25 14:24:10 +00:00
Simon Taylor
4c4530f72b The code to look up the target-specific MCFLAGS variable
Estimated hours taken: 1
Branches: main

scripts/Mmake.vars.in:
	The code to look up the target-specific MCFLAGS variable
	assumed that mmc is always invoked by a pattern rule, which
	isn't true if the module name doesn't match the file name.
2002-06-24 16:15:22 +00:00
Simon Taylor
9406f99f9d Allow tools/bootcheck to be run using `mmake --use-mmc-make'.
Estimated hours taken: 5
Branches: main

Allow tools/bootcheck to be run using `mmake --use-mmc-make'.
The tests don't work yet.

compiler/make.m:
compiler/make.module_target.m:
	Handle targets such as `<module>.cs' and `<module>.ints',
	which are used when building stage 3.

Mmake.common.in:
*/Mmakefile:
*/Mercury.options:
	Add Mercury.options files to pass module-specific flags to
	`mmc --make'.

	Avoid triggering the .DEFAULT rule introduced with `--use-mmc-make'
	for optional files like Mmake.params.

compiler/modules.m:
	Build the interface files when building a library in IL grades,
	for consistency with C grades.

library/Mmakefile:
	Improve performance by removing the dependency on the interface
	files when building the library. The files are now always built
	by the libmer_std target.

	Pass the command to build libmer_std.init to `mmc --make'.

tools/bootcheck:
	Add an option `--use-mmc-make'.

	Copy the Mercury.options files into the stage2 and stage3 directories.

scripts/Mmake.rules:
	Don't include the rules for `.dep' files with `--use-mmc-make'.

	Include the rule for `--convert-to-mercury' even with `--use-mmc-make'.

compiler/Mmakefile:
tools/bootcheck:
tools/binary_step:
	`mmc --make' doesn't handle `<module>_init.c' targets, so
	don't make the `cs' target depend on `top_level_init.c'.
	As far as I can tell, that dependency is only present so
	that the stage2 and stage3 compilers have the same set of
	C files. bootcheck and binary_step now only compare `.c'
	files which are present in the stage3 directory.
2002-06-22 19:16:15 +00:00
Simon Taylor
9e947575d6 Remove Prolog support.
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	Remove Prolog support.
2002-06-20 07:14:06 +00:00
Simon Taylor
0f2865b42b Avoid generating interface files for the library in
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.rules:
	Avoid generating interface files for the library in
	the compiler directory by stripping the directory
	from the module name passed to mmc.
2002-06-10 07:03:14 +00:00
Simon Taylor
cc42c6d98a Fix a bug in my change to generate grade dependent header files.
Estimated hours taken: 0.25
Branches: main

Fix a bug in my change to generate grade dependent header files.
The `.mih' files weren't being installed for the default grade.

scripts/Mmake.rules:
	Run `lib<main_module>.install_grade_hdrs' for
	all grades, including the default grade.

Mmakefile:
library/Mmakefile:
	libmer_std.install_grade_hdrs is now run by
	libmer_std.install_library, so it doesn't
	need to be explicitly invoked here.
2002-05-31 07:02:37 +00:00
Simon Taylor
ac5c98bdaf Fix problems with the compiler-generated header files:
Estimated hours taken: 25
Branches: main

Fix problems with the compiler-generated header files:
1. the header files are grade dependent, but the header files
   can only be installed for one grade.
2. the generated header files can clash with system headers.

To solve these problems, the compiler now generates a
grade dependent `.mih' file containing the declarations
needed when a module is imported in a high-level C code
grade, and a grade independent `.mh' file, which contains
the prototypes for `:- pragma export' declarations.

compiler/export.m:
	Generate a `.mh' rather than a `.h' file for the `:- pragma export'
	declarations.

	Allow the header file generated by export.m to be used with
	`--high-level-code'.

compiler/modules.m:
library/Mmakefile:
	Add a module.install_grade_hdrs target to install the `.mih'
	files in a grade-dependent directory.

compiler/arg_info.m:
compiler/hlds_out.m:
compiler/hlds_pred.m:
	Make it easier to tell if the arg_info field of the proc_info
	has been set.

compiler/mlds_to_c.m:
	Include both the `.mh' and `.mih' files for imported modules.

	The type used as the return value for a semidet procedure
	exported to C is `MR_bool', not `MR_Word'.

compiler/mlds_to_c.m:
compiler/modules.m:
	Don't add a `mercury.' prefix to the standard library
	header file names. They can't clash with the system
	headers any more.

compiler/mercury_compile.m:
compiler/mlds_to_c.m:
	Use export.m to generate the header file for `:- pragma export'
	declarations even in hlc grades.

compiler/mlds.m:
compiler/ml*.m:
	Distinguish between the `.mh' and `.mih' files
	in `mlds__import's.

compiler/handle_options.m:
scripts/Mmake.vars.in:
scripts/mgnuc.in:
	Add C include directory options for the installed grade
	dependent `.mih' files.

Mmakefile:
scripts/Mmake.rules:
	s/h/mih/ in the commands to save the grade dependent
	files when installing the library grades.

compiler/make.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.util.m:
	Handle dependencies on `.mh' and `.mih' files.

NEWS:
doc/user_guide.texi:
	Document the change.
2002-05-30 12:55:23 +00:00
Simon Taylor
efd28044af Handle LDFLAGS and LD_LIBFLAGS with `mmc --make'.
Estimated hours taken: 1
Branches: main

Handle LDFLAGS and LD_LIBFLAGS with `mmc --make'.

compiler/options.m:
doc/user_guide.texi:
	Add `--ml-flags' as a synonym for `--link-flags'.

	Add `--ld-flags' and `--ld-libflags', which are the
	options corresponding to the LDFLAGS and LD_LIBFLAGS
	Mmake variables.

	Add a comment that the `--output-file' option is
	ignored with `mmc --make'.

compiler/options_file.m:
	Handle LDFLAGS and LD_LIBFLAGS.

	Handle MLLIBS correctly. MLLIBS contains `-l' options
	(which can be handled by mmc), not flags for ml.

	The value of LIBRARIES (which contains Mercury libraries
	to link with) now comes before MLLIBS, because Mercury
	libraries depend on C libraries, but C libraries usually
	don't depend on Mercury libraries.

compiler/compile_target_code.m:
	Pass the value `--ldflags' or `--ld-libflags' to ml.

scripts/Mmake.vars.in:
	Add LDFLAGS and LD_LIBFLAGS to the options file
	passed to the options file passed to `mmc --make'
	on standard input.
2002-05-25 13:25:17 +00:00
Simon Taylor
30686b9e1d Remove Prolog support.
Estimated hours taken: 0.5
Branches: main

Remove Prolog support.

Makefile:
	Don't clean up Prolog files.

configure.in:
bindist/bindist.configure.in:
scripts/Mmakefile:
scripts/sicstus_conv.in:
	Remove sicstus_conv.in.

scripts/Mmake.rules:
scripts/Mmake.vars.in:
	Remove Prolog-related variables and targets.
2002-05-16 06:48:43 +00:00
Simon Taylor
78495d8b99 Complete the support for building libraries with `mmc --make'.
Estimated hours taken: 2.5
Branches: main

Complete the support for building libraries with `mmc --make'.

compiler/make.m:
compiler/make.module_target.m:
compiler/mercury_compile.m:
compiler/compile_target_code.m:
	Generate the `.pic_o' files needed to build shared libraries.

scripts/mmc.in:
	Add `--pic-object-extension', `--create-archive-command'
	`--create-archive-command-output-flag',
	`--create-archive-commandflags' and `--ranlib-command'
	options to DEFAULT_MCFLAGS.

	Allow DEFAULT_MCFLAGS to be overridden in the environment,
	for consistency with the other *FLAGS variables.
2002-05-06 11:43:56 +00:00
Simon Taylor
462a0c2780 More changes to make `mmc --make' work with mmake.
Estimated hours taken: 5
Branches: main

More changes to make `mmc --make' work with mmake.

scripts/Mmake.vars.in:
	Pass MCFLAGS, CFLAGS, MLFLAGS, etc. to mmc in an options file
	on standard input.

	Don't add options for EXTRA_LIBRARIES to CFLAGS and MLFLAGS
	when compiling with `mmc --make'. mmc handles those options
	itself.

compiler/options.m:
compiler/options_file.m:
doc/user_guide.texi:
	`--options-file -' now makes the compiler read an options
	file from standard input.

	Make `--options-file' behave as a standard accumulating option
	rather than attempting to copy the behaviour of make's `-f' option.

	s/--link_object/--link-object/

Mmake.workspace:
	Put the `.a' files for the libraries in MLOBJS, not MLLIBS.
	`mmc --make' will now relink when they change.

compiler/modules.m:
	Link MLOBS into `module.split'.

tests/debugger/Mmakefile:
	Create a Mercury.options file for use in compiling
	the queries in interactive.m test.
2002-05-04 15:16:03 +00:00
Simon Taylor
e6d6f095d7 s/MC_MAKE_FILES/MC_BUILD_FILES/ as suggested by rafe.
Estimated hours taken: 0.1
Branches: main

scripts/mmake.in:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
	s/MC_MAKE_FILES/MC_BUILD_FILES/ as suggested by rafe.
2002-05-02 05:53:00 +00:00
Simon Taylor
6dcbb587f2 Allow `mmc --make' to be used with Mmake.
Estimated hours taken: 2.5
Branches: main

Allow `mmc --make' to be used with Mmake.

scripts/mmake.in:
	Add an option `--use-mmc-make', which tells mmake
	to use `mmc --make' to build Mercury targets.

scripts/Mmake.vars.in:
	Add a variable MC_MAKE_FILES, which should contain
	files (e.g. generated header files) which should be
	build with `mmc --make'.

	Add a variable MERCURY_MAIN_MODULES which should
	contain the top-level module names of the programs
	or libraries in the directory. The targets for
	the modules appearing in MERCURY_MAIN_MODULES
	are added to MC_MAKE_FILES.

	Add a variable MC_MAKE_FLAGS, which is like
	MCFLAGS, but is only passed to `mmc --make'.

scripts/Mmake.rules:
	Disable Mercury-specific rules when `--use-mmc-make'
	is passed to mmake.

	Use `mmc --make' for targets for which there are no
	rules, or for targets appearing in MC_MAKE_FILES.
2002-05-01 17:13:21 +00:00
Simon Taylor
351e020527 Fix a bug with --use-subdirs'. Mmake was looking for .il' files
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	Fix a bug with `--use-subdirs'. Mmake was looking for `.il' files
	in the `Mercury/os' directory.
2002-04-30 03:49:50 +00:00
Simon Taylor
5d693f5a1c Factor out the common Mmake code to set up the mmc, mgnuc
Estimated hours taken: 8
Branches: main

Factor out the common Mmake code to set up the mmc, mgnuc
and ml flags when building the Mercury compiler and libraries.
Use options, not environment variables. This will make it simpler
to use `mmc --make' to compile the compiler.

Mmake.workspace:
	Similar to tools/lmc. Sets up Mmake variables to
	use the library files in a workspace rather than
	an installed library.

configure.in:
	Check for the `--no-mercury-stdlib-dir' mmc option.
	Bootstrap CVS tag: bootstrap_20020429_stdlib_dir

Mmake.common.in:
*/Mmakefile:
	Move common code into Mmake.workspace.

browser/Mmakefile:
library/Mmakefile:
	Avoid invoking the linker explicitly when creating
	libraries of Mercury code. That won't work well
	with `mmc --make'.

tools/bootcheck:
tests/Mmake.common:
	Use Mmake.workspace instead of setting up environment
	variables in bootcheck.

scripts/Mmake.vars.in:
	mmc compiles split C files to object code itself,
	so pass `--cflags "$(ALL_CFLAGS)"' to mmc when
	compiling with `--split-c-files'.

browser/interactive_query.m:
	Use `mmc --make' when compiling the query. This is needed
	to make tests/debugger/interactive_query.m work when linking
	against a workspace using options rather than environment
	variables.  This also fixes a bug -- mmc options were being
	passed to ml.

	Clean up after the query.

tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
	Generate the input file to this test so that MCFLAGS
	and MC_MAKE_FLAGS (from Mmake.workspace) are used when
	compiling queries.

	tests/debugger/Mmakefile now sets SHELL to /usr/local/bash
	to allow the use of $(...) style command substitution
	(`...` style command substitution can't be nested).

tests/warnings/Mmakefile:
tests/dppd/Mmakefile:
	Include tests/Mmake.common.

tools/*:
scripts/c2init.in:
scripts/ml.in:
	Update the lists of files containing the library names.
2002-04-29 08:22:08 +00:00
Simon Taylor
c1ff17b9cb Fix bugs in my change to improve the handling of linking
Estimated hours taken: 0.1
Branches: main

Fix bugs in my change to improve the handling of linking
with a non-installed standard library.

scripts/mmake.in:
	Export MERCURY_STDLIB_DIR.

scripts/Mmake.rules:
	Always set MERC_INT_DIR to avoid undefined variable warnings.
2002-04-20 15:00:32 +00:00
Simon Taylor
b99e6cc370 Allow alternative locations for the standard library files
Estimated hours taken: 6
Branches: main

Allow alternative locations for the standard library files
to be specified using options to the various Mercury scripts
rather than environment variables.  This change is necessary
to allow the compiler to be compiled using `mmc --make', because
`mmc --make' does not support the environment variables.

All of the Mercury scripts now accept an option
`--mercury-standard-library-directory' to specify the installed
library to use, or `--no-mercury-standard-library-directory' to
disable the use of the installed library. The location
of the alternate files to use can then be specified
using ordinary options to the scripts.

There is a new environment variable MERCURY_STDLIB_DIR, which has
the same effect as the `--mercury-standard-library-directory' option.

scripts/parse_ml_options.sh-subr.in:
scripts/mgnuc.in:
scripts/mmc.in:
scripts/mmake.in:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
	Handle MERCURY_STDLIB_DIR and `--mercury-standard-library-directory'.

	Remove support for the MERCURY_C_INCL_DIR, MERCURY_MOD_LIB_DIRS
	and MERCURY_TRACE_LIB_DIRS environment variables -- they aren't
	used anywhere. MERCURY_C_INCL_DIR is being removed because the
	assumption it makes (that all header files are installed into
	a single directory) will not hold for much longer because the
	generated header files for hl* grades are grade dependent.

compiler/options.m:
compiler/compile_target_code.m:
	Add an option `--trace-init-file', used to specify `.init'
	files which should only be used when tracing is enabled,
	such as browser/mer_browse.init.

	Allow `--mercury-stdlib-dir' as an abbreviation for
	`--mercury-standard-library-directory'.

tools/lmc:
	Use options rather than environment variables.

doc/user_guide.texi:
	Document MERCURY_STDLIB_DIR, MERCURY_TRACE_LIB_MODS
	and the `--trace-init-file' mmc option.

	Remove documentation for the no longer used MERCURY_C_INCL_DIR,
	MERCURY_MOD_LIB_DIRS, MERCURY_TRACE_LIB_DIRS and
	MERCURY_NC_BUILTIN environment variables.
2002-04-19 14:59:37 +00:00
Simon Taylor
adb93c2e38 Fix a bug in my last change.
Estimated hours taken: 0.1
Branches: main

scripts/mmc.in:
	Fix a bug in my last change.
	-	*) exec $MC -I "$@" "$INTDIR" ;;
	+	*) exec $MC "$@" -I "$INTDIR" ;;
2002-04-07 13:41:49 +00:00