On Mon, 21 Mar 2022 17:36:53 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> make/modules/java.base/Lib.gmk line 217: >> >>> 215: CXXFLAGS := $(CXXFLAGS_JDKLIB), \ >>> 216: LDFLAGS := $(LDFLAGS_JDKLIB) -Wl$(COMMA)--no-as-needed, \ >>> 217: LIBS := $(LIBCXX) -lc -lm -ldl, \ >> >> Instead of repeating this whole macro call for both Linux and non Linux, you >> can use parameters of the form LDFLAGS_linux and LIBS_linux to add the Linux >> specific flags. Something like this: >> >> >> LDFLAGS := $(LDFLAGS_JDKLIB), \ >> LDFLAGS_linux := -Wl$(COMMA)--no-as-needed, \ >> >> >> For the NAME field, there is no such support, so the way we usually do that >> is through a variable and conditionals before the macro call. What's the >> reason to have a different lib name on Windows? If they were the same, and >> the source file in windows/native/... had the same name, it would just >> automatically override in the build. >> >> I realize now that this is just moved code from jdk.incubator.foreign, and >> this patch is probably big enough as it is so no need to refactor the build >> logic at the same time. > > Good points - there is really no need AFAIK for the lib name to be different. > I'll do few experiments. I've fixed the makefile as you suggested - I agree the result is much simpler. I've tested the changes on mac/linux/win and everything looks good. ------------- PR: https://git.openjdk.java.net/jdk/pull/7888