-
Enhancement
-
Resolution: Fixed
-
P3
-
13
-
b08
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8301847 | 11.0.19 | Goetz Lindenmaier | P3 | Resolved | Fixed | b01 |
To check for various aspects of the build or target platform, we do a lot of checks like:
ifeq ($(OPENJDK_BUILD_OS_ENV), windows.cygwin)
...
The naming of those platform information variables is a bit unfortunate. Yes, we know we're building OpenJDK, so why the OPENJDK_ prefix? I've been wanting for a long time to do something about this odd prefix, and it became more urgent after the recent fix ofJDK-8160926, which pushes the matter about unifying the naming of build/target variables.
The solution in this patch is not to rename the variables per se, but to introduce an abstraction layer in terms of function calls for checking platform aspects.
This *really* shines when it comes to testing for multiple platforms. Previously, we were required to resort to constructs such as:
ifneq ($(filter $(OPENJDK_TARGET_OS), windows solaris), )
but this can now be expressed as:
ifeq ($(call isTargetOs, windows solaris), true)
Or this (actually technically broken) horrible example:
ifneq (, $(findstring $(OPENJDK_TARGET_OS), linux macosx))
which I had to read three times before being sure that this was the correct way to replace it:
ifeq ($(call isTargetOs, linux macosx), true)
ifeq ($(OPENJDK_BUILD_OS_ENV), windows.cygwin)
...
The naming of those platform information variables is a bit unfortunate. Yes, we know we're building OpenJDK, so why the OPENJDK_ prefix? I've been wanting for a long time to do something about this odd prefix, and it became more urgent after the recent fix of
The solution in this patch is not to rename the variables per se, but to introduce an abstraction layer in terms of function calls for checking platform aspects.
This *really* shines when it comes to testing for multiple platforms. Previously, we were required to resort to constructs such as:
ifneq ($(filter $(OPENJDK_TARGET_OS), windows solaris), )
but this can now be expressed as:
ifeq ($(call isTargetOs, windows solaris), true)
Or this (actually technically broken) horrible example:
ifneq (, $(findstring $(OPENJDK_TARGET_OS), linux macosx))
which I had to read three times before being sure that this was the correct way to replace it:
ifeq ($(call isTargetOs, linux macosx), true)
- backported by
-
JDK-8301847 Improved platform checking in makefiles
-
- Resolved
-
- relates to
-
JDK-8218736 Build warning in lib/JvmFlags.gmk: extraneous text after 'ifeq' directive
-
- Resolved
-
-
JDK-8304389 [11u] Crash on Windows in C2 compiled code after 8248238 and 8218431
-
- Resolved
-