Northy1717/SWE-bench-Live huggingface dataset:
Repository: conan-io/conan

Issue:
[bug] GnuToolchain's make_args does not handle empty values correctly
### Describe the bug

Conan: 2.8.0

When using the GnuToolchain generator in the following manner
```python
tc = GnuToolchain(self)
tc.make_args["PREFIX"] = ""
...
tc.generate()
```
where an empty string is passed as a value, the resulting `make` command fails with:
```
libbpf/1.4.6: RUN: make PREFIX -j16
make: *** No rule to make target 'PREFIX'.  Stop.
```
Expected:
```
libbpf/1.4.6: RUN: make PREFIX= -j16
...
```

The `make_args` and `configure_args` properties should always map `""` and any other falsy values besides `None` to a `<key>=` command-line argument.

Also, the `make_args` should probably never create arguments without a `=` symbol altogether. Any `--xyz` flags to `make` seem better suited to the `args` keyword in `autotools.make(args=[...])`.

### How to reproduce it

_No response_


Discussion:
/cc @franramirez688 
@valgur thanks for noticing, and sorry for the delay we will fix it at https://github.com/conan-io/conan/pull/17532 . 
Merry Christmas 🥳 



Patch:
diff --git a/conan/tools/gnu/gnutoolchain.py b/conan/tools/gnu/gnutoolchain.py
index 336d8e06aff..6407f5c3027 100644
--- a/conan/tools/gnu/gnutoolchain.py
+++ b/conan/tools/gnu/gnutoolchain.py
@@ -237,7 +237,7 @@ def _filter_list_empty_fields(v):
 
     @staticmethod
     def _dict_to_list(flags):
-        return [f"{k}={v}" if v else k for k, v in flags.items()]
+        return [f"{k}={v}" if v is not None else k for k, v in flags.items()]
 
     @property
     def cxxflags(self):


Test patch:
diff --git a/test/unittests/tools/gnu/test_gnutoolchain.py b/test/unittests/tools/gnu/test_gnutoolchain.py
index cf053530e1f..c53f9d7bb83 100644
--- a/test/unittests/tools/gnu/test_gnutoolchain.py
+++ b/test/unittests/tools/gnu/test_gnutoolchain.py
@@ -192,5 +192,9 @@ def test_update_or_prune_any_args(cross_building_conanfile):
     assert "'--force" not in new_autoreconf_args
     # Add new value to make_args
     at.make_args.update({"--new-complex-flag": "new-value"})
+    at.make_args.update({"--new-empty-flag": ""})
+    at.make_args.update({"--new-no-value-flag": None})
     new_make_args = cmd_args_to_string(GnuToolchain._dict_to_list(at.make_args))
     assert "--new-complex-flag=new-value" in new_make_args
+    assert "--new-empty-flag=" in new_make_args
+    assert "--new-no-value-flag" in new_make_args and "--new-no-value-flag=" not in new_make_args