Makefile: fixed and cleaned up MinGW/MSYS2/Cygwin handling - #4968
Makefile: fixed and cleaned up MinGW/MSYS2/Cygwin handling#4968firewave wants to merge 13 commits into
Conversation
|
This is basically ready to review but I want feedback from @chrfranke first as he inspired these changes. |
|
Sorry for the delay. Issues found:
On current MSYS2 the Proposed quick --- Makefile.orig 2023-05-05 16:14:26.667306500 +0200
+++ Makefile 2023-05-05 16:14:39.830069600 +0200
@@ -45,6 +45,13 @@
endif
# COMSPEC is defined when msys2 or cygwin shell is being used
+ifdef COMSPEC
+ ifeq ($(VERBOSE),1)
+ $(info COMSPEC found)
+ endif
+
+ WINNT=1
+endif # COMSPEC
# ComSpec is defined when cmd or ps (PowerShell) shell is being used
ifdef ComSpec
ifeq ($(VERBOSE),1)
@@ -62,19 +69,11 @@
endif
LDFLAGS+=-pthread
-endif # !WINNT
-
-
-ifeq ($(VERBOSE),1)
- $(info MSYSTEM=$(MSYSTEM))
-endif
-
-ifneq ($(MSYSTEM),MINGW32 MINGW64)
- RDYNAMIC=
- LDFLAGS+=-lshlwapi
-else
RDYNAMIC=-rdynamic
-endif
+else
+ LDFLAGS+=-lshlwapi
+ RDYNAMIC=
+endif # WINNT
ifndef CXX
CXX=g++
With your PR + the above fix, I tested the following targets and build environments successfully: Target: Native Win32-x64 cppcheck.exe (using MS Runtime): Target: Cygwin cppcheck.exe (using cygwin1.dll POSIX emulation): I did not test whether this breaks builds on other platforms. Two further unrelated notes:
|
|
No problem. Thanks a lot for the great and thorough feedback! Much appreciated. I tested this with MinGW (native Windows) CMD And it was working fine on all of them - but it is possible I introduced bugs since then (been a few months) or possibly shelved a wrong version. I will do my tests again within the next few days and document exactly what I tested.
Strange. That was done intentionally as it turned out unnecessary and make things more complex. Need to re-test myself.
Stupid mistake from having this sitting on the shelf too long.
Already recognized that myself a while ago and wanted to clean that up when I finish this up.
Those are harmless and it cannot happen - MSVC and GCC report them but Clang realizes it's impossible. I still plan to address them within another PR at some point. |
|
You're welcome. Further unrelated notes:
ifndef VERBOSE
VERBOSE=
endif
ifndef HAVE_RULES
HAVE_RULES=no
endif
ifndef MATCHCOMPILER
MATCHCOMPILER=
endif
ifndef CXX
CXX=g++
endif... is the same as .... VERBOSE=
HAVE_RULES=no
MATCHCOMPILER=
CXX=g++and the same as ... HAVE_RULES=no
CXX=g++ |
|
Sorry for the late reply. Will still take a while until I finish this up since I can't be bothered to do any extensive testing at the moment.
I have no idea if the install actually works properly and is actually used. I think the maintainers use CMake. See also https://trac.cppcheck.net/ticket/8659.
I never properly checked this. And I keep forgetting the Makefile syntax.
I was verbose about that since I didn't get around to checking it (and see above). See also your ticket https://trac.cppcheck.net/ticket/11825. I will most likely address these in a separate PR. |
|
Sorry for the late reply. Here's my test matrix with output: It builds on all those platforms with the current version of this PR. So that confirms my earlier tests that there is no need to handle Update: Interestingly it also seems there is no need for |
Ah, okay. The
This was actually wrong before my check so it never worked properly. |
…ms as we do in CMake / moved reset of `CPPCHK_GLIBCXX_DEBUG` on Windows
|
There is a difference between "MSYS2 MSYS" and "MSYS2 MINGW64" which needs to be considered. |
|
Will re-evaluate when the MinGW/Cygwin CI improvements from simplecpp have been ported over to Cppcheck. See also https://trac.cppcheck.net/ticket/14102. |
This is a follow-up on the discussion with @chrfranke in #4229.
I manually tested the build on all their shell variations as well as using the compiler through the regular command-line if possible.