ruby/test/mkmf
Jun Aruga 57459b83a9
mkmf: Add the extra option `--with-verbose` to enable verbose mode. (#7863)
This commit is to add an extra option to enable verbose mode (V=1) in the
generated `Makefile` at runtime of the Ruby to print compiler command lines by
the commands below when building native extensions. It's possible to enable the
verbose mode by setting the environment variable `MAKEFLAGS="V=1"`[1]
implemented in GNU make. However, I wanted to make a consistent user-interface
not depending on the specific make's implementation.

```
$ ruby /path/to/extconf.rb -- --with-verbose
```

You can also add the extra option via rake-compiler gem.

```
$ rake compiler -- --with-verbose
```

If the extra option is not given, the value of the
`RbConfig::CONFIG["MKMF_VERBOSE"]` enabled by the configure option below is
used.

```
$ ./configure --enable-mkmf-verbose
```

For the unit tests, updated the following files.

* The `test/mkmf/test_configuration.rb` was created to test the cases with the
  `configuration` method and this implementation.
* Updated the `TestMkmf#assert_separately` to set the extra
  arguments in `test/mkmf/base.rb`. Updated tests using the `assert_separately`.
* Added tests for `MakeMakefile#with_config` in the `test/mkmf/test_config.rb`.

[1] https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html

Fixes [Bug #19695]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-05-29 10:09:32 +02:00
..
base.rb mkmf: Add the extra option `--with-verbose` to enable verbose mode. (#7863) 2023-05-29 10:09:32 +02:00
test_config.rb mkmf: Add the extra option `--with-verbose` to enable verbose mode. (#7863) 2023-05-29 10:09:32 +02:00
test_configuration.rb mkmf: Add the extra option `--with-verbose` to enable verbose mode. (#7863) 2023-05-29 10:09:32 +02:00
test_constant.rb Make sure super is called and fix teardown 2022-08-25 11:31:16 -07:00
test_convertible.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_egrep_cpp.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_find_executable.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_flags.rb mkmf: Add the extra option `--with-verbose` to enable verbose mode. (#7863) 2023-05-29 10:09:32 +02:00
test_framework.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_have_func.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_have_library.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_have_macro.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_install.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_libs.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_mkmf.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_pkg_config.rb Also the tests should use the configured pkg-config 2022-10-02 15:19:14 +09:00
test_signedness.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_sizeof.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00