mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-09 10:52:24 +00:00
Estimated hours taken: 50 Branches: main Remove Unix dependencies in the compiler. Avoid calling passes_aux.invoke_shell_command, which requires the presence of a Unix shell. The implementation of fact tables still has dependencies on Unix utilities (e.g. sort). aclocal.m4: Don't pass Unix style paths to MSVC. configure.in: Use `cygpath -m' rather than `cygpath -w'. `cygpath -m' uses '/' as the directory separator, so it doesn't cause quoting problems in shell scripts. Apply $CYGPATH to $PREFIX, $LIBDIR, $CONFIG_PREFIX and $CONFIG_LIBDIR. Don't pass `-lm' when linking with MSVC. configure.in: compiler/options.m: scripts/Mercury.config.in: Add extra configuration options to deal with differences between linking with gcc and MSVC: --linker-opt-separator --linker-link-lib-flag --linker-link-lib-suffix --shlib-linker-link-lib-flag --shlib-linker-link-lib-suffix --linker-path-flag NEWS: doc/user_guide.texi: compiler/options.m: compiler/compile_target_code.m: compiler/make.program_target.m: Instead of substituting in an arbitrary shell script when processing `--pre-link-command' and `--extra-init-command', require that these options specify a command which will be passed the name of the source file containing the main module as the first argument, with the source files containing the remaining modules following. This is simpler and avoids dependencies on a shell. Fix quote_arg to handle Windows paths better. compiler/handle_options.m: Don't attempt to use symlinks if they're not available. compiler/compile_target_code.m: Be more careful about quoting. Don't call invoke_shell_command where invoke_system_command would do. Allow linking using MSVC. compiler/modules.m: Remove make_directory, which is now implemented by dir.m. Use io.make_symlink rather than shell scripts. Implement mercury_update_interface in Mercury. compiler/llds_out.m: compiler/make.program_target.m: Use dir.make_directory, not modules.make_directory, which has been removed. compiler/make.module_target.m: Invoke mercury_compiler directly, not through the mmc script to avoid shell dependencies. If we can't fork() child `mmc --make' processes, pass the arguments to the child process using a file to avoid overflowing system limits on Windows. compiler/mercury_compile.m: compiler/options_file.m: Read argument files. Handle backslash-newline in options files correctly. compiler/passes_aux.m: invoke_system_command shouldn't set the exit status -- the caller may be able to try something else. compiler/process_util.m: Export can_fork for use by make.module_target.m. Remove hacks to work around bugs in the implementation of zero-arity foreign procs. compiler/prog_io.m: Handle bizarre file names without aborting. library/Mmakefile: library/print_extra_inits: Move code to find extra initialization functions into print_extra_inits, due to the change to the handling of the --extra-init-command option described above. scripts/mmc.in: Set the MERCURY_COMPILER environment variable if it is not already set, so that the mercury_compile executable knows where to find itself. scripts/mercury.bat.in: Make this actually work. tools/bootcheck: Set ANALYSIS_LIB_NAME. Apply cygpath (-m not -w) to $root. Link print_extra_inits into the stage2 and stage3 library directories. util/mkinit.c: Handle '\\' in path names.
103 lines
2.6 KiB
Batchfile
103 lines
2.6 KiB
Batchfile
@echo off
|
|
rem @configure_input@
|
|
rem ---------------------------------------------------------------------------
|
|
rem Copyright (C) 1994-1998, 2000-2001, 2003 The University of Melbourne.
|
|
rem This file may only be copied under the terms of the GNU General
|
|
rem Public License - see the file COPYING in the Mercury distribution.
|
|
rem ---------------------------------------------------------------------------
|
|
rem
|
|
rem mercury.bat - Melbourne Mercury Compiler.
|
|
rem
|
|
rem Use `mercury -h' for help.
|
|
rem
|
|
rem Environment variables:
|
|
rem MERCURY_COMPILER, MERCURY_CONFIG_DIR.
|
|
rem ---------------------------------------------------------------------------
|
|
rem This is a Windows batch file version of the `mmc' Bourne shell script.
|
|
rem The idea is to eventually avoid the need to use Cygwin.
|
|
rem XXX Note that currently Cygwin is still required:
|
|
rem (1) For installation (`configure' and `make install').
|
|
rem This would be easy enough to avoid; if we're willing to hard-code
|
|
rem the installation path, we could easily package up the installation
|
|
rem in a WinZip file or something similar.
|
|
rem ---------------------------------------------------------------------------
|
|
|
|
rem On Windows 98 an unset variable is treated as if it is set to ""
|
|
if "%MERCURY_CONFIG_DIR%"=="" goto :config_dir_not_set
|
|
|
|
rem On Windows XP an unset variable is not substituted.
|
|
if "%MERCURY_CONFIG_DIR%"=="^%MERCURY_CONFIG_DIR^%" goto :config_dir_not_set
|
|
|
|
goto :config_dir_set
|
|
|
|
:config_dir_not_set
|
|
|
|
if "%MERCURY_STDLIB_DIR%"=="" goto :stdlib_dir_not_set
|
|
if "%MERCURY_STDLIB_DIR%"=="^%MERCURY_STDLIB_DIR^%" goto :stdlib_dir_not_set
|
|
|
|
set MERCURY_CONFIG_DIR="%MERCURY_CONFIG_DIR%"
|
|
|
|
goto :config_dir_set
|
|
|
|
:stdlib_dir_not_set
|
|
|
|
set MERCURY_CONFIG_DIR="@CONFIG_LIBDIR@"
|
|
|
|
:config_dir_set
|
|
|
|
if "%MERCURY_COMPILER%"=="" set MERCURY_COMPILER="@LIBDIR@\bin\@FULLARCH@\mercury_compile"
|
|
if "%MERCURY_COMPILER%"=="^%MERCURY_COMPILER^%" set MERCURY_COMPILER="@LIBDIR@\bin\@FULLARCH@\mercury_compile"
|
|
|
|
rem There is no equivalent of "$@" available on all Windows platforms.
|
|
rem (Windows XP has `%*').
|
|
|
|
set v1=%1
|
|
set v2=%2
|
|
set v3=%3
|
|
set v4=%4
|
|
set v5=%5
|
|
set v6=%6
|
|
set v7=%7
|
|
set v8=%8
|
|
set v9=%9
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
set v10=%0
|
|
set v11=%1
|
|
set v12=%2
|
|
set v13=%3
|
|
set v14=%4
|
|
set v15=%5
|
|
set v16=%6
|
|
set v17=%7
|
|
set v18=%8
|
|
set v19=%9
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
shift
|
|
|
|
if "%9"=="" goto :exec
|
|
|
|
echo mercury.bat: too many arguments (maximum 28)
|
|
goto :end
|
|
|
|
:exec
|
|
%MERCURY_COMPILER% %v1% %v2% %v3% %v4% %v5% %v6% %v7% %v8% %v9% %v10% %v11% %v12% %v13% %v14% %v15% %v16% %v17% %v18% %v19% %0 %1 %2 %3 %4 %5 %6 %7 %8
|
|
|
|
:end
|