On Mon, 10 Oct 2022 15:29:16 GMT, Julian Waters <jwat...@openjdk.org> wrote:
>> Several parts of the make system in the JDK has large parts of cluttered if >> branches dedicated to setting flags for the specific compiler used in the >> build. This could be more neatly accomplished by instead adding more target >> combinations in SetupNativeCompilation so the callsite can more cleanly >> specify which OS and compiler it desires to set these flags for. The change >> currently includes: >> >> DISABLED_WARNINGS (including per file warnings), CFLAGS/CXXFLAGS and >> LDFLAGS: Compiler-then-OS (The priority shown reflects how the flags depend >> more so on the compiler) >> LIBS: OS-then-Compiler, as libraries typically vary based on the system >> being compiled for > > Julian Waters has updated the pull request incrementally with one additional > commit since the last revision: > > Extra spacing java.desktop and jdk.jpackage in particular suffer the most from this issue, as both have many flags that often different between these combinations, for instance in Awt2dLibraries.gmk: LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES $(X_CFLAGS) LIBAWT_CFLAGS += -DMLIB_NO_LIBSUNMATH ifeq ($(call isTargetOs, windows), true) LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE ifeq ($(call isTargetCpuBits, 64), true) LIBAWT_CFLAGS += -DMLIB_OS64BIT endif LIBAWT_RCFLAGS ?= -I$(TOPDIR)/src/java.base/windows/native/launcher/icons LIBAWT_VERSIONINFO_RESOURCE := $(TOPDIR)/src/$(MODULE)/windows/native/libawt/windows/awt.rc endif ifeq ($(call isTargetOs, linux), true) # FIXME: This is probably not what we want to do, but keep it now for compatibility. LIBAWT_CFLAGS += $(EXPORT_ALL_SYMBOLS) endif # Turn off all warnings for debug_mem.c This is needed because the specific warning # about initializing a declared 'extern' cannot be turned off individually. Only # applies to debug builds. ifeq ($(TOOLCHAIN_TYPE), gcc) BUILD_LIBAWT_debug_mem.c_CFLAGS := -w # This option improves performance of MaskFill in Java2D by 20% for some gcc LIBAWT_CFLAGS += -fgcse-after-reload endif ifeq ($(call isTargetOs, macosx), true) LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX BUILD_LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS := -x objective-c -O0 BUILD_LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS := -x objective-c -O0 BUILD_LIBSPLASHSCREEN_splashscreen_gif.c_CFLAGS := -x objective-c -O0 BUILD_LIBSPLASHSCREEN_splashscreen_impl.c_CFLAGS := -x objective-c -O0 BUILD_LIBSPLASHSCREEN_splashscreen_jpeg.c_CFLAGS := -x objective-c -O0 BUILD_LIBSPLASHSCREEN_splashscreen_png.c_CFLAGS := -x objective-c -O0 BUILD_LIBSPLASHSCREEN_splashscreen_sys.m_CFLAGS := -O0 else ifeq ($(call isTargetOs, windows), true) LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32 else LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 $(X_CFLAGS) endif LIBSPLASHSCREEN_LIBS := ifeq ($(call isTargetOs, macosx), true) LIBSPLASHSCREEN_LIBS += \ $(LIBM) -lpthread -liconv -losxapp \ -framework ApplicationServices \ -framework Foundation \ -framework Security \ -framework Cocoa \ -framework Metal else ifeq ($(call isTargetOs, windows), true) LIBSPLASHSCREEN_LIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib $(WIN_JAVA_LIB) jvm.lib else LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread -ldl endif BUILD_LIBFREETYPE_CFLAGS := -DFT2_BUILD_LIBRARY $(EXPORT_ALL_SYMBOLS) # For use by libfontmanager: LIBFREETYPE_CFLAGS := -I$(BUILD_LIBFREETYPE_HEADER_DIRS) ifeq ($(call isTargetOs, windows), true) LIBFREETYPE_LIBS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfreetype/freetype.lib # freetype now requires you to manually define this (see ftconfig.h) BUILD_LIBFREETYPE_CFLAGS += -DDLL_EXPORT else LIBFREETYPE_LIBS := -lfreetype endif ------------- PR: https://git.openjdk.org/jdk/pull/10634