RFR: 8329289: Unify SetupJdkExecutable and SetupJdkLibrary

Magnus Ihse Bursie ihse at openjdk.org
Thu Mar 28 21:09:32 UTC 2024


On Thu, 28 Mar 2024 21:04:48 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> make/common/JdkNativeCompilation.gmk line 233:
>> 
>>> 231:       # Set the default flags first to be able to override
>>> 232:       $1_CXXFLAGS := $$(filter-out $$($1_CXXFLAGS_FILTER_OUT), $$(CXXFLAGS_JDKLIB)) $$($1_CXXFLAGS)
>>> 233:     endif
>> 
>> I think it makes sense to share all that is actually common between the two existing macros, but for these conditional adding default flags, it's just a big if EXECUTABLE do this, otherwise do that. I think in such cases it makes more sense to keep that logic in the respective specialized macros. The only drawback would be that the new `SetupJdkNativeCompilation` won't be usable on its own, but it's not intended to be anyway.
>
> Actually, I'm intending on calling SetupJdkNativeCompilation directly in one place, from SetupTestFilesCompilation, which already mixes executable and libraries at it's entry point. So I'd rather keep SetupJdkNativeCompilation working.
> 
> Also, I plan to follow this up with a PR that splits up the C[XX]FLAGS_JDK[EXE|LIB] into constituent parts and then just select the few that differs between C and C++, LIB and EXE depending on which is chosen. I should perhaps have been clearer about this.

I also see another couple of rounds of refactoring on SetupJdkNativeCompilation and SetupNativeCompilation before they get really into shape. I prefer to do that step by step, so it is possible to follow what changes are being done. If I were to make all changes I'd like and push it in a single PR, it would be very hard to follow how the code has been transformed.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18537#discussion_r1543708289


More information about the build-dev mailing list