CompileNativeLibraries.gmk 120.7 KB
Newer Older
1
#
2
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

defalt: all

include $(SPEC)
include MakeBase.gmk
include NativeCompilation.gmk

# Setup the java compilers for the JDK build.
include Setup.gmk

# Copy files (can now depend on $(COPY_FILES))
include CopyFiles.gmk

38 39 40
# Prepare the find cache. Only used if running on windows.
$(eval $(call FillCacheFind,$(JDK_TOPDIR)/src))

41 42 43
# Build tools
include Tools.gmk

44 45 46 47
# Include the javah generated headers.
CFLAGS_JDKLIB += -I$(JDK_OUTPUTDIR)/gensrc_headers
CXXFLAGS_JDKLIB += -I$(JDK_OUTPUTDIR)/gensrc_headers

48 49
# Put the libraries here. Different locations for different target apis.
ifeq ($(OPENJDK_TARGET_OS_API),posix)
50
    INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
51 52 53 54 55 56 57 58 59 60 61 62
else
    INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/bin
endif

BUILD_LIBRARIES=

# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
# elegant solution to this.
WIN_VERIFY_LIB := $(JDK_OUTPUTDIR)/objs/libverify/verify.lib
WIN_JAVA_LIB := $(JDK_OUTPUTDIR)/objs/libjava/java.lib
WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib

63 64 65
# Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
# not on other platforms.
ifeq ($(OPENJDK_TARGET_OS), windows)
66 67 68 69 70 71
    DEBUG_ALL_BINARIES := true
endif

# Build everything with debugging on OpenJDK
ifdef OPENJDK
    DEBUG_ALL_BINARIES := true
72 73 74 75 76 77 78 79
endif

#
# TODO replace with X_FLAGS / X_LIBS
#   and add them to configure
#
OPENWIN_LIB:=$(OPENWIN_HOME)/lib

80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
##########################################################################################

BUILD_LIBFDLIBM_OPTIMIZATION:=HIGH

ifneq ($(OPENJDK_TARGET_OS), solaris)
      BUILD_LIBFDLIBM_OPTIMIZATION:=NONE
endif

ifneq ($(OPENJDK_TARGET_OS),macosx)
$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM,\
                STATIC_LIBRARY:=fdlibm,\
                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs,\
                SRC:=$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src,\
		LANG:=C,\
		OPTIMIZATION:=$(BUILD_LIBFDLIBM_OPTIMIZATION), \
		CFLAGS:=$(CFLAGS_JDKLIB) \
			-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
97
		CFLAGS_windows_debug:=-DLOGGING,\
98
		ARFLAGS:=$(ARFLAGS),\
99 100
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
101 102

else
103 104 105 106

# On macosx the old build does partial (incremental) linking of fdlibm instead of
# a plain static library.
$(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC,\
107 108 109 110 111 112
                LIBRARY:=fdlibm,\
                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm,\
                SRC:=$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src,\
		LANG:=C,\
		CFLAGS:=$(CFLAGS_JDKLIB) \
			-I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include,\
113
		LDFLAGS:=-nostdlib -r -arch x86_64,\
114 115
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfdlibm,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
116

117 118
BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
$(BUILD_LIBFDLIBM) : $(BUILD_LIBFDLIBM_MAC)
119
	$(call install-file)
120 121

endif
122
BUILD_LIBRARIES += $(BUILD_LIBFDLIBM)
123 124 125 126 127 128

##########################################################################################

BUILD_LIBVERIFY_SRC:=check_code.c check_format.c

ifeq ($(OPENJDK_TARGET_OS), solaris)
129 130
	ifneq ($(OPENJDK_TARGET_CPU), x86_64)
		BUILD_LIBVERIFY_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libverify/reorder-$(OPENJDK_TARGET_CPU)
131 132 133
	endif
endif

134 135
LIBVERIFY_OPTIMIZATION:=HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
136
    ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
137 138 139 140
        LIBVERIFY_OPTIMIZATION:=LOW
    endif
endif

141 142 143 144 145 146 147

$(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY,\
		LIBRARY:=verify, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
		SRC:=$(JDK_TOPDIR)/src/share/native/common,\
		INCLUDE_FILES:=$(BUILD_LIBVERIFY_SRC),\
		LANG:=C,\
148
		OPTIMIZATION:=$(LIBVERIFY_OPTIMIZATION), \
149 150 151 152 153 154
		CFLAGS:=$(CFLAGS_JDKLIB),\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libverify/mapfile-vers, \
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN), \
		LDFLAGS_SUFFIX_posix:=-ljvm -lc,\
		LDFLAGS_SUFFIX_windows:=jvm.lib,\
155 156
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS) \
O
ohair 已提交
157 158 159
			  -D "JDK_FNAME=verify.dll" \
			  -D "JDK_INTERNAL_NAME=verify" \
			  -D "JDK_FTYPE=0x2L",\
160 161 162 163 164 165 166 167
		REORDER:=$(BUILD_LIBVERIFY_REORDER),\
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libverify,\
		DEBUG_SYMBOLS:=true))

BUILD_LIBRARIES += $(BUILD_LIBVERIFY)

##########################################################################################

168
LIBJAVA_SRC_DIRS:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/lang \
169 170 171 172
		$(JDK_TOPDIR)/src/share/native/java/lang \
		$(JDK_TOPDIR)/src/share/native/java/lang/ref \
		$(JDK_TOPDIR)/src/share/native/java/lang/reflect \
		$(JDK_TOPDIR)/src/share/native/java/io \
173
		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
174 175 176 177 178 179 180
		$(JDK_TOPDIR)/src/share/native/java/nio \
		$(JDK_TOPDIR)/src/share/native/java/security \
		$(JDK_TOPDIR)/src/share/native/common \
		$(JDK_TOPDIR)/src/share/native/sun/misc \
		$(JDK_TOPDIR)/src/share/native/sun/reflect \
		$(JDK_TOPDIR)/src/share/native/java/util \
		$(JDK_TOPDIR)/src/share/native/java/util/concurrent/atomic \
181
		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
O
ohair 已提交
182 183
		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/util

184 185 186 187
ifneq ($(OPENJDK_TARGET_OS),macosx)
    LIBJAVA_SRC_DIRS+=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/util/locale/provider
else
    LIBJAVA_SRC_DIRS+=$(JDK_TOPDIR)/src/macosx/native/sun/util/locale/provider
188 189
endif

O
ohair 已提交
190 191 192 193 194
ifeq ($(OPENJDK_TARGET_OS),windows)
    LIBJAVA_SRC_DIRS+=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/provider \
		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/io
endif

195 196
LIBJAVA_CFLAGS:=$(foreach dir,$(LIBJAVA_SRC_DIRS),-I$(dir)) \
		  -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include \
197
                  -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
198 199 200 201

LIBJAVA_CFLAGS += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
                  -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
                  -DJDK_MICRO_VERSION='"$(JDK_MICRO_VERSION)"' \
202
                  -DJDK_BUILD_NUMBER='"$(JDK_BUILD_NUMBER)"'
203 204 205 206 207

ifneq (,$(JDK_UPDATE_VERSION))
	LIBJAVA_CFLAGS += -DJDK_UPDATE_VERSION='"$(JDK_UPDATE_VERSION)"'
endif

208
LIBJAVA_EXCLUDE_FILES:=check_code.c check_format.c jspawnhelper.c
209 210 211 212 213

ifneq ($(OPENJDK_TARGET_OS),macosx)
	LIBJAVA_EXCLUDE_FILES += java_props_macosx.c
else
	BUILD_LIBJAVA_java_props_md.c_CFLAGS:=-x objective-c
214
        BUILD_LIBJAVA_java_props_macosx.c_CFLAGS:=-x objective-c
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
endif

ifeq ($(OPENJDK_TARGET_OS),windows)
        LIBJAVA_EXCLUDE_FILES += \
		UNIXProcess_md.c \
		UnixFileSystem_md.c \
		FileSystemPreferences.c
else
	LIBJAVA_EXCLUDE_FILES += \
		ProcessImpl_md.c \
		WinNTFileSystem_md.c \
		dirent_md.c \
		WindowsPreferences.c \
		sun/security/provider/WinCAPISeedGenerator.c \
		sun/io/Win32ErrorMode.c
endif

ifeq ($(OPENJDK_TARGET_OS), solaris)
233 234
    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
        LIBJAVA_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libjava/reorder-$(OPENJDK_TARGET_CPU)
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
    endif
endif

$(eval $(call SetupNativeCompilation,BUILD_LIBJAVA,\
		LIBRARY:=java,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
		SRC:=$(LIBJAVA_SRC_DIRS),\
		EXCLUDES:=fdlibm/src zip, \
		EXCLUDE_FILES:=$(LIBJAVA_EXCLUDE_FILES), \
		LANG:=C,\
		OPTIMIZATION:=HIGH, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
                        $(LIBJAVA_CFLAGS),\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjava/mapfile-vers, \
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN), \
		LDFLAGS_SUFFIX_posix:=-ljvm -lverify, \
252
		LDFLAGS_SUFFIX_solaris:=-lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc,\
253
		LDFLAGS_SUFFIX_linux:=$(LIBDL) $(BUILD_LIBFDLIBM),\
254
		LDFLAGS_SUFFIX_macosx:=-L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
255
                                         -framework CoreFoundation \
256
                                         -framework Foundation \
257
                                         -framework Security -framework SystemConfiguration, \
O
ohair 已提交
258 259 260 261
		LDFLAGS_SUFFIX_windows:=-export:winFileHandleOpen -export:handleLseek \
					jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
					shell32.lib delayimp.lib -DELAYLOAD:shell32.dll \
					advapi32.lib,\
262 263
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
264 265 266
			  -D "JDK_FNAME=java.dll" \
			  -D "JDK_INTERNAL_NAME=java" \
			  -D "JDK_FTYPE=0x2L",\
267
		REORDER:=$(LIBJAVA_REORDER), \
268
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava,\
269
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
270 271 272 273 274 275 276 277 278 279 280 281 282 283

BUILD_LIBRARIES += $(BUILD_LIBJAVA)

$(BUILD_LIBJAVA) : $(LIBJLI_BINARY)

$(BUILD_LIBJAVA) : $(BUILD_LIBVERIFY)

$(BUILD_LIBJAVA) : $(BUILD_LIBFDLIBM)

##########################################################################################

BUILD_LIBMLIB_SRC:=$(JDK_TOPDIR)/src/share/native/sun/awt/medialib
BUILD_LIBMLIB_CFLAGS:=-D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \
			-I$(BUILD_LIBMLIB_SRC) \
284
			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/medialib
285 286 287 288

BUILD_LIBMLIB_LDLIBS:=
BUILD_LIBMLIB_IMAGE_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libmlib_image/mapfile-vers

289
BUILD_LIBMLIB_CFLAGS += -DMLIB_NO_LIBSUNMATH
290

291
ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
	BUILD_LIBMLIB_CFLAGS += -DMLIB_OS64BIT
endif

ifneq ($(OPENJDK_TARGET_OS), windows)
	BUILD_LIBMLIB_LDLIBS += $(LIBM) $(LIBDL)
endif

$(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE,\
		LIBRARY:=mlib_image,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                SRC:=$(BUILD_LIBMLIB_SRC),\
		EXCLUDE_FILES:=awt_ImagingLib.c mlib_c_ImageBlendTable.c,\
		LANG:=C,\
		OPTIMIZATION:=HIGHEST, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
                        $(BUILD_LIBMLIB_CFLAGS),\
		MAPFILE:=$(BUILD_LIBMLIB_IMAGE_MAPFILE), \
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
311 312
		LDFLAGS_SUFFIX:=$(BUILD_LIBMLIB_LDLIBS) \
				$(LDFLAGS_JDKLIB_SUFFIX),\
313
		LDFLAGS_SUFFIX_solaris:=-lc, \
314 315
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
316 317 318
			  -D "JDK_FNAME=mlib_image.dll" \
			  -D "JDK_INTERNAL_NAME=mlib_image" \
			  -D "JDK_FTYPE=0x2L",\
319
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image,\
320
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
321 322 323 324 325 326 327

$(BUILD_LIBMLIB_IMAGE) : $(BUILD_LIBJAVA)

BUILD_LIBRARIES += $(BUILD_LIBMLIB_IMAGE)

##########################################################################################

328
ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH),solaris-sparc)
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434

BUILD_LIBMLIB_IMAGE_V_FILES:=\
        mlib_v_ImageLookUp.c \
        mlib_ImageCreate.c \
        mlib_ImageAffine.c \
        mlib_ImageConvMxN.c \
        mlib_ImageConvKernelConvert.c \
        mlib_sys.c \
        mlib_ImageLookUp_64.c \
        mlib_ImageLookUp_Bit.c \
        mlib_ImageColorTrue2Index.c \
        mlib_c_ImageThresh1_U8.c \
        mlib_v_ImageLookUpS16S16Func.c \
        mlib_v_ImageLookUpS16S32Func.c \
        mlib_v_ImageLookUpS16U16Func.c \
        mlib_v_ImageLookUpS16U8Func.c \
        mlib_v_ImageLookUpS32S16Func.c \
        mlib_v_ImageLookUpS32S32Func.c \
        mlib_v_ImageLookUpS32U16Func.c \
        mlib_v_ImageLookUpS32U8Func.c \
        mlib_v_ImageLookUpSIS16S16Func.c \
        mlib_v_ImageLookUpSIS16S32Func.c \
        mlib_v_ImageLookUpSIS16U16Func.c \
        mlib_v_ImageLookUpSIS16U8Func.c \
        mlib_v_ImageLookUpSIS32S16Func.c \
        mlib_v_ImageLookUpSIS32S32Func.c \
        mlib_v_ImageLookUpSIS32U16Func.c \
        mlib_v_ImageLookUpSIS32U8Func.c \
        mlib_v_ImageLookUpSIU16S16Func.c \
        mlib_v_ImageLookUpSIU16S32Func.c \
        mlib_v_ImageLookUpSIU16U16Func.c \
        mlib_v_ImageLookUpSIU16U8Func.c \
        mlib_v_ImageLookUpSIU8S16Func.c \
        mlib_v_ImageLookUpSIU8S32Func.c \
        mlib_v_ImageLookUpSIU8U16Func.c \
        mlib_v_ImageLookUpSIU8U8Func.c \
        mlib_v_ImageLookUpU16S16Func.c \
        mlib_v_ImageLookUpU16S32Func.c \
        mlib_v_ImageLookUpU16U16Func.c \
        mlib_v_ImageLookUpU16U8Func.c \
        mlib_v_ImageLookUpU8S16Func.c \
        mlib_v_ImageLookUpU8S32Func.c \
        mlib_v_ImageLookUpU8U16Func.c \
        mlib_v_ImageLookUpU8U8Func.c \
        mlib_v_ImageAffineIndex_BC.c \
        mlib_v_ImageAffine_BC.c \
        mlib_v_ImageAffine_BC_S16.c \
        mlib_v_ImageAffine_BC_U16.c \
        mlib_v_ImageAffine_BL.c \
        mlib_v_ImageAffine_BL_S16.c \
        mlib_v_ImageAffine_BL_U16.c \
        mlib_v_ImageAffine_NN.c \
        mlib_v_ImageFilters.c \
        mlib_ImageAffineEdge.c \
        mlib_ImageAffine_BC_D64.c \
        mlib_ImageAffine_BC_F32.c \
        mlib_ImageAffine_BC_S32.c \
        mlib_ImageAffine_BL_D64.c \
        mlib_ImageAffine_BL_F32.c \
        mlib_ImageAffine_BL_S32.c \
        mlib_ImageAffine_NN.c \
        mlib_ImageAffine_NN_Bit.c \
        mlib_ImageFilters.c \
        mlib_ImageScanPoly.c \
        mlib_ImageConv_8nw.c \
        mlib_ImageConv_8ext.c \
        mlib_ImageConv_16nw.c \
        mlib_ImageConv_16ext.c \
        mlib_ImageConv_u16nw.c \
        mlib_ImageConv_u16ext.c \
        mlib_ImageConv_32nw.c \
        mlib_ImageConv_F32nw.c \
        mlib_ImageConvMxN_Fp.c \
        mlib_ImageConvMxN_ext.c \
        mlib_ImageConv_D64nw.c \
        mlib_ImageClipping.c \
        mlib_ImageConvCopyEdge_Bit.c \
        mlib_ImageConvClearEdge_Bit.c \
        mlib_ImageConv2x2_f.c \
        mlib_ImageConvClearEdge_Fp.c \
        mlib_v_ImageConvMxN_8.c \
        mlib_v_ImageConvClearEdge.c \
        mlib_v_ImageConvCopyEdge.c \
        mlib_v_ImageConvMxN_8ext.c \
        mlib_v_ImageConvVersion.c \
        mlib_v_ImageConv_8nw.c \
        mlib_ImageConvCopyEdge_Fp.c \
        mlib_v_ImageChannelInsert_1.c \
        mlib_v_ImageChannelExtract_43.c \
        mlib_v_ImageChannelExtract_1.c \
        mlib_ImageCopy_Bit.c \
        mlib_v_ImageCopy_f.c \
        mlib_ImageUtils.c \
        mlib_ImageDivTables.c

BUILD_LIBMLIB_V_CFLAGS := $(filter-out -DMLIB_NO_LIBSUNMATH,$(BUILD_LIBMLIB_CFLAGS))

$(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE_V,\
		LIBRARY:=mlib_image_v, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                SRC:=$(JDK_TOPDIR)/src/share/native/sun/awt/medialib \
		     $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib,\
		LANG:=C,\
		INCLUDE_FILES:=$(BUILD_LIBMLIB_IMAGE_V_FILES),\
		OPTIMIZATION:=HIGHEST, \
		CFLAGS:=-xarch=sparcvis \
435
                      $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(OPENJDK_TARGET_CPU_BITS).il\
436 437 438 439
                      $(BUILD_LIBMLIB_V_CFLAGS) \
                      $(CFLAGS_JDKLIB), \
		MAPFILE:=$(BUILD_LIBMLIB_IMAGE_MAPFILE), \
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
O
ohair 已提交
440
                         $(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
441
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
442
		LDFLAGS_SUFFIX_solaris:=-lc,\
443 444
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmlib_image_v,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
445

O
ohair 已提交
446 447
$(BUILD_LIBMLIB_IMAGE_V): $(BUILD_LIBJAVA)

448 449 450 451 452 453 454 455
BUILD_LIBRARIES += $(BUILD_LIBMLIB_IMAGE_V)

endif

##########################################################################################

LIBAWT_DIRS:=\
	$(JDK_TOPDIR)/src/share/native/sun/awt \
456
	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
457 458 459 460 461 462 463
	$(JDK_TOPDIR)/src/share/native/sun/awt/image \
	$(JDK_TOPDIR)/src/share/native/sun/awt/image/gif \
	$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
	$(JDK_TOPDIR)/src/share/native/sun/awt/medialib \
	$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
	$(JDK_TOPDIR)/src/share/native/sun/awt/utility \
	$(JDK_TOPDIR)/src/share/native/sun/java2d \
464
	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
465 466 467 468
	$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
	$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
	$(JDK_TOPDIR)/src/share/native/sun/awt/image \
	$(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
469
	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/opengl \
O
ohair 已提交
470 471 472 473
	$(JDK_TOPDIR)/src/share/native/sun/font

ifeq ($(OPENJDK_TARGET_OS),windows)
    LIBAWT_DIRS+=\
474 475 476
	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows \
	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/d3d
477
    LIBAWT_CFLAGS+=-I$(DXSDK_INCLUDE_PATH)
O
ohair 已提交
478 479 480 481
else
    LIBAWT_DIRS+=\
	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11
endif
482

483
LIBAWT_CFLAGS+=-D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES \
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556
	$(X_CFLAGS) \
	$(foreach dir,$(LIBAWT_DIRS),-I$(dir))

LIBAWT_FILES:=\
	gifdecoder.c \
	imageInitIDs.c \
	img_globals.c \
	SurfaceData.c \
	Region.c \
	BufImgSurfaceData.c \
	Disposer.c \
	Trace.c \
	GraphicsPrimitiveMgr.c \
	Blit.c \
	BlitBg.c \
	ScaledBlit.c \
	FillRect.c \
	FillSpans.c \
	FillParallelogram.c \
	DrawParallelogram.c \
	DrawLine.c \
	DrawRect.c \
	DrawPolygons.c \
	DrawPath.c \
	FillPath.c \
	ProcessPath.c \
	MaskBlit.c \
	MaskFill.c \
	TransformHelper.c \
	AlphaMath.c \
	AlphaMacros.c \
	AnyByte.c \
	ByteBinary1Bit.c \
	ByteBinary2Bit.c \
	ByteBinary4Bit.c \
	ByteIndexed.c \
	ByteGray.c \
	Index8Gray.c \
	Index12Gray.c \
	AnyShort.c \
	Ushort555Rgb.c \
	Ushort565Rgb.c \
	Ushort4444Argb.c \
	Ushort555Rgbx.c \
	UshortGray.c \
	UshortIndexed.c \
	Any3Byte.c \
	ThreeByteBgr.c \
	AnyInt.c \
	IntArgb.c \
	IntArgbPre.c \
	IntArgbBm.c \
	IntRgb.c \
	IntBgr.c \
	IntRgbx.c \
	Any4Byte.c \
	FourByteAbgr.c \
	FourByteAbgrPre.c \
	BufferedMaskBlit.c \
	BufferedRenderPipe.c \
	ShapeSpanIterator.c \
	SpanClipRenderer.c \
	awt_ImageRep.c \
	awt_ImagingLib.c \
	awt_Mlib.c \
	awt_parseImage.c \
	DataBufferNative.c \
	dither.c \
	debug_assert.c \
	debug_mem.c \
	debug_trace.c \
	debug_util.c

557
ifneq (,$(filter $(OPENJDK_TARGET_OS), solaris linux))
558 559 560 561
	LIBAWT_FILES += awt_LoadLibrary.c initIDs.c img_colors.c
endif

ifeq ($(OPENJDK_TARGET_OS),macosx)
562
	LIBAWT_FILES += awt_LoadLibrary.c img_colors.c
563 564 565 566 567 568 569 570 571 572
	LIBAWT_DIRS += $(JDK_TOPDIR)/src/macosx/native/com/apple/resources
	LIBAWT_FILES += awt_LoadLibrary.c MacOSXResourceBundle.m
	LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks

	LIBAWT_MacOSXResourceBundle.m_CFLAGS:=-O0
endif

ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
        LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
        LIBAWT_CFLAGS += -xarch=sparcvis
573
	LIBAWT_CFLAGS += $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(OPENJDK_TARGET_CPU_BITS).il
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
        LIBAWT_CFLAGS += \
            -I$(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib \
            -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d/medialib \
            -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d/loops

	LIBAWT_DIRS += $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib \
                       $(JDK_TOPDIR)/src/solaris/native/sun/java2d/loops

	LIBAWT_FILES += \
                vis_FuncArray.c           \
                java2d_Mlib.c             \
                mlib_ImageCreate.c        \
                mlib_ImageZoom_NN.c       \
                mlib_ImageCopy_Bit.c      \
                mlib_sys.c                \
                mlib_v_ImageClear.c       \
                mlib_v_ImageClear_f.c     \
                mlib_v_ImageConstXor.c    \
                mlib_v_ImageCopy.c        \
                mlib_v_ImageCopy_f.c      \
                mlib_v_ImageXor.c         \
                mlib_v_ImageZoom_NN_f.c   \
                vis_Interp.c              \
                vis_AlphaMacros.c         \
                vis_AlphaMaskBlit.c       \
                vis_AlphaMaskFill.c       \
                vis_ByteGray.c            \
                vis_ByteGray_FromRgb.c    \
                vis_ByteGray_Mask.c       \
                vis_ByteIndexed.c         \
                vis_DrawLine.c            \
                vis_FourByteAbgr.c        \
                vis_IntArgb.c             \
                vis_IntArgbPre.c          \
                vis_IntArgbPre_Mask.c     \
                vis_IntBgr.c              \
                vis_IntRgb.c              \
                vis_IntRgbx.c             \
                vis_SrcMaskFill.c         \
                vis_SrcOverMaskBlit.c     \
                vis_SrcOverMaskFill.c     \
                vis_FourByteAbgrPre.c     \
                vis_GlyphList.c           \
                vis_GlyphListXor.c        \
                vis_IntArgbBm.c           \
                vis_ThreeByteBgr.c        \
                vis_UshortGray.c          \
                vis_UshortGray_FromRgb.c  \
                vis_XorBlit.c             \
                mlib_v_ImageCopy_blk.s

625
	ifeq ($(OPENJDK_TARGET_CPU),sparcv9)
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
		LIBAWT_ASFLAGS=-P -xarch=v9a
	else
		LIBAWT_ASFLAGS=-P -xarch=v8plusa
	endif
else
	LIBAWT_FILES += MapAccelFunc.c
endif

ifneq ($(OPENJDK_TARGET_OS),solaris)
	LIBAWT_CFLAGS += -DMLIB_NO_LIBSUNMATH
endif

LIBAWT_LANG:=C

ifeq ($(OPENJDK_TARGET_OS),windows)
	LIBAWT_FILES += AccelGlyphCache.c \
			ShaderList.c \
			CmdIDList.cpp \
			Hashtable.cpp \
			GDIHashtable.cpp \
			Devices.cpp \
			ObjectList.cpp \
			GDIBlitLoops.cpp \
			GDIRenderer.cpp \
			GDIWindowSurfaceData.cpp \
			WindowsFlags.cpp \
			WPrinterJob.cpp \
			awt_%.cpp \
			D3DBlitLoops.cpp \
			D3DBufImgOps.cpp \
			D3DContext.cpp \
			D3DGlyphCache.cpp \
			D3DGraphicsDevice.cpp \
			D3DMaskBlit.cpp \
			D3DMaskCache.cpp \
			D3DMaskFill.cpp \
			D3DPipelineManager.cpp \
			D3DPaints.cpp \
			D3DRenderer.cpp \
			D3DRenderQueue.cpp \
			D3DResourceManager.cpp \
			D3DSurfaceData.cpp \
			D3DTextRenderer.cpp \
			D3DVertexCacher.cpp \
			ShellFolder2.cpp \
			ThemeReader.cpp \
			ComCtl32Util.cpp \
			DllUtil.cpp \
			initIDs.cpp \
			MouseInfo.cpp \
O
ohair 已提交
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690
			rect.c \
			OGLBlitLoops.c \
			OGLBufImgOps.c \
		        OGLContext.c \
		        OGLFuncs.c \
		        OGLMaskBlit.c \
		        OGLMaskFill.c \
		        OGLPaints.c \
		        OGLRenderQueue.c \
		        OGLRenderer.c \
		        OGLSurfaceData.c \
		        OGLTextRenderer.c \
		        OGLVertexCache.c \
		        WGLGraphicsConfig.c \
		        WGLSurfaceData.c
691
	LIBAWT_LANG:=C++
692 693
	LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE
	ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724
		LIBAWT_CFLAGS += -DMLIB_OS64BIT
	endif

	ifdef OPENJDK
		LIBAWT_RC_FLAGS:=-i "$(JDK_TOPDIR)/src/windows/resource/icons"
	else
		LIBAWT_RC_FLAGS:=-i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
	endif
	LIBAWT_VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/native/sun/windows/awt.rc
endif

ifeq ($(MILESTONE), internal)
	LIBAWT_CFLAGS += -DINTERNAL_BUILD
endif

LIBAWT_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt/mapfile-vers
ifeq ($(OPENJDK_TARGET_OS),linux)
	LIBAWT_MAPFILE:=
endif

$(eval $(call SetupNativeCompilation,BUILD_LIBAWT,\
		LIBRARY:=awt,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
		SRC:=$(LIBAWT_DIRS),\
		INCLUDE_FILES:=$(LIBAWT_FILES),\
		LANG:=$(LIBAWT_LANG),\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS),\
		ASFLAGS:=$(LIBAWT_ASFLAGS),\
		MAPFILE:=$(LIBAWT_MAPFILE), \
		LDFLAGS:=$(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN),\
725 726
		LDFLAGS_solaris:=-R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR),\
		LDFLAGS_SUFFIX_linux:=-ljvm $(LIBM) $(LIBDL) -ljava,\
727
		LDFLAGS_SUFFIX_solaris:=-ljvm $(LIBM) $(LIBDL) -ljava -lc,\
728 729 730 731 732 733 734 735 736
		LDFLAGS_SUFFIX_macosx:=-lmlib_image -ljvm $(LIBM) \
				       -framework Cocoa \
				       -framework OpenGL \
				       -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
				       -framework JavaNativeFoundation \
				       -framework JavaRuntimeSupport \
				       -framework ApplicationServices \
				       -framework AudioToolbox \
				       -ljava,\
O
ohair 已提交
737 738 739 740 741 742 743 744 745
		LDFLAGS_SUFFIX_windows:=kernel32.lib user32.lib gdi32.lib winspool.lib \
					imm32.lib ole32.lib uuid.lib shell32.lib \
					comdlg32.lib winmm.lib comctl32.lib shlwapi.lib \
					delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib \
					-DELAYLOAD:user32.dll -DELAYLOAD:gdi32.dll \
					-DELAYLOAD:shell32.dll -DELAYLOAD:winmm.dll \
					-DELAYLOAD:winspool.drv -DELAYLOAD:imm32.dll \
					-DELAYLOAD:ole32.dll -DELAYLOAD:comdlg32.dll \
					-DELAYLOAD:comctl32.dll -DELAYLOAD:shlwapi.dll,\
746 747
		VERSIONINFO_RESOURCE:=$(LIBAWT_VERSIONINFO_RESOURCE),\
		RC_FLAGS:=$(RC_FLAGS) $(LIBAWT_RC_FLAGS) \
O
ohair 已提交
748 749 750
			  -D "JDK_FNAME=awt.dll" \
			  -D "JDK_INTERNAL_NAME=awt" \
			  -D "JDK_FTYPE=0x2L",\
751
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt,\
752
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778

$(BUILD_LIBAWT) : $(BUILD_LIBJAVA)

ifeq ($(OPENJDK_TARGET_OS), macosx)
$(BUILD_LIBAWT) : $(BUILD_LIBMLIB_IMAGE)
endif

BUILD_LIBRARIES += $(BUILD_LIBAWT)

##########################################################################################

# TODO!!
# Even though this variable as a general name, it is
# only used on macos, in fontpath.c, as prefix for where to find fonts.
#
# It's used for libawt_headless _and_ libawt_xawt
#
X11_PATH:=/usr/X11R6

ifneq ($(OPENJDK_TARGET_OS), windows)
ifndef BUILD_HEADLESS_ONLY

LIBAWT_XAWT_DIRS:=\
		$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
		$(JDK_TOPDIR)/src/share/native/sun/awt/utility \
		$(JDK_TOPDIR)/src/share/native/sun/font \
779
		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font \
780
		$(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
781 782 783 784
		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/opengl \
		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11 \
		$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/xawt \
785 786 787 788 789 790

LIBAWT_XAWT_CFLAGS:=-DXAWT -DXAWT_HACK \
        -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
	$(CUPS_CFLAGS) \
	$(foreach dir,$(LIBAWT_XAWT_DIRS),-I$(dir)) \
	-I$(JDK_TOPDIR)/src/share/native/sun/java2d \
791
	-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
792 793 794 795 796
	-I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
	-I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
	-I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
	-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
	-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
797
	-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga
798 799 800

ifeq ($(OPENJDK_TARGET_OS),solaris)
	LIBAWT_XAWT_CFLAGS += -DFUNCPROTO=15
801 802
endif

803 804 805 806 807 808 809 810 811 812
ifeq ($(OPENJDK_TARGET_OS),linux)
ifndef OPENJDK
include $(JDK_TOPDIR)/make/closed/xawt.gmk
endif

ifeq ($(DISABLE_XRENDER),true)
	LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true
endif
endif

813 814 815
ifeq ($(MILESTONE),internal)
	LIBAWT_XAWT_CFLAGS += -DINTERNAL_BUILD
endif
816

817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865
LIBAWT_XAWT_FILES:=\
	XlibWrapper.c \
	XWindow.c \
	XToolkit.c \
	X11Color.c \
	X11SurfaceData.c \
	awt_GraphicsEnv.c \
	awt_InputMethod.c \
	robot_common.c \
	awt_Robot.c \
        list.c \
        multiVis.c \
	initIDs.c \
	awt_util.c \
	awt_Desktop.c \
	awt_UNIXToolkit.c \
	X11FontScaler_md.c \
	X11TextRenderer_md.c \
	fontpath.c \
	awt_Insets.c \
	awt_Event.c \
	X11Renderer.c \
	X11PMBlitLoops.c \
	OGLBlitLoops.c \
	OGLBufImgOps.c \
	OGLContext.c \
	OGLFuncs.c \
	OGLMaskBlit.c \
	OGLMaskFill.c \
	OGLPaints.c \
	OGLRenderQueue.c \
	OGLRenderer.c \
	OGLSurfaceData.c \
	OGLTextRenderer.c \
	OGLVertexCache.c \
	GLXGraphicsConfig.c \
	GLXSurfaceData.c \
	AccelGlyphCache.c \
	awt_Font.c \
	multi_font.c \
	awt_AWTEvent.c \
	awt_DrawingSurface.c \
	jawt.c \
	CUPSfuncs.c \
	debug_assert.c \
	debug_mem.c \
	debug_trace.c \
	debug_util.c \
	awt_Plugin.c \
866
        gnome_interface.c \
867 868 869 870 871 872 873
	gtk2_interface.c \
        swing_GTKEngine.c \
        swing_GTKStyle.c \
        rect.c \
	sun_awt_X11_GtkFileDialogPeer.c \
	XRSurfaceData.c \
	XRBackendNative.c
874

875 876 877
LIBAWT_XAWT_LDFLAGS_SUFFIX:=$(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi  -ljava -ljvm -lc

ifeq ($(OPENJDK_TARGET_OS), linux)
878 879
        # To match old build, add this to LDFLAGS instead of suffix.
	LIBAWT_XAWT_LDFLAGS += -lpthread
880 881 882 883 884 885
endif

ifeq ($(OPENJDK_TARGET_OS), macosx)
	LIBAWT_XAWT_LDFLAGS_SUFFIX += -lpthread
endif

886
# On macosx, the shared library origin is set twice for this lib.
887 888 889 890 891 892 893 894 895 896 897
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT,\
		LIBRARY:=awt_xawt,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
		SRC:=$(LIBAWT_XAWT_DIRS),\
		INCLUDE_FILES:=$(LIBAWT_XAWT_FILES),\
		LANG:=C,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
                        $(X_CFLAGS),\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_xawt/mapfile-vers, \
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
898 899 900 901 902 903 904 905 906 907 908 909 910 911
			 $(X_LIBS) $(LIBAWT_XAWT_LDFLAGS),\
		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN) \
			       $(call SET_SHARED_LIBRARY_ORIGIN,/..),\
		LDFLAGS_solaris:=-L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
				 -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
				 -R$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
				 -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
				 -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
			 	 $(call SET_SHARED_LIBRARY_ORIGIN) \
			 	 $(call SET_SHARED_LIBRARY_ORIGIN,/..),\
		LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_ORIGIN) \
				$(call SET_SHARED_LIBRARY_ORIGIN). \
				$(call SET_SHARED_LIBRARY_ORIGIN) \
				$(call SET_SHARED_LIBRARY_ORIGIN).,\
912
		LDFLAGS_SUFFIX:=$(LIBAWT_XAWT_LDFLAGS_SUFFIX),\
913 914
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
915 916 917
			  -D "JDK_FNAME=xawt.dll" \
			  -D "JDK_INTERNAL_NAME=xawt" \
			  -D "JDK_FTYPE=0x2L",\
918 919
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_xawt,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
920 921 922 923 924 925 926 927

$(BUILD_LIBAWT_XAWT) : $(BUILD_LIBJAVA)

$(BUILD_LIBAWT_XAWT) : $(BUILD_LIBAWT)

BUILD_LIBRARIES += $(BUILD_LIBAWT_XAWT)

endif
928 929 930 931
endif

##########################################################################################

932
BUILD_LIBZIP_EXCLUDES :=
933
ifeq ($(USE_EXTERNAL_LIBZ),true)
934 935
    LIBZ := -lz
    LIBZIP_EXCLUDES += zlib-1.2.5
936
else
937 938 939 940
    ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
endif

BUILD_LIBZIP_REORDER :=
941
ifeq ($(OPENJDK_TARGET_OS), solaris)
942
    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
943
        BUILD_LIBZIP_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
944 945 946 947
    endif
endif

ifeq ($(LIBZIP_CAN_USE_MMAP), true)
948
     BUILD_LIBZIP_MMAP := -DUSE_MMAP
949 950
endif

951
$(eval $(call SetupNativeCompilation,BUILD_LIBZIP,\
952 953
                LIBRARY:=zip,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
954
		LANG:=C,\
955
		OPTIMIZATION:=LOW, \
956 957
		SRC:=$(JDK_TOPDIR)/src/share/native/java/util/zip,\
		EXCLUDES:=$(LIBZIP_EXCLUDES),\
958
		CFLAGS:=$(CFLAGS_JDKLIB) \
959
                        $(ZLIB_CPPFLAGS) \
960
		        -I$(JDK_TOPDIR)/src/share/native/java/io \
961
                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io,\
962 963 964
		CFLAGS_posix:=$(BUILD_LIBZIP_MMAP) -UDEBUG,\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libzip/mapfile-vers, \
		REORDER:=$(BUILD_LIBZIP_REORDER), \
965
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
966
			 $(call SET_SHARED_LIBRARY_ORIGIN) \
967
			 $(EXPORT_ZIP_FUNCS), \
968
		LDFLAGS_windows:=-export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
969
                                -export:ZIP_ReadEntry -export:ZIP_GetNextEntry jvm.lib \
970
                                $(WIN_JAVA_LIB),\
971
		LDFLAGS_SUFFIX_linux:=-ljvm -ljava $(LIBZ),\
972
		LDFLAGS_SUFFIX_solaris:=-ljvm -ljava $(LIBZ) -lc,\
973 974 975
		LDFLAGS_SUFFIX_macosx:=$(LIBZ) -ljava -ljvm,\
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
976 977 978
			  -D "JDK_FNAME=zip.dll" \
			  -D "JDK_INTERNAL_NAME=zip" \
			  -D "JDK_FTYPE=0x2L",\
979
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libzip,\
980
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
981

982
$(BUILD_LIBZIP) : $(BUILD_LIBJAVA)
983

984
BUILD_LIBRARIES += $(BUILD_LIBZIP)
985 986 987 988

##########################################################################################

$(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK,\
989 990
		LIBRARY:=unpack, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
991 992 993
                SRC:=$(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack,\
		EXCLUDE_FILES:=main.cpp,\
		LANG:=C++,\
994 995
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CXXFLAGS_JDKLIB) \
996 997
			 -DNO_ZLIB -DUNPACK_JNI -DFULL,\
		CFLAGS_release:=-DPRODUCT,\
998
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers, \
999
		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
1000
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
O
ohair 已提交
1001
		LDFLAGS_windows:=-map:$(JDK_OUTPUTDIR)/objs/unpack.map -debug \
1002
				jvm.lib $(WIN_JAVA_LIB),\
1003
		LDFLAGS_SUFFIX_posix:=-ljvm $(LIBCXX) -ljava -lc,\
1004
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libunpack,\
1005 1006
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1007 1008 1009
			  -D "JDK_FNAME=unpack.dll" \
			  -D "JDK_INTERNAL_NAME=unpack" \
			  -D "JDK_FTYPE=0x2L",\
1010
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1011

1012
$(BUILD_LIBUNPACK) : $(BUILD_LIBJAVA)
1013

1014
BUILD_LIBRARIES += $(BUILD_LIBUNPACK)
1015

1016
ifeq ($(OPENJDK_TARGET_OS),windows)
1017
    $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.map: $(BUILD_LIBUNPACK)
1018
	$(ECHO) Copying $(@F)
1019 1020
	$(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX),%.map,$<) $@

1021
    $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.pdb: $(BUILD_LIBUNPACK)
1022
	$(ECHO) Copying $(@F)
1023 1024 1025 1026 1027 1028
	$(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX),%.pdb,$<) $@
endif

##########################################################################################

LIBATTACH_EXCLUDE_FILES:=
1029
ifneq ($(OPENJDK_TARGET_OS),solaris)
1030 1031
    LIBATTACH_EXCLUDE_FILES+=SolarisVirtualMachine.c
endif
1032
ifneq ($(OPENJDK_TARGET_OS),linux)
1033 1034
    LIBATTACH_EXCLUDE_FILES+=LinuxVirtualMachine.c
endif
1035
ifneq ($(OPENJDK_TARGET_OS),macosx)
1036 1037 1038 1039
    LIBATTACH_EXCLUDE_FILES+=BsdVirtualMachine.c
endif

$(eval $(call SetupNativeCompilation,BUILD_LIBATTACH,\
1040 1041
		LIBRARY:=attach, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1042
                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tools/attach,\
1043 1044
		EXCLUDE_FILES:=$(LIBATTACH_EXCLUDE_FILES),\
		LANG:=C,\
1045 1046
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB),\
1047
		CFLAGS_windows:=/Gy,\
1048
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \
1049 1050
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS) \
O
ohair 已提交
1051 1052 1053
			  -D "JDK_FNAME=attach.dll" \
			  -D "JDK_INTERNAL_NAME=attach" \
			  -D "JDK_FTYPE=0x2L",\
1054 1055 1056
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
		LDFLAGS_solaris:=-ldoor,\
1057
		LDFLAGS_windows:=/ORDER:@$(JDK_TOPDIR)/makefiles/mapfiles/libattach/reorder-windows-$(OPENJDK_TARGET_CPU),\
1058
		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
O
ohair 已提交
1059
		LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib psapi.lib,\
1060 1061
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libattach,\
		DEBUG_SYMBOLS:=true))
1062

1063
$(BUILD_LIBATTACH) : $(BUILD_LIBJAVA)
1064

1065
BUILD_LIBRARIES += $(BUILD_LIBATTACH)
1066 1067 1068 1069

##########################################################################################

$(eval $(call SetupNativeCompilation,BUILD_LIBDT_SOCKET,\
1070 1071
		LIBRARY:=dt_socket,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1072
                SRC:=$(JDK_TOPDIR)/src/share/transport/socket \
1073
			$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket,\
1074
		LANG:=C,\
1075 1076 1077
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) -DUSE_MMAP \
                        -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
1078
                        -I$(JDK_TOPDIR)/src/share/transport/socket \
1079
		        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket \
1080 1081
                        -I$(JDK_TOPDIR)/src/share/back/export \
                        -I$(JDK_TOPDIR)/src/share/back,\
1082
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libdt_socket/mapfile-vers, \
1083 1084 1085
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN), \
		LDFLAGS_SUFFIX_linux:=-lpthread,\
1086
		LDFLAGS_SUFFIX_solaris:=-lnsl -lsocket -lc,\
1087 1088 1089
		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX) -export:jdwpTransport_OnLoad ws2_32.lib,\
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1090 1091 1092
			  -D "JDK_FNAME=dt_socket.dll" \
			  -D "JDK_INTERNAL_NAME=dt_socket" \
			  -D "JDK_FTYPE=0x2L",\
1093 1094
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_socket,\
		DEBUG_SYMBOLS:=true))
1095

1096
$(BUILD_LIBDT_SOCKET) : $(BUILD_LIBJAVA)
1097

1098
BUILD_LIBRARIES += $(BUILD_LIBDT_SOCKET)
1099 1100 1101

##########################################################################################

1102
ifeq ($(OPENJDK_TARGET_OS),windows)
1103 1104

  $(eval $(call SetupNativeCompilation,BUILD_LIBDT_SHMEM,\
1105 1106 1107
		LIBRARY:=dt_shmem,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                SRC:=$(JDK_TOPDIR)/src/share/native/com/sun/tools/jdi \
1108
			$(JDK_TOPDIR)/src/share/transport/shmem \
1109
			$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem,\
1110
		LANG:=C,\
1111 1112 1113
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) -DUSE_MMAP\
                        -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
1114
                        -I$(JDK_TOPDIR)/src/share/transport/shmem \
1115
		        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem \
1116 1117
                        -I$(JDK_TOPDIR)/src/share/back/export, \
		LDFLAGS:=$(LDFLAGS_JDKLIB),\
1118
		LDFLAGS_windows:=-export:jdwpTransport_OnLoad,\
1119
		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
1120 1121
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1122 1123 1124
			  -D "JDK_FNAME=dt_shmem.dll" \
			  -D "JDK_INTERNAL_NAME=dt_shmem" \
			  -D "JDK_FTYPE=0x2L",\
1125
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdt_shmem,\
1126
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1127

1128
  BUILD_LIBRARIES += $(BUILD_LIBDT_SHMEM)
1129

1130
endif # OPENJDK_TARGET_OS
1131 1132

##########################################################################################
1133
# JDWP_LOGGING causes log messages to be compiled into the library.
1134
$(eval $(call SetupNativeCompilation,BUILD_LIBJDWP,\
1135 1136
		LIBRARY:=jdwp, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1137
                SRC:=$(JDK_TOPDIR)/src/share/back $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back,\
1138
		LANG:=C,\
1139 1140
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) -DJDWP_LOGGING\
1141 1142 1143
		 -I$(JDK_TOPDIR)/src/share/transport/export \
                 -I$(JDK_TOPDIR)/src/share/back/export \
                 -I$(JDK_TOPDIR)/src/share/npt \
1144
                 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
1145
                 -I$(JDK_TOPDIR)/src/share/back \
1146
                 -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back \
1147
		 -I$(JDK_OUTPUTDIR)/gensrc_jdwp_headers,\
1148
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjdwp/mapfile-vers, \
1149 1150 1151
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
		LDFLAGS_SUFFIX_linux:=$(LIBDL),\
1152
		LDFLAGS_SUFFIX_solaris:=$(LIBDL) -lc,\
1153
		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX),\
1154 1155
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1156 1157 1158
			  -D "JDK_FNAME=jdwp.dll" \
			  -D "JDK_INTERNAL_NAME=jdwp" \
			  -D "JDK_FTYPE=0x2L",\
1159
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjdwp,\
1160
		DEBUG_SYMBOLS:=true))
1161

1162
$(BUILD_LIBJDWP) : $(BUILD_LIBJAVA)
1163

1164
BUILD_LIBRARIES += $(BUILD_LIBJDWP)
1165 1166 1167

##########################################################################################

1168 1169
LIBJAAS_MAPFILE:=
ifneq ($(OPENJDK_TARGET_OS),solaris)
1170
   LIBJAAS_EXCLUDE_FILES:=Solaris.c
1171 1172
else
   # only on solaris...wonder why
1173 1174 1175 1176 1177 1178
   LIBJAAS_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjaas/mapfile-vers
endif

LIBJAAS_NAME:=jaas_unix
ifeq ($(OPENJDK_TARGET_OS), windows)
     LIBJAAS_NAME:=jaas_nt
1179 1180 1181
endif

$(eval $(call SetupNativeCompilation,BUILD_LIBJAAS,\
1182 1183
		LIBRARY:=$(LIBJAAS_NAME),\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1184
                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/security/auth/module,\
1185
		LANG:=C,\
1186 1187 1188
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB),\
		MAPFILE:=$(LIBJAAS_MAPFILE),\
1189 1190
		LDFLAGS:=$(filter-out -ljava,$(LDFLAGS_JDKLIB)) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
1191
		LDFLAGS_windows:=netapi32.lib user32.lib mpr.lib advapi32.lib,\
1192
		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX),\
1193
		LDFLAGS_SUFFIX_solaris:=-lc,\
1194
		EXCLUDE_FILES:=$(LIBJAAS_EXCLUDE_FILES),\
1195 1196
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS) \
O
ohair 已提交
1197 1198 1199
			  -D "JDK_FNAME=$(LIBJAAS_NAME).dll" \
			  -D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
			  -D "JDK_FTYPE=0x2L",\
1200
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjaas,\
1201
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1202

1203
$(BUILD_LIBJAAS) : $(BUILD_LIBJAVA)
1204

1205
BUILD_LIBRARIES += $(BUILD_LIBJAAS)
1206 1207 1208 1209

##########################################################################################

$(eval $(call SetupNativeCompilation,BUILD_LIBJSDT,\
1210 1211
		LIBRARY:=jsdt,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1212
                SRC:=$(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace\
1213
			$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tracing/dtrace,\
1214
		LANG:=C,\
1215 1216
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB)\
1217
			-I$(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace,\
1218
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsdt/mapfile-vers, \
1219 1220
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
1221 1222
		LDFLAGS_SUFFIX_linux:=$(LIBDL),\
		LDFLAGS_SUFFIX_windows:=$(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL),\
1223
		LDFLAGS_SUFFIX_macosx:=                         $(LIBDL),\
1224
		LDFLAGS_SUFFIX_solaris:=-lc,\
1225 1226
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1227 1228 1229
			  -D "JDK_FNAME=jsdt.dll" \
			  -D "JDK_INTERNAL_NAME=jsdt" \
			  -D "JDK_FTYPE=0x2L",\
1230
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsdt, \
1231
                DEBUG_SYMBOLS:=true))
1232

1233
$(BUILD_LIBJSDT) : $(BUILD_LIBJAVA)
1234

1235
BUILD_LIBRARIES += $(BUILD_LIBJSDT)
1236 1237 1238 1239 1240

##########################################################################################

    # TODO: Update awt lib path when awt is converted
    $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS,\
1241 1242
                LIBRARY:=lcms,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1243
                SRC:=$(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms,\
1244
		LANG:=C,\
1245
		OPTIMIZATION:=HIGHEST, \
1246
		CFLAGS:=$(filter-out -xc99=%none,$(CFLAGS_JDKLIB)) \
1247 1248 1249 1250
			$(SHARED_LIBRARY_FLAGS) \
			-I$(JDK_TOPDIR)/src/share/native/sun/java2d \
			-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug,\
		CFLAGS_solaris:=-xc99=no_lib,\
1251
		CFLAGS_windows:=-DCMS_IS_WINDOWS_,\
1252
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/liblcms/mapfile-vers, \
1253 1254 1255 1256
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
                         $(call SET_SHARED_LIBRARY_ORIGIN), \
		LDFLAGS_solaris:=/usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2,\
		LDFLAGS_windows:=$(WIN_AWT_LIB) $(WIN_JAVA_LIB),\
1257
		LDFLAGS_SUFFIX_solaris:=-lawt -ljava -ljvm -lc,\
1258 1259 1260 1261
		LDFLAGS_SUFFIX_macosx:=$(LIBM) -lawt -ljava -ljvm,\
		LDFLAGS_SUFFIX_linux:=-lm -lawt -ljava -ljvm,\
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1262 1263 1264 1265
			  -D "JDK_FNAME=lcms.dll" \
			  -D "JDK_INTERNAL_NAME=lcms" \
			  -D "JDK_FTYPE=0x2L",\
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/liblcms,\
1266
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1267

1268
    BUILD_LIBRARIES += $(BUILD_LIBLCMS)
1269

1270
    $(BUILD_LIBLCMS) : $(BUILD_LIBAWT)
1271

1272
##########################################################################################
1273

1274 1275 1276 1277 1278 1279 1280
ifdef OPENJDK
    BUILD_LIBJPEG_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/mapfile-vers
else
    BUILD_LIBJPEG_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/mapfile-vers-closed
    BUILD_LIBJPEG_CLOSED_SRC:=$(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
    BUILD_LIBJPEG_CLOSED_INCLUDES:=-I$(BUILD_LIBJPEG_CLOSED_SRC)
endif
1281

1282 1283
BUILD_LIBJPEG_REORDER:=
ifeq ($(OPENJDK_TARGET_OS), solaris)
1284 1285
    ifneq ($(OPENJDK_TARGET_CPU), x86_64)
        BUILD_LIBJPEG_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
1286 1287
    endif
endif
1288

1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302
# Suppress gcc warnings like "variable might be clobbered by 'longjmp'
# or 'vfork'": this warning indicates that some variable is placed to
# a register by optimized compiler and it's value might be lost on longjmp().
# Recommended way to avoid such warning is to declare the variable as
# volatile to prevent the optimization. However, this approach does not
# work because we have to declare all variables as volatile in result.
#ifndef CROSS_COMPILE_ARCH
#    CC_43_OR_NEWER:=\
#        $(shell $(EXPR) $(CC_MAJORVER) \> 4 \| \
#              \( $(CC_MAJORVER) = 4 \& $(CC_MINORVER) \>= 3 \) )
#    ifeq ($(CC_43_OR_NEWER),1)
#        BUILD_LIBJPEG_CFLAGS_linux += -Wno-clobbered
#    endif
#endif
1303

1304 1305 1306 1307 1308
$(eval $(call SetupNativeCompilation,BUILD_LIBJPEG,\
                LIBRARY:=jpeg, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
                SRC:=$(BUILD_LIBJPEG_CLOSED_SRC) \
		     $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg,\
1309
		LANG:=C,\
1310 1311 1312 1313 1314
		OPTIMIZATION:=HIGHEST, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
			$(BUILD_LIBJPEG_CLOSED_INCLUDES) \
			-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg,\
		MAPFILE:=$(BUILD_LIBJPEG_MAPFILE), \
1315 1316
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
1317
		LDFLAGS_windows:=$(WIN_JAVA_LIB) jvm.lib,\
1318
		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
1319 1320
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1321 1322 1323
			  -D "JDK_FNAME=jpeg.dll" \
			  -D "JDK_INTERNAL_NAME=jpeg" \
			  -D "JDK_FTYPE=0x2L",\
1324
		REORDER:=$(BUILD_LIBJPEG_REORDER),\
1325
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjpeg,\
1326
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1327

1328
$(BUILD_LIBJPEG) : $(BUILD_LIBJAVA)
1329

1330
BUILD_LIBRARIES += $(BUILD_LIBJPEG)
1331 1332 1333

##########################################################################################

1334
ifndef OPENJDK
O
ohair 已提交
1335
    FONT_HEADERS:=-I$(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k
1336
    BUILD_LIBFONTMANAGER_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libfontmanager/mapfile-vers
1337 1338
    LIBFONTMANAGER_EXCLUDE_FILES += freetypeScaler.c
else
1339 1340 1341
    FONT_HEADERS:=$(FREETYPE2_CFLAGS)
    BUILD_LIBFONTMANAGER_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libfontmanager/mapfile-vers.openjdk
    BUILD_LIBFONTMANAGER_FONTLIB:=$(FREETYPE2_LIBS)
1342 1343
endif

1344
LIBFONTMANAGER_OPTIMIZATION:=HIGH
1345 1346

ifeq ($(OPENJDK_TARGET_OS),windows)
1347 1348
    LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
				    X11TextRenderer.c
1349
LIBFONTMANAGER_OPTIMIZATION:=HIGHEST
1350 1351 1352 1353 1354
else
    LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
				    lcdglyph.c
endif

1355 1356
BUILD_LIBFONTMANAGER_CFLAGS_COMMON:=\
			$(X_CFLAGS) \
1357 1358 1359 1360 1361
			-DLE_STANDALONE -DHEADLESS \
			$(FONT_HEADERS) \
			-I$(JDK_TOPDIR)/src/share/native/sun/font \
			-I$(JDK_TOPDIR)/src/share/native/sun/font/layout \
			-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
1362
			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
1363 1364 1365
			-I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
			-I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
			-I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
1366
			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
1367 1368
			-I$(JDK_TOPDIR)/src/share/native/sun/java2d

1369 1370 1371 1372 1373
# Turn off aliasing with GCC for ExtensionSubtables.cpp
ifeq ($(OPENJDK_TARGET_OS), linux)
    BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS:=-fno-strict-aliasing
endif

1374
$(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER,\
1375 1376
		LIBRARY:=fontmanager, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1377
                SRC:=$(JDK_TOPDIR)/src/share/native/sun/font\
1378
		     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font,\
1379 1380 1381 1382 1383
		EXCLUDE_FILES:=$(LIBFONTMANAGER_EXCLUDE_FILES) \
			       AccelGlyphCache.c,\
		LANG:=C++,\
		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON),\
		CXXFLAGS:=$(CXXFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON),\
1384
		OPTIMIZATION:=$(LIBFONTMANAGER_OPTIMIZATION), \
1385
		CFLAGS_windows= -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
1386
				-DCC_NOEX, \
1387
		MAPFILE:=$(BUILD_LIBFONTMANAGER_MAPFILE), \
1388
		LDFLAGS:=$(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
1389
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
1390 1391 1392
		LDFLAGS_SUFFIX:=$(BUILD_LIBFONTMANAGER_FONTLIB),\
		LDFLAGS_SUFFIX_linux:=-lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc,\
		LDFLAGS_SUFFIX_solaris:=-lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm,\
O
ohair 已提交
1393 1394 1395 1396
		LDFLAGS_SUFFIX_macosx:=-lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \
				       -ljava -ljvm,\
		LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
					$(WIN_AWT_LIB),\
1397 1398
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1399 1400 1401
			  -D "JDK_FNAME=fontmanager.dll" \
			  -D "JDK_INTERNAL_NAME=fontmanager" \
			  -D "JDK_FTYPE=0x2L",\
1402
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libfontmanager,\
1403
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1404

1405
$(BUILD_LIBFONTMANAGER) : $(BUILD_LIBAWT)
1406

1407 1408
ifneq (,$(findstring $(OPENJDK_TARGET_OS),solaris macosx))
$(BUILD_LIBFONTMANAGER) : $(BUILD_LIBAWT_XAWT)
1409
endif
1410

1411
BUILD_LIBRARIES += $(BUILD_LIBFONTMANAGER)
1412 1413 1414 1415 1416

##########################################################################################

ifndef OPENJDK

1417
#    ifeq ($(OPENJDK_TARGET_OS), linux)
1418 1419
#        ifeq ("$(CC_VER_MAJOR)", "3")
#            OTHER_LDLIBS  += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic
1420
#        endif
1421 1422
#    endif
#
1423
# The resulting size of the t2k lib file is (at least on linux) dependant on the order of
1424 1425 1426 1427 1428
# the input .o files. Because of this the new build will differ in size to the old build.
    BUILD_LIBT2K_CFLAGS_COMMON:=-I$(JDK_TOPDIR)/src/share/native/sun/font \
		            -I$(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k \
		            -I$(JDK_TOPDIR)/src/closed/share/native/sun/font \
		            -I$(JDK_TOPDIR)/src/share/share/native/sun/font \
1429
		            -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font \
1430 1431
		            -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
		            -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
1432
		            -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
1433 1434 1435
		            -I$(JDK_TOPDIR)/src/share/native/sun/java2d

    $(eval $(call SetupNativeCompilation,BUILD_LIBT2K,\
1436 1437
                LIBRARY:=t2k, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1438 1439 1440 1441 1442
                SRC:=$(JDK_TOPDIR)/src/closed/share/native/sun/font \
		     $(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k \
		     $(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k/ttHints,\
		EXCLUDE_FILES:=orion.c,\
		LANG:=C++,\
1443 1444 1445
		OPTIMIZATION:=HIGH, \
		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBT2K_CFLAGS_COMMON),\
		CXXFLAGS:=$(CXXFLAGS_JDKLIB) $(BUILD_LIBT2K_CFLAGS_COMMON),\
1446 1447
		CFLAGS_windows=-DCC_NOEX, \
		CXXFLAGS_windows=-DCC_NOEX, \
1448
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libt2k/mapfile-vers, \
1449
		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
1450
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
1451
		LDFLAGS_windows:=user32.lib $(JDK_OUTPUTDIR)/objs/libfontmanager/fontmanager.lib,\
1452 1453 1454 1455
		LDFLAGS_SUFFIX_posix:=$(LIBM) $(LIBCXX) -lfontmanager -ljava -ljvm -lc,\
		LDFLAGS_SUFFIX_solaris:=-lawt -lawt_xawt,\
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1456 1457 1458
			  -D "JDK_FNAME=t2k.dll" \
			  -D "JDK_INTERNAL_NAME=t2k" \
			  -D "JDK_FTYPE=0x2L",\
1459
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libt2k,\
1460
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1461 1462

    # t2k is linked against fontmanager
1463
    $(BUILD_LIBT2K) : $(BUILD_LIBFONTMANAGER)
1464

1465
    BUILD_LIBRARIES += $(BUILD_LIBT2K)
1466 1467 1468 1469
endif

##########################################################################################

1470
ifeq ($(OPENJDK_TARGET_OS), windows)
1471
    ifeq ($(OPENJDK_TARGET_CPU), x86)
1472
        KERNEL32_LIB:=kernel32.lib
1473 1474
    endif
    $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT,\
1475 1476
                LIBRARY:=jawt, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1477
                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows,\
1478 1479
		INCLUDE_FILES:=jawt.cpp,\
		LANG:=C++,\
1480 1481
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CXXFLAGS_JDKLIB) \
1482
			-EHsc -DUNICODE -D_UNICODE \
1483
			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
1484 1485 1486
		        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
		        -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
			-I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
1487 1488
			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows \
			-I$(DXSDK_INCLUDE_PATH), \
1489
		LDFLAGS:=$(LDFLAGS_JDKLIB) $(KERNEL32_LIB) $(LDFLAGS_CXX_JDK) \
1490
			 advapi32.lib $(WIN_AWT_LIB),\
1491
		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
1492 1493
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1494 1495 1496
			  -D "JDK_FNAME=jawt.dll" \
			  -D "JDK_INTERNAL_NAME=jawt" \
			  -D "JDK_FTYPE=0x2L",\
1497
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt,\
1498
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1499

1500
$(BUILD_LIBJAWT) : $(BUILD_LIBAWT)
1501

1502
$(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
1503
	$(ECHO) Copying $(@F)
1504
	$(CP) $(JDK_OUTPUTDIR)/objs/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
1505 1506 1507

BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)

1508 1509 1510 1511 1512 1513
else # OPENJDK_TARGET_OS not windows

    JAWT_LIBS:=
    ifneq ($(OPENJDK_TARGET_OS), solaris)
        JAWT_LIBS += -lawt
    endif
1514 1515

    ifndef BUILD_HEADLESS_ONLY
1516
        JAWT_LIBS += -lawt_xawt
1517
    else
1518
        JAWT_LIBS += -lawt_headless
1519 1520 1521
        HEADLESS_CFLAG += -DHEADLESS
    endif

1522 1523 1524 1525
    JAWT_FILES:=jawt.c
    ifeq ($(OPENJDK_TARGET_OS), macosx)
	JAWT_FILES:=jawt.m
	JAWT_LIBS:=-lawt_lwawt
1526 1527
    endif

1528
    $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT,\
1529 1530
                LIBRARY:=jawt, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1531
                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
1532 1533
                     $(JDK_TOPDIR)/src/macosx/native/sun/awt,\
		INCLUDE_FILES:=$(JAWT_FILES),\
1534
		LANG:=C,\
1535 1536
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB), \
1537
		CFLAGS_linux:=$(HEADLESS_CFLAG),\
1538 1539
		CFLAGS_macosx:=-I$(JDK_TOPDIR)/src/solaris/native/sun/awt ,\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjawt/mapfile-vers, \
1540 1541
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
1542 1543 1544 1545 1546
		LDFLAGS_solaris:=-L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR),\
		LDFLAGS_SUFFIX_linux:=$(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX),\
		LDFLAGS_SUFFIX_solaris:=$(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender,\
		LDFLAGS_SUFFIX_macosx:=-Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
				       -framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX),\
1547 1548
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawt,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1549 1550

ifndef BUILD_HEADLESS_ONLY
1551
$(BUILD_LIBJAWT) : $(BUILD_LIBAWT_XAWT)
1552
else
1553
$(BUILD_LIBJAWT) : $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
1554 1555
endif

1556 1557
ifeq ($(OPENJDK_TARGET_OS),macosx)
$(BUILD_LIBJAWT) : $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX)
1558 1559
endif

1560
endif # OPENJDK_TARGET_OS
1561

1562
BUILD_LIBRARIES += $(BUILD_LIBJAWT)
1563 1564 1565

##########################################################################################

1566 1567 1568
LIBINSTRUMENT_SRC   :=$(JDK_TOPDIR)/src/share/instrument \
                      $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
                      $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument
1569

1570
LIBINSTRUMENT_FILES :=\
1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584
	EncodingSupport.c \
	EncodingSupport_md.c \
	FileSystemSupport_md.c \
	InstrumentationImplNativeMethods.c \
	InvocationAdapter.c \
	JarFacade.c \
	JPLISAgent.c \
	JPLISAssert.c \
	JavaExceptions.c \
	PathCharsValidator.c \
	Reentrancy.c \
	Utilities.c \
	canonicalize_md.c

1585 1586 1587 1588 1589
LIBINSTRUMENT_DIR   :=$(JDK_OUTPUTDIR)/objs/libinstrument
LIBINSTRUMENT_CFLAGS:=$(CFLAGS_JDKLIB) \
                      -I$(JDK_TOPDIR)/src/share/instrument \
                      -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument \
                      -I$(JDK_TOPDIR)/src/share/bin
1590

1591 1592
LIBINSTRUMENT_LDFLAGS:=
LIBINSTRUMENT_LDFLAGS_SUFFIX:=
1593

1594
ifeq ($(OPENJDK_TARGET_OS), windows)
1595 1596
    LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/jli_static.lib $(WIN_JAVA_LIB) \
				 -export:Agent_OnAttach advapi32.lib
1597 1598
    # Statically link the C runtime so that there are not dependencies on modules
    # not on the search patch when invoked from the Windows system directory
1599 1600 1601 1602
    # (or elsewhere).
    LIBINSTRUMENT_CFLAGS := $(filter-out -MD,$(LIBINSTRUMENT_CFLAGS))
    # equivalent of strcasecmp is stricmp on Windows
    LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
1603 1604 1605
endif

$(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT,\
1606 1607
		LIBRARY:=instrument, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1608 1609
		SRC:=$(LIBINSTRUMENT_SRC),\
		INCLUDE_FILES:=$(LIBINSTRUMENT_FILES),\
1610
		LANG:=C,\
1611
		OPTIMIZATION:=LOW, \
1612
		CFLAGS:=$(LIBINSTRUMENT_CFLAGS),\
1613 1614 1615
		CFLAGS_debug:=-DJPLIS_LOGGING,\
		CFLAGS_release:=-DNO_JPLIS_LOGGING,\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libinstrument/mapfile-vers, \
1616 1617 1618 1619 1620 1621 1622 1623 1624
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN) \
                         $(LIBINSTRUMENT_LDFLAGS),\
		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN,/jli),\
		LDFLAGS_solaris:= $(call SET_SHARED_LIBRARY_ORIGIN,/jli),\
		LDFLAGS_macosx:=-Xlinker -all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
				-framework Cocoa -framework Security -framework ApplicationServices,\
		LDFLAGS_SUFFIX:=$(LIBINSTRUMENT_LDFLAGS_SUFFIX),\
		LDFLAGS_SUFFIX_macosx:=-liconv $(LIBZ),\
1625
		LDFLAGS_SUFFIX_solaris:=$(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL) -lc,\
1626 1627 1628
		LDFLAGS_SUFFIX_linux:=$(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL),\
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1629 1630 1631
			  -D "JDK_FNAME=instrument.dll" \
			  -D "JDK_INTERNAL_NAME=instrument" \
			  -D "JDK_FTYPE=0x2L",\
1632
		OBJECT_DIR:=$(LIBINSTRUMENT_DIR),\
1633
		DEBUG_SYMBOLS:=true))
1634

1635 1636 1637 1638 1639 1640
ifneq (,$(findstring $(OPENJDK_TARGET_OS), macosx windows))
$(BUILD_LIBINSTRUMENT) : $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
else
$(BUILD_LIBINSTRUMENT) : $(INSTALL_LIBRARIES_HERE)/jli/$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX)
endif
$(BUILD_LIBINSTRUMENT) : $(BUILD_LIBJAVA)
1641

1642
BUILD_LIBRARIES += $(BUILD_LIBINSTRUMENT)
1643 1644 1645

##########################################################################################

1646
BUILD_LIBMANAGEMENT_SRC:=$(JDK_TOPDIR)/src/share/native/sun/management \
1647 1648
                           $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/management \
                           $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/management
1649

1650
BUILD_LIBMANAGEMENT_EXCLUDES:=
1651

1652
BUILD_LIBMANAGEMENT_CFLAGS:=-I$(JDK_TOPDIR)/src/share/native/sun/management
1653

1654
ifneq ($(OPENJDK_TARGET_OS), windows)
1655 1656 1657 1658 1659
	BUILD_LIBMANAGEMENT_EXCLUDES += OperatingSystem_md.c
else
	BUILD_LIBMANAGEMENT_EXCLUDES += UnixOperatingSystem_md.c
endif

1660
ifneq ($(OPENJDK_TARGET_OS),solaris)
1661 1662 1663
	BUILD_LIBMANAGEMENT_EXCLUDES += SolarisOperatingSystem.c
endif

1664
ifneq ($(OPENJDK_TARGET_OS),linux)
1665 1666 1667
	BUILD_LIBMANAGEMENT_EXCLUDES += LinuxOperatingSystem.c
endif

1668
ifneq ($(OPENJDK_TARGET_OS),macosx)
1669 1670 1671
	BUILD_LIBMANAGEMENT_EXCLUDES += MacosxOperatingSystem.c
endif

1672 1673
LIBMANAGEMENT_OPTIMIZATION:=HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
1674
    ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
1675 1676 1677
        LIBMANAGEMENT_OPTIMIZATION:=LOW
    endif
endif
1678 1679

$(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT,\
1680 1681
		LIBRARY:=management,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1682 1683 1684
		SRC:=$(BUILD_LIBMANAGEMENT_SRC),\
		EXCLUDE_FILES:=$(BUILD_LIBMANAGEMENT_EXCLUDES),\
		LANG:=C,\
1685
		OPTIMIZATION:=$(LIBMANAGEMENT_OPTIMIZATION), \
1686 1687
		CFLAGS:=$(CFLAGS_JDKLIB) $(BUILD_LIBMANAGEMENT_CFLAGS),\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libmanagement/mapfile-vers, \
1688 1689
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
1690
		LDFLAGS_solaris:=-lkstat,\
1691
		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX),\
O
ohair 已提交
1692
		LDFLAGS_SUFFIX_windows:=jvm.lib psapi.lib $(WIN_JAVA_LIB) advapi32.lib,\
1693 1694
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1695 1696 1697
			  -D "JDK_FNAME=management.dll" \
			  -D "JDK_INTERNAL_NAME=management" \
			  -D "JDK_FTYPE=0x2L",\
1698 1699
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libmanagement,\
		DEBUG_SYMBOLS:=true))
1700

1701
$(BUILD_LIBMANAGEMENT) : $(BUILD_LIBJAVA)
1702

1703
BUILD_LIBRARIES += $(BUILD_LIBMANAGEMENT)
1704 1705 1706

##########################################################################################

1707
BUILD_LIBHPROF_SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/hprof $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/demo/jvmti/hprof
1708
BUILD_LIBHPROF_CFLAGS:=-I$(JDK_TOPDIR)/src/share/demo/jvmti/hprof \
1709
                         -I$(JDK_TOPDIR)/src/share/npt \
1710
                         -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
1711 1712
                         -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo

1713
BUILD_LIBHPROF_LDFLAGS:=
1714

1715 1716
LIBHPROF_OPTIMIZATION:=HIGHEST
ifneq ($(findstring $(OPENJDK_TARGET_OS),solaris linux),)
1717
    ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
1718 1719 1720 1721
        LIBHPROF_OPTIMIZATION:=LOW
    endif
endif

1722
$(eval $(call SetupNativeCompilation,BUILD_LIBHPROF,\
1723 1724
		LIBRARY:=hprof, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1725 1726
		SRC:=$(BUILD_LIBHPROF_SRC),\
		LANG:=C,\
1727
		OPTIMIZATION:=$(LIBHPROF_OPTIMIZATION), \
1728
		CFLAGS:=$(CFLAGS_JDKLIB) \
1729
                         $(BUILD_LIBHPROF_CFLAGS),\
1730 1731
		CFLAGS_debug:=-DHPROF_LOGGING,\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libhprof/mapfile-vers, \
1732 1733 1734
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
		LDFLAGS_windows:=wsock32.lib winmm.lib advapi32.lib,\
1735 1736 1737
		LDFLAGS_SUFFIX_linux:=$(LIBDL),\
		LDFLAGS_SUFFIX_macosx:=$(LIBDL),\
		LDFLAGS_SUFFIX_solaris:=-lsocket -lnsl $(LIBDL) -lc,\
1738 1739
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1740 1741 1742
			  -D "JDK_FNAME=hprof.dll" \
			  -D "JDK_INTERNAL_NAME=hprof" \
			  -D "JDK_FTYPE=0x2L",\
1743 1744
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libhprof_jvmti,\
		DEBUG_SYMBOLS:=true))
1745

1746
BUILD_LIBRARIES += $(BUILD_LIBHPROF)
1747 1748 1749 1750

##########################################################################################

$(eval $(call SetupNativeCompilation,BUILD_LIBJAVA_CRW_DEMO,\
1751 1752
		LIBRARY:=java_crw_demo, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1753 1754
		SRC:=$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo,\
		LANG:=C,\
1755 1756
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
1757
                        -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo,\
1758
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjava_crw_demo/mapfile-vers, \
1759 1760
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
1761
		LDFLAGS_SUFFIX_solaris:=-lc,\
1762 1763
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1764 1765 1766
			  -D "JDK_FNAME=java_crw_demo.dll" \
			  -D "JDK_INTERNAL_NAME=java_crw_demo" \
			  -D "JDK_FTYPE=0x2L",\
1767 1768
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjava_crw_demo,\
		DEBUG_SYMBOLS:=true))
1769

1770
BUILD_LIBRARIES += $(BUILD_LIBJAVA_CRW_DEMO)
1771 1772 1773 1774

##########################################################################################

$(eval $(call SetupNativeCompilation,BUILD_LIBNPT,\
1775 1776
		LIBRARY:=npt, \
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
1777
		SRC:=$(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt,\
1778
		LANG:=C,\
1779 1780
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
1781
                        -I$(JDK_TOPDIR)/src/share/npt \
1782
                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt,\
1783 1784 1785 1786 1787
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnpt/mapfile-vers, \
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
		LDFLAGS_macosx:=-liconv,\
		LDFLAGS_SUFFIX_windows:=-export:nptInitialize -export:nptTerminate,\
1788
		LDFLAGS_SUFFIX_solaris:=-lc, \
1789 1790
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1791 1792 1793
			  -D "JDK_FNAME=npt.dll" \
			  -D "JDK_INTERNAL_NAME=npt" \
			  -D "JDK_FTYPE=0x2L",\
1794 1795 1796 1797 1798 1799 1800 1801
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnpt,\
		DEBUG_SYMBOLS:=true))

BUILD_LIBRARIES += $(BUILD_LIBNPT)

##########################################################################################

LIBNET_SRC_DIRS:=$(JDK_TOPDIR)/src/share/native/java/net \
1802 1803 1804
                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net \
                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/dns \
                   $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/spi
1805

O
ohair 已提交
1806 1807 1808 1809 1810 1811
ifeq ($(OPENJDK_TARGET_OS),windows)
    LIBNET_SRC_DIRS+=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/www/protocol/http/ntlm
else
    LIBNET_SRC_DIRS+=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/sdp
endif

1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840
LIBNET_CFLAGS:=$(foreach dir,$(LIBNET_SRC_DIRS),-I$(dir))

LIBNET_EXCLUDE_FILES:=
ifneq ($(OPENJDK_TARGET_OS),linux)
	LIBNET_EXCLUDE_FILES += linux_close.c
endif

ifneq ($(OPENJDK_TARGET_OS),macosx)
	LIBNET_EXCLUDE_FILES += bsd_close.c
endif

ifeq ($(OPENJDK_TARGET_OS),windows)
	LIBNET_EXCLUDE_FILES += PlainSocketImpl.c PlainDatagramSocketImpl.c SdpSupport.c
else
	LIBNET_EXCLUDE_FILES += TwoStacksPlainSocketImpl.c DualStackPlainSocketImpl.c \
                                TwoStacksPlainDatagramSocketImpl.c DualStackPlainDatagramSocketImpl.c \
				NTLMAuthSequence.c NetworkInterface_winXP.c
endif

$(eval $(call SetupNativeCompilation,BUILD_LIBNET,\
		LIBRARY:=net,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
		SRC:=$(LIBNET_SRC_DIRS),\
		EXCLUDE_FILES:=$(LIBNET_EXCLUDE_FILES), \
		LANG:=C,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
                        $(LIBNET_CFLAGS),\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnet/mapfile-vers, \
1841 1842
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
1843
		LDFLAGS_SUFFIX_macosx:=-ljvm -ljava,\
1844
		LDFLAGS_SUFFIX_solaris:=-ljvm -ljava -lnsl -lsocket $(LIBDL) -lc ,\
1845
		LDFLAGS_SUFFIX_linux:=$(LIBDL) -ljvm -lpthread -ljava,\
O
ohair 已提交
1846 1847 1848
		LDFLAGS_SUFFIX_windows:=ws2_32.lib jvm.lib secur32.lib iphlpapi.lib \
					delayimp.lib $(WIN_JAVA_LIB) advapi32.lib \
					-DELAYLOAD:secur32.dll -DELAYLOAD:iphlpapi.dll, \
1849 1850
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1851 1852 1853
			  -D "JDK_FNAME=net.dll" \
			  -D "JDK_INTERNAL_NAME=net" \
			  -D "JDK_FTYPE=0x2L",\
1854
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnet,\
1855
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1856 1857 1858 1859 1860 1861

$(BUILD_LIBNET) : $(BUILD_LIBJAVA)

BUILD_LIBRARIES += $(BUILD_LIBNET)

$(JDK_OUTPUTDIR)/lib/net.properties: $(JDK_TOPDIR)/src/share/lib/net.properties
O
ohair 已提交
1862
	$(ECHO) $(LOG_INFO) Copying $(@F)
1863
	$(call install-file)
1864

1865 1866 1867
COPY_FILES += $(JDK_OUTPUTDIR)/lib/net.properties

ifeq ($(OPENJDK_TARGET_OS), solaris)
1868
$(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template : $(JDK_TOPDIR)/src/${OPENJDK_TARGET_OS_API_DIR}/lib/sdp/sdp.conf.template
O
ohair 已提交
1869
	$(ECHO) $(LOG_INFO) Copying $(@F)
1870
	$(call install-file)
1871 1872 1873

COPY_FILES += $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template
endif
1874 1875 1876

##########################################################################################

1877
BUILD_LIBNIO_SRC:=\
1878 1879 1880
        $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/nio \
	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch \
	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
1881

1882
BUILD_LIBNIO_CFLAGS:=\
1883 1884 1885
	-I$(JDK_TOPDIR)/src/share/native/sun/nio/ch \
	-I$(JDK_TOPDIR)/src/share/native/java/io \
	-I$(JDK_TOPDIR)/src/share/native/java/net \
1886
        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net
1887

1888
BUILD_LIBNIO_FILES:=\
1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900
        DatagramChannelImpl.c \
        DatagramDispatcher.c \
	FileChannelImpl.c \
	FileDispatcherImpl.c \
	FileKey.c \
	IOUtil.c \
        MappedByteBuffer.c \
	Net.c \
	ServerSocketChannelImpl.c \
	SocketChannelImpl.c \
	SocketDispatcher.c

1901
ifeq ($(OPENJDK_TARGET_OS), windows)
1902 1903 1904 1905 1906 1907 1908 1909 1910 1911
	BUILD_LIBNIO_FILES += \
		Iocp.c \
		RegistryFileTypeDetector.c \
		WindowsAsynchronousFileChannelImpl.c \
		WindowsAsynchronousServerSocketChannelImpl.c \
		WindowsAsynchronousSocketChannelImpl.c \
		WindowsNativeDispatcher.c \
	        WindowsSelectorImpl.c
endif

1912
ifeq ($(OPENJDK_TARGET_OS), linux)
1913
	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
1914 1915 1916 1917 1918 1919
	BUILD_LIBNIO_FILES += \
		EPoll.c \
		EPollArrayWrapper.c \
		EPollPort.c \
		InheritedChannel.c \
		NativeThread.c \
1920
		PollArrayWrapper.c \
1921 1922 1923
		UnixAsynchronousServerSocketChannelImpl.c \
		UnixAsynchronousSocketChannelImpl.c \
		GnomeFileTypeDetector.c \
1924
		MagicFileTypeDetector.c \
1925 1926 1927 1928 1929 1930
		LinuxNativeDispatcher.c \
		LinuxWatchService.c \
		UnixCopyFile.c \
		UnixNativeDispatcher.c
endif

1931
ifeq ($(OPENJDK_TARGET_OS), macosx)
1932
	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
1933 1934 1935 1936 1937 1938 1939 1940
	BUILD_LIBNIO_SRC += $(JDK_TOPDIR)/src/macosx/native/sun/nio/ch
	BUILD_LIBNIO_FILES += \
		InheritedChannel.c \
		NativeThread.c \
	        PollArrayWrapper.c \
		UnixAsynchronousServerSocketChannelImpl.c \
		UnixAsynchronousSocketChannelImpl.c \
		BsdNativeDispatcher.c \
1941
		MacOSXNativeDispatcher.c \
1942 1943 1944 1945 1946 1947 1948
		UnixCopyFile.c \
		UnixNativeDispatcher.c \
		KQueue.c \
		KQueuePort.c \
		KQueueArrayWrapper.c
endif

1949
ifeq ($(OPENJDK_TARGET_OS), solaris)
1950
	BUILD_LIBNIO_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
1951 1952 1953 1954 1955 1956 1957 1958
	BUILD_LIBNIO_FILES += \
		DevPollArrayWrapper.c \
		InheritedChannel.c \
		NativeThread.c \
		PollArrayWrapper.c \
		SolarisEventPort.c \
		UnixAsynchronousServerSocketChannelImpl.c \
		UnixAsynchronousSocketChannelImpl.c \
1959 1960 1961 1962 1963
		GnomeFileTypeDetector.c \
		SolarisNativeDispatcher.c \
		SolarisWatchService.c \
		UnixCopyFile.c \
		UnixNativeDispatcher.c
1964 1965
endif

1966 1967 1968 1969 1970
$(eval $(call SetupNativeCompilation,BUILD_LIBNIO,\
		LIBRARY:=nio,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
		SRC:=$(BUILD_LIBNIO_SRC),\
		INCLUDE_FILES:=$(BUILD_LIBNIO_FILES), \
1971
		LANG:=C,\
1972 1973 1974 1975 1976
		OPTIMIZATION:=HIGH, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
                        $(BUILD_LIBNIO_CFLAGS),\
		MAPFILE:=$(BUILD_LIBNIO_MAPFILE), \
		LDFLAGS:=$(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
1977
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
1978
		LDFLAGS_SUFFIX_linux:=-ljava -lnet -lpthread $(LIBDL),\
1979 1980
		LDFLAGS_SUFFIX_solaris:=-ljvm -lsocket -lposix4 $(LIBDL) \
				        -lsendfile -ljava -lnet -lc,\
O
ohair 已提交
1981 1982 1983
		LDFLAGS_SUFFIX_windows:=jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
					$(JDK_OUTPUTDIR)/objs/libnet/net.lib \
					advapi32.lib,\
1984
		LDFLAGS_SUFFIX_macosx:=-ljava -lnet -pthread -framework CoreFoundation,\
1985
		LDFLAGS_SUFFIX:=,\
1986 1987
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
1988 1989 1990
			  -D "JDK_FNAME=nio.dll" \
			  -D "JDK_INTERNAL_NAME=nio" \
			  -D "JDK_FTYPE=0x2L",\
1991
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libnio,\
1992
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
1993

1994
BUILD_LIBRARIES += $(BUILD_LIBNIO)
1995

1996
$(BUILD_LIBNIO) : $(BUILD_LIBNET)
1997 1998 1999

##########################################################################################

2000
ifeq ($(OPENJDK_TARGET_OS_API),posix)
2001

2002
  ifneq ($(OPENJDK_TARGET_OS),macosx)
2003

2004 2005 2006
    SCTP_WERROR := -Werror
    ifeq ($(OPENJDK_TARGET_CPU_ARCH), ppc)
      SCTP_WERROR :=
2007 2008
    endif

2009 2010 2011
    $(eval $(call SetupNativeCompilation,BUILD_LIBSCTP,\
                LIBRARY:=sctp,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2012
                SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch/sctp,\
2013
		LANG:=C,\
2014 2015 2016 2017 2018
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB)\
			-I$(JDK_TOPDIR)/src/share/native/sun/nio/ch \
			-I$(JDK_TOPDIR)/src/share/native/sun/nio/ch/sctp \
			-I$(JDK_TOPDIR)/src/share/native/java/net \
2019 2020
			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch \
			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net,\
2021 2022
		CFLAGS_linux:=$(SCTP_WERROR),\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libsctp/mapfile-vers, \
2023
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
2024
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2025
		LDFLAGS_SUFFIX_linux:=-lpthread $(LIBDL) -ljava -ljvm,\
2026
		LDFLAGS_SUFFIX_posix:=-lnio -lnet,\
2027
		LDFLAGS_SUFFIX_solaris:=-lsocket -ljava -ljvm -lc,\
2028
		LDFLAGS_SUFFIX_macosx:=-ljava -ljvm,\
2029 2030
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsctp,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2031

2032
    BUILD_LIBRARIES += $(BUILD_LIBSCTP)
2033

2034 2035 2036
    $(BUILD_LIBSCTP) : $(BUILD_LIBNIO)
  endif
endif
2037 2038 2039

##########################################################################################

2040 2041
BUILD_LIBJLI_SRC_DIRS:=$(JDK_TOPDIR)/src/share/bin $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin
LIBJLI_CFLAGS:=$(CFLAGS_JDKLIB) $(foreach dir,$(BUILD_LIBJLI_SRC_DIRS),-I$(dir))
2042

2043
BUILD_LIBJLI_FILES:=\
2044 2045 2046 2047 2048 2049 2050 2051
	java.c \
	splashscreen_stubs.c \
	parse_manifest.c \
	version_comp.c \
	wildcard.c \
	jli_util.c

ifeq ($(JVM_VARIANT_ZERO), true)
2052
	ERGO_FAMILY:=zero
2053 2054
else
	ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
2055
		ERGO_FAMILY:=i586
2056 2057 2058 2059
	else
		ERGO_FAMILY:=$(OPENJDK_TARGET_CPU_ARCH)
	endif
endif
2060

2061
ifeq ($(OPENJDK_TARGET_OS), macosx)
2062
	LIBJLI_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/bin
2063 2064 2065
	BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/bin
	BUILD_LIBJLI_FILES += java_md_common.c java_md_macosx.c

2066 2067
	BUILD_LIBJLI_java_md_macosx.c_CFLAGS:=-x objective-c
	BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS:=-x objective-c
2068 2069
endif

2070
ifeq ($(OPENJDK_TARGET_OS), windows)
2071
	BUILD_LIBJLI_FILES += java_md.c \
2072
			      cmdtoargs.c
2073 2074
        # Staticically link with c runtime on windows.
	LIBJLI_CFLAGS:=$(filter-out -MD,$(LIBJLI_CFLAGS))
2075
else ifneq ($(OPENJDK_TARGET_OS), macosx)
2076 2077

	BUILD_LIBJLI_FILES += java_md_common.c
2078
	BUILD_LIBJLI_FILES += java_md_solinux.c ergo.c
2079 2080 2081 2082 2083

	ERGO_ARCH_FILE = ergo_$(ERGO_FAMILY).c

        # if the architecture specific ergo file exists then
        # use it, else use the generic definitions from ergo.c
2084
	ifneq ($(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/$(ERGO_ARCH_FILE)),)
2085 2086
		BUILD_LIBJLI_FILES += $(ERGO_ARCH_FILE)
	else # !ERGO_ARCH_FILE
2087
		LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
2088 2089 2090
	endif # ERGO_ARCH_FILE
endif #WINDOWS

2091 2092
# Append defines depending on target platform
LIBJLI_CFLAGS += $(OPENJDK_TARGET_CPU_JLI_CFLAGS)
2093

2094
ifeq ($(OPENJDK_TARGET_OS), macosx)
2095
	LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
2096 2097 2098 2099
endif

ifneq ($(USE_EXTERNAL_LIBZ),true)
	BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
2100
	LIBJLI_CFLAGS += $(ZLIB_CPPFLAGS)
2101 2102 2103 2104 2105 2106 2107 2108 2109
	BUILD_LIBJLI_FILES += \
		inflate.c \
		inftrees.c \
		inffast.c \
		zadler32.c \
		zcrc32.c \
		zutil.c
endif

2110 2111 2112 2113 2114 2115
ifeq ($(OPENJDK_TARGET_OS), windows)
    LIBJLI_OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE)
else
    LIBJLI_OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE)/jli
endif

2116
$(eval $(call SetupNativeCompilation,BUILD_LIBJLI,\
2117 2118
		LIBRARY:=jli,\
                OUTPUT_DIR:=$(LIBJLI_OUTPUT_DIR),\
2119
		SRC:=$(BUILD_LIBJLI_SRC_DIRS),\
2120
		INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
2121
		LANG:=C,\
2122
		OPTIMIZATION:=HIGH, \
2123
		CFLAGS:=$(LIBJLI_CFLAGS),\
2124
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjli/mapfile-vers, \
2125 2126
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2127 2128 2129 2130 2131 2132
		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN,/..),\
		LDFLAGS_solaris:=$(call SET_SHARED_LIBRARY_ORIGIN,/..),\
		LDFLAGS_macosx:=-framework Cocoa -framework Security -framework ApplicationServices,\
		LDFLAGS_SUFFIX_solaris:=$(LIBZ) $(LIBDL) -lc,\
		LDFLAGS_SUFFIX_linux:=$(LIBZ) $(LIBDL) -lc -lpthread,\
		LDFLAGS_SUFFIX_macosx:=$(LIBZ),\
2133
		LDFLAGS_SUFFIX_windows:=\
2134 2135 2136 2137 2138 2139 2140
			-export:JLI_Launch \
			-export:JLI_ManifestIterate \
			-export:JLI_SetTraceLauncher \
			-export:JLI_ReportErrorMessage \
			-export:JLI_ReportErrorMessageSys \
			-export:JLI_ReportMessage \
			-export:JLI_ReportExceptionDescription \
2141 2142 2143 2144
			-export:JLI_MemAlloc \
			-export:JLI_CmdToArgs \
			-export:JLI_GetStdArgc \
			-export:JLI_GetStdArgs \
2145 2146 2147
			advapi32.lib \
			comctl32.lib \
			user32.lib,\
2148 2149
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS) \
O
ohair 已提交
2150 2151 2152
			  -D "JDK_FNAME=jli.dll" \
			  -D "JDK_INTERNAL_NAME=jli" \
			  -D "JDK_FTYPE=0x2L",\
2153
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli,\
2154
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2155

2156
BUILD_LIBRARIES += $(BUILD_LIBJLI)
2157 2158 2159 2160

# On windows, the static library has the same suffix as the import library created by
# with the shared library, so the static library is given a different name. No harm
# in doing it for all platform to reduce complexity.
2161
ifeq ($(OPENJDK_TARGET_OS), windows)
2162
    $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC,\
2163 2164
		STATIC_LIBRARY:=jli_static,\
                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs,\
2165
		SRC:=$(BUILD_LIBJLI_SRC_DIRS),\
2166
		INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
2167
		LANG:=C,\
2168
		OPTIMIZATION:=HIGH, \
2169
		CFLAGS:=$(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS),\
2170
		ARFLAGS:=$(ARFLAGS),\
2171 2172
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2173 2174 2175 2176

BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)

else ifeq ($(OPENJDK_TARGET_OS),macosx)
2177
    #
2178
    # On macosx they do partial (incremental) linking of libjli_static.a
2179 2180
    #   code it here...rather than add support to NativeCompilation
    #   as this is first time I see it
2181 2182 2183
    $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC,\
		LIBRARY:=jli_static, \
                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs,\
2184
		SRC:=$(BUILD_LIBJLI_SRC_DIRS),\
2185
		INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
2186
		LANG:=C,\
2187
		OPTIMIZATION:=HIGH, \
2188
		CFLAGS:=$(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS),\
2189
		LDFLAGS:=-nostdlib -r,\
2190 2191
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2192 2193

$(JDK_OUTPUTDIR)/objs/libjli_static.a : $(BUILD_LIBJLI_STATIC)
2194
	$(call install-file)
2195

2196 2197
BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
endif
2198 2199 2200

##########################################################################################

O
ohair 已提交
2201
ifndef OPENJDK
2202
ifeq ($(ENABLE_JFR), true)
2203 2204

$(eval $(call SetupNativeCompilation,BUILD_LIBJFR,\
2205 2206
		LIBRARY:=jfr,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2207 2208
		SRC:=$(JDK_TOPDIR)/src/closed/share/native/oracle/jfr,\
		LANG:=C,\
2209 2210
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
2211
                        -I$(JDK_TOPDIR)/src/closed/share/javavm/export, \
2212
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjfr/mapfile-vers, \
2213 2214
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2215
		LDFLAGS_SUFFIX_solaris:=-lc,\
2216 2217
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2218 2219 2220
			  -D "JDK_FNAME=jfr.dll" \
			  -D "JDK_INTERNAL_NAME=jfr" \
			  -D "JDK_FTYPE=0x2L",\
2221
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjfr,\
2222
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2223

2224
BUILD_LIBRARIES += $(BUILD_LIBJFR)
2225

O
ohair 已提交
2226
endif
2227 2228 2229 2230 2231 2232
endif

##########################################################################################

ifndef OPENJDK

2233 2234
BUILD_LIBKCMS_EXCLUDE_FILES:=
ifeq ($(OPENJDK_TARGET_OS),windows)
2235 2236 2237 2238 2239
	BUILD_LIBKCMS_EXCLUDE_FILES += ukcpmgr.c unixmem.c
else
	BUILD_LIBKCMS_EXCLUDE_FILES += cmmdll.c registry.c spxffile.c sysinfo.c winmem.c wkcpmgr.c
endif

2240 2241 2242 2243 2244 2245 2246 2247 2248 2249
BUILD_LIBKCMS_FLAGS:=$(CFLAGS_JDKLIB)

ifeq ($(OPENJDK_TARGET_OS),solaris)
     # This particular library uses a feature called PIC_CODE_SMALL (on solaris)
     #   implement it like this...since it's only used here
     BUILD_LIBKCMS_FLAGS:=$(patsubst -KPIC,-Kpic,$(BUILD_LIBKCMS_FLAGS))
else ifeq ($(OPENJDK_TARGET_CPU_ARCH), ppc)
     BUILD_LIBKCMS_FLAGS:=$(patsubst -fPIC,-fpic,$(BUILD_LIBKCMS_FLAGS))
endif

2250
$(eval $(call SetupNativeCompilation,BUILD_LIBKCMS,\
2251 2252
		LIBRARY:=kcms,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2253 2254
		SRC:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms,\
		LANG:=C,\
2255 2256 2257
		EXCLUDE_FILES:=$(BUILD_LIBKCMS_EXCLUDE_FILES),\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(BUILD_LIBKCMS_FLAGS) \
2258
                        -DJAVACMM -DFUT_CALC_EX -DNO_FUT_GCONST,\
2259 2260
		CFLAGS_linux:=-Wno-missing-field-initializers,\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libkcms/mapfile-vers, \
2261 2262
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2263
		LDFLAGS_SUFFIX_linux:=-lc -lpthread,\
2264
		LDFLAGS_SUFFIX_solaris:=-lc,\
2265
		LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \
E
erikj 已提交
2266
		LDFLAGS_SUFFIX_posix:=-lm -ljava -ljvm,\
2267
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
2268 2269
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2270 2271 2272
			  -D "JDK_FNAME=kcms.dll" \
			  -D "JDK_INTERNAL_NAME=kcms" \
			  -D "JDK_FTYPE=0x2L",\
2273
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkcms,\
2274
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2275

2276
$(BUILD_LIBKCMS) : $(BUILD_LIBJAVA)
2277

2278
BUILD_LIBRARIES += $(BUILD_LIBKCMS)
2279 2280 2281 2282 2283 2284

endif

##########################################################################################

ifndef OPENJDK
2285
ifeq ($(OPENJDK_TARGET_OS), solaris)
2286
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
2287 2288 2289

ifeq ($(shell if test "$(OS_VERSION_MAJOR)" -eq 5 -a "$(OS_VERSION_MINOR)" -le 10; then $(ECHO) ok; fi), ok)

2290
SUNWJDGA_MAPFILE:=
2291
ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
2292
	SUNWJDGA_MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjdga/mapfile-vers
2293 2294 2295
endif

$(eval $(call SetupNativeCompilation,BUILD_LIBSUNWJDGA, \
2296 2297
		LIBRARY:=sunwjdga,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2298 2299
		SRC:=$(JDK_TOPDIR)/src/solaris/native/sun/jdga, \
		LANG:=C, \
2300 2301
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
2302
			-I$(JDK_TOPDIR)/src/share/javavm/export \
2303
			-I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
2304
			-I$(OPENWIN_HOME)/include, \
2305
		MAPFILE:=$(SUNWJDGA_MAPFILE), \
2306 2307
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN), \
2308
		LDFLAGS_SUFFIX:=-L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -ldga -lX11 $(LIBDL) -lc, \
2309 2310
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunwjdga,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2311

2312
BUILD_LIBRARIES += $(BUILD_LIBSUNWJDGA)
2313 2314 2315 2316 2317 2318 2319 2320 2321

endif
endif
endif
endif

##########################################################################################

ifeq ($(BUILD_HEADLESS), true)
2322
ifneq ($(OPENJDK_TARGET_OS), windows)
2323

2324
LIBAWT_HEADLESS_DIRS:=$(JDK_TOPDIR)/src/share/native/sun/font \
2325 2326 2327 2328 2329 2330
                        $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
			$(JDK_TOPDIR)/src/solaris/native/sun/font \
			$(JDK_TOPDIR)/src/solaris/native/sun/awt \
			$(JDK_TOPDIR)/src/solaris/native/sun/java2d/opengl \
			$(JDK_TOPDIR)/src/solaris/native/sun/java2d/x11

2331 2332 2333 2334
ifeq ($(OPENJDK_TARGET_OS),macosx)
	LIBAWT_HEADLESS_DIRS+=$(JDK_TOPDIR)/src/macosx/native/sun/font
endif

2335
LIBAWT_HEADLESS_CFLAGS:=-DHEADLESS=true \
2336 2337
                          -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
			  $(CUPS_CFLAGS) \
2338
			  $(X_CFLAGS) \
2339
			  -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
2340
			  -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
2341 2342 2343
			  -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
			  -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
			  -I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
2344 2345
			  -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
			  -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
2346
			  -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga \
2347
                          $(foreach dir,$(LIBAWT_HEADLESS_DIRS),-I$(dir))
2348

2349 2350 2351 2352 2353 2354
ifeq ($(OPENJDK_TARGET_OS),macosx)
	LIBAWT_HEADLESS_CFLAGS+=\
		-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
		-F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
endif

2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381
LIBAWT_HEADLESS_FILES:=\
	awt_Font.c \
	HeadlessToolkit.c \
	fontpath.c \
	VDrawingArea.c \
	X11Color.c \
	X11Renderer.c \
	X11PMBlitLoops.c \
	X11SurfaceData.c \
	X11FontScaler_md.c \
	X11TextRenderer_md.c \
        OGLBlitLoops.c \
        OGLBufImgOps.c \
        OGLContext.c \
        OGLFuncs.c \
        OGLMaskBlit.c \
        OGLMaskFill.c \
        OGLPaints.c \
        OGLRenderQueue.c \
        OGLRenderer.c \
        OGLSurfaceData.c \
        OGLTextRenderer.c \
        OGLVertexCache.c \
        GLXGraphicsConfig.c \
        GLXSurfaceData.c \
        AccelGlyphCache.c \
	CUPSfuncs.c
2382

2383 2384 2385 2386 2387 2388 2389 2390 2391 2392
ifeq ($(OPENJDK_TARGET_OS),macosx)
	LIBAWT_HEADLESS_FILES+=\
		AWTFont.m \
		AWTStrike.m \
		CCharToGlyphMapper.m \
		CGGlyphImages.m \
		CGGlyphOutlines.m \
		CoreTextSupport.m
endif

2393 2394
LIBAWT_HEADLESS_REORDER:=
ifeq ($(OPENJDK_TARGET_OS), solaris)
2395 2396
	ifneq ($(OPENJDK_TARGET_CPU), x86_64)
		LIBAWT_HEADLESS_REORDER:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
2397
	endif
2398 2399
endif

2400 2401 2402 2403 2404
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS,\
		LIBRARY:=awt_headless,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
		SRC:=$(LIBAWT_HEADLESS_DIRS),\
		INCLUDE_FILES:=$(LIBAWT_HEADLESS_FILES),\
2405
		LANG:=C,\
2406 2407
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) $(LIBAWT_HEADLESS_CFLAGS),\
2408
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/mapfile-vers,\
2409
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
2410
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2411 2412 2413 2414 2415
		LDFLAGS_linux:=$(call SET_SHARED_LIBRARY_ORIGIN,/..),\
		LDFLAGS_solaris:=$(call SET_SHARED_LIBRARY_ORIGIN,/..) \
				 -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
				 -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR),\
		LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_ORIGIN).,\
2416
		REORDER:=$(LIBAWT_HEADLESS_REORDER), \
2417
		LDFLAGS_SUFFIX_linux:=-ljvm -lawt -lm $(LIBDL) -ljava,\
2418
		LDFLAGS_SUFFIX_solaris:=$(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc,\
2419 2420 2421 2422 2423 2424 2425
		LDFLAGS_SUFFIX_macosx:=-ljvm $(LIBCXX) -lawt $(LIBDL) -ljava \
				 -framework Accelerate \
				 -framework ApplicationServices \
				 -framework Cocoa \
				 -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
				 -framework JavaNativeFoundation \
				 -framework JavaRuntimeSupport,\
2426 2427
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_headless,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2428

2429
$(BUILD_LIBAWT_HEADLESS) : $(BUILD_LIBAWT)
2430

2431
BUILD_LIBRARIES += $(BUILD_LIBAWT_HEADLESS)
2432 2433 2434 2435 2436 2437 2438

endif
endif

##########################################################################################

ifndef BUILD_HEADLESS_ONLY
2439
LIBSPLASHSCREEN_DIRS:=\
2440 2441
	$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
	$(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
2442 2443
	$(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen

2444 2445 2446 2447 2448 2449 2450
ifeq ($(USE_EXTERNAL_LIBGIF),true)
    GIFLIB_LDFLAGS := -lgif
else
    LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/giflib
    GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
endif

2451 2452 2453 2454 2455 2456
ifneq ($(OPENJDK_TARGET_OS), macosx)
    LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
else
    LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen
endif

2457
LIBSPLASHSCREEN_CFLAGS:=-DSPLASHSCREEN -DPNG_NO_MMX_CODE \
2458 2459
	$(foreach dir,$(LIBSPLASHSCREEN_DIRS),-I$(dir))

2460 2461
ifeq ($(OPENJDK_TARGET_OS), macosx)
	LIBSPLASHSCREEN_CFLAGS:=-I$(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen \
2462 2463 2464 2465 2466
                                  $(LIBSPLASHSCREEN_CFLAGS) \
                                  -F/System/Library/Frameworks/JavaVM.framework/Frameworks
	LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
	LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp

2467 2468 2469 2470 2471 2472 2473
	LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS:=-x objective-c -O0
	LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS:=-x objective-c -O0
	LIBSPLASHSCREEN_splashscreen_gif.c_CFLAGS:=-x objective-c -O0
	LIBSPLASHSCREEN_splashscreen_impl.c_CFLAGS:=-x objective-c -O0
	LIBSPLASHSCREEN_splashscreen_jpeg.c_CFLAGS:=-x objective-c -O0
	LIBSPLASHSCREEN_splashscreen_png.c_CFLAGS:=-x objective-c -O0
	LIBSPLASHSCREEN_splashscreen_sys.m_CFLAGS:=-O0
2474

2475
else ifneq ($(OPENJDK_TARGET_OS), windows)
2476 2477 2478 2479 2480
	LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 -I$(OPENWIN_HOME)/include -I$(OPENWIN_HOME)/include/X11/extensions
else
	LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32
endif

2481
LIBSPLASHSCREEN_LDFLAGS_SUFFIX:=
2482 2483 2484

ifneq ($(USE_EXTERNAL_LIBZ),true)
	LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
2485
	LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
2486 2487
endif

2488
ifeq ($(OPENJDK_TARGET_OS), macosx)
2489 2490 2491 2492 2493 2494
	LIBSPLASHSCREEN_LDFLAGS_SUFFIX += $(LIBM) -lpthread -liconv -losxapp \
				  -framework ApplicationServices \
				  -framework Foundation \
				  -framework Cocoa \
                                  -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
				  -framework JavaNativeFoundation
2495
else ifneq ($(OPENJDK_TARGET_OS), windows)
2496
	LIBSPLASHSCREEN_LDFLAGS_SUFFIX += -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -lX11 -lXext $(LIBM) -lpthread
2497
else # OPENJDK_TARGET_OS
O
ohair 已提交
2498
	LIBSPLASHSCREEN_LDFLAGS_SUFFIX += kernel32.lib user32.lib gdi32.lib delayimp.lib -DELAYLOAD:user32.dll
2499
endif # OPENJDK_TARGET_OS
2500 2501

$(eval $(call SetupNativeCompilation,LIBSPLASHSCREEN,\
2502 2503
		LIBRARY:=splashscreen,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2504
		SRC:=$(LIBSPLASHSCREEN_DIRS),\
2505
		EXCLUDE_FILES:=imageioJPEG.c jpegdecoder.c pngtest.c,\
2506
		LANG:=C,\
2507
		OPTIMIZATION:=LOW, \
2508
		CFLAGS:=$(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) $(GIFLIB_CFLAGS),\
2509 2510
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libsplashscreen/mapfile-vers, \
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
2511
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2512
		LDFLAGS_SUFFIX:=$(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) $(GIFLIB_LDFLAGS),\
2513
		LDFLAGS_SUFFIX_solaris:=-lc,\
2514 2515
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2516 2517 2518
			  -D "JDK_FNAME=splashscreen.dll" \
			  -D "JDK_INTERNAL_NAME=splashscreen" \
			  -D "JDK_FTYPE=0x2L",\
2519
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsplashscreen,\
2520
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2521

2522
BUILD_LIBRARIES += $(LIBSPLASHSCREEN)
2523

2524
ifeq ($(OPENJDK_TARGET_OS),macosx)
2525
$(LIBSPLASHSCREEN) :  $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
2526 2527 2528 2529 2530 2531 2532 2533
endif

endif

##########################################################################################

ifndef OPENJDK

2534
LIBDCPR_SRC_DIRS:=\
2535 2536 2537 2538 2539
	$(JDK_TOPDIR)/src/closed/share/native/sun/dc/doe \
	$(JDK_TOPDIR)/src/closed/share/native/sun/dc/path \
	$(JDK_TOPDIR)/src/closed/share/native/sun/dc/pr \
	$(JDK_TOPDIR)/src/closed/share/native/sun/dc/util

2540
LIBDCPR_CFLAGS:=$(foreach dir,$(LIBDCPR_SRC_DIRS),-I$(dir)) \
2541 2542 2543
	          -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe

$(eval $(call SetupNativeCompilation,BUILD_LIBDCPR,\
2544 2545
		LIBRARY:=dcpr,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2546 2547
		SRC:=$(LIBDCPR_SRC_DIRS),\
		LANG:=C,\
2548 2549
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
2550
			$(LIBDCPR_CFLAGS), \
2551
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libdcpr/mapfile-vers, \
2552
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
2553
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2554
		LDFLAGS_SUFFIX:=$(LIBM) $(LDFLAGS_JDKLIB_SUFFIX),\
2555
		LDFLAGS_SUFFIX_posix:=-lm,\
2556 2557
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2558 2559 2560
			  -D "JDK_FNAME=dcpr.dll" \
			  -D "JDK_INTERNAL_NAME=dcpr" \
			  -D "JDK_FTYPE=0x2L",\
2561
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libdcpr,\
2562
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2563

2564
$(BUILD_LIBDCPR) : $(BUILD_LIBJAVA)
2565

2566
BUILD_LIBRARIES += $(BUILD_LIBDCPR)
2567 2568 2569 2570 2571 2572

endif

##########################################################################################

$(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC,\
2573 2574
		LIBRARY:=j2pcsc,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2575
		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
2576
                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio,\
2577
		LANG:=C,\
2578 2579 2580
		CFLAGS_posix:=-D__sun_jdk,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
2581
                     -I$(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
2582 2583
                     -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio\
                     -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio/MUSCLE,\
2584
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2pcsc/mapfile-vers, \
2585 2586
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2587 2588
		LDFLAGS_SUFFIX_posix:=$(LIBDL), \
		LDFLAGS_SUFFIX_windows:=winscard.lib,\
2589
		LDFLAGS_SUFFIX_solaris:=-lc,\
2590 2591
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2592 2593 2594
			  -D "JDK_FNAME=j2pcsc.dll" \
			  -D "JDK_INTERNAL_NAME=j2pcsc" \
			  -D "JDK_FTYPE=0x2L",\
2595
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pcsc,\
2596
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2597

2598
BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
2599 2600 2601

##########################################################################################

2602
ifneq ($(OPENJDK_TARGET_OS), windows)
2603
$(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
2604 2605
		LIBRARY:=j2gss,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2606
		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
2607
                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper,\
2608
		LANG:=C,\
2609 2610
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
2611
                     -I$(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
2612
                     -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper,\
2613
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2gss/mapfile-vers, \
2614 2615
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2616 2617
		LDFLAGS_SUFFIX:=$(LIBDL),\
		LDFLAGS_SUFFIX_solaris:=-lc,\
2618 2619
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2gss,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2620

2621
BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
2622 2623 2624 2625
endif

##########################################################################################

2626 2627 2628
ifneq ($(BUILD_CRYPTO),no)
  BUILD_LIBKRB5_NAME:=
  ifeq ($(OPENJDK_TARGET_OS), windows)
2629
     BUILD_LIBKRB5_NAME:=w2k_lsa_auth
2630
     BUILD_LIBKRB5_SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5
O
ohair 已提交
2631 2632 2633
     BUILD_LIBKRB5_LIBS:=advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \
			 gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \
			 ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib
2634
  else ifeq ($(OPENJDK_TARGET_OS), macosx)
2635
     BUILD_LIBKRB5_NAME:=osxkrb5
2636
     BUILD_LIBKRB5_SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/krb5
2637
     BUILD_LIBKRB5_LIBS:=-framework Kerberos
2638
  endif
2639

2640 2641
  ifneq ($(BUILD_LIBKRB5_NAME),)
    $(eval $(call SetupNativeCompilation,BUILD_LIBKRB5,\
2642 2643
		LIBRARY:=$(BUILD_LIBKRB5_NAME),\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2644
		SRC:=$(BUILD_LIBKRB5_SRC),\
2645
		LANG:=C,\
2646 2647
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
2648
		        -I$(JDK_TOPDIR)/src/share/native/sun/security/krb5 \
2649
                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5 ,\
2650 2651
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2652
		LDFLAGS_SUFFIX:=$(BUILD_LIBKRB5_LIBS) ,\
2653 2654
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2655 2656 2657
			  -D "JDK_FNAME=$(BUILD_LIBKRB5_NAME).dll" \
			  -D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
			  -D "JDK_FTYPE=0x2L",\
2658
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libkrb5,\
2659
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2660

2661 2662
    BUILD_LIBRARIES += $(BUILD_LIBKRB5)
  endif
2663 2664 2665 2666
endif

##########################################################################################

2667
ifeq ($(OPENJDK_TARGET_OS), windows)
2668 2669

$(eval $(call SetupNativeCompilation,BUILD_LIBSUNMSCAPI,\
2670 2671
		LIBRARY:=sunmscapi,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
O
ohair 已提交
2672
		SRC:=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi,\
2673
		LANG:=C++,\
2674 2675
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
2676 2677
                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi ,\
		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
2678
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2679
		LDFLAGS_SUFFIX:=Crypt32.Lib advapi32.lib,\
2680 2681
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2682 2683 2684
			  -D "JDK_FNAME=sunmscapi.dll" \
			  -D "JDK_INTERNAL_NAME=sunmscapi" \
			  -D "JDK_FTYPE=0x2L",\
2685
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunmscapi,\
2686
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2687

2688
BUILD_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
2689 2690 2691 2692 2693
endif

##########################################################################################

$(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11,\
2694 2695
		LIBRARY:=j2pkcs11,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2696
		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
2697
                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
2698
                     $(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
2699
                     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper,\
2700
		LANG:=C,\
2701 2702
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
2703
		        -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
2704
		        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
2705
		        -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
2706
                        -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper,\
2707
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2pkcs11/mapfile-vers, \
2708 2709
		LDFLAGS:=$(LDFLAGS_JDKLIB) \
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2710 2711
		LDFLAGS_SUFFIX_posix:=$(LIBDL),\
		LDFLAGS_SUFFIX_solaris:=-lc,\
2712 2713
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2714 2715 2716
			  -D "JDK_FNAME=j2pkcs11.dll" \
			  -D "JDK_INTERNAL_NAME=j2pkcs11" \
			  -D "JDK_FTYPE=0x2L",\
2717
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2pkcs11,\
2718
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2719

2720
BUILD_LIBRARIES += $(BUILD_LIBJ2PKCS11)
2721 2722 2723

##########################################################################################

2724 2725
ifeq ($(ENABLE_INTREE_EC),yes)

2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738
BUILD_LIBSUNEC_FLAGS:= -I$(JDK_TOPDIR)/src/share/native/sun/security/ec \
                       -I$(JDK_TOPDIR)/src/share/native/sun/security/ec/impl

#
# On sol-sparc...all libraries are compiled with -xregs=no%appl
#   (set in CFLAGS_REQUIRED_sparc)
#
# except!!! libsunec.so
#
ECC_JNI_SOLSPARC_FILTER:=
ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
     ECC_JNI_SOLSPARC_FILTER:=-xregs=no%appl
endif
2739 2740

$(eval $(call SetupNativeCompilation,BUILD_LIBSUNEC,\
2741 2742
		LIBRARY:=sunec,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2743 2744
		SRC:=$(JDK_TOPDIR)/src/share/native/sun/security/ec \
                     $(JDK_TOPDIR)/src/share/native/sun/security/ec/impl, \
2745 2746 2747 2748 2749 2750 2751 2752
		LANG:=C++, \
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CFLAGS_JDKLIB))\
                        $(BUILD_LIBSUNEC_FLAGS) \
                        -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B,\
		CXXFLAGS:=$(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CXXFLAGS_JDKLIB)) \
                          $(BUILD_LIBSUNEC_FLAGS),\
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libsunec/mapfile-vers, \
2753 2754
		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK),\
		LDFLAGS_macosx:=$(call SET_SHARED_LIBRARY_ORIGIN),\
2755
		LDFLAGS_SUFFIX:=$(LIBCXX),\
2756
                LDFLAGS_SUFFIX_linux:=-lc ,\
2757
                LDFLAGS_SUFFIX_solaris:=-lc ,\
2758 2759
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2760 2761 2762
			  -D "JDK_FNAME=sunec.dll" \
			  -D "JDK_INTERNAL_NAME=sunec" \
			  -D "JDK_FTYPE=0x2L",\
2763
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libsunec,\
2764
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2765

2766
BUILD_LIBRARIES += $(BUILD_LIBSUNEC)
2767 2768 2769 2770
endif

##########################################################################################

2771
LIBJSOUND_SRC_DIRS:=\
2772
	$(JDK_TOPDIR)/src/share/native/com/sun/media/sound \
2773
	$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/media/sound
2774

2775
LIBJSOUND_SRC_FILES:=Utilities.c Platform.c
2776

2777 2778
LIBJSOUND_LANG:=C
LIBJSOUND_CFLAGS:=$(foreach dir,$(LIBJSOUND_SRC_DIRS),-I$(dir))
2779

2780
EXTRA_SOUND_JNI_LIBS:=
2781

2782
LIBJSOUND_MIDIFILES:=\
2783 2784 2785 2786 2787 2788 2789
	MidiInDevice.c \
	MidiInDeviceProvider.c \
	MidiOutDevice.c \
	MidiOutDeviceProvider.c \
	PlatformMidi.c

# files needed for ports
2790
LIBJSOUND_PORTFILES:=\
2791 2792 2793 2794
	PortMixerProvider.c \
	PortMixer.c

# files needed for direct audio
2795
LIBJSOUND_DAUDIOFILES:=\
2796 2797 2798
	DirectAudioDeviceProvider.c \
	DirectAudioDevice.c

2799
ifeq ($(OPENJDK_TARGET_OS), windows)
2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811
	EXTRA_SOUND_JNI_LIBS += jsoundds
	LIBJSOUND_CFLAGS += -DX_PLATFORM=X_WINDOWS \
                            -DUSE_PLATFORM_MIDI_OUT=TRUE \
                            -DUSE_PLATFORM_MIDI_IN=TRUE \
                            -DUSE_PORTS=TRUE
	LIBJSOUND_SRC_FILES += \
		PLATFORM_API_WinOS_MidiIn.cpp \
		PLATFORM_API_WinOS_MidiOut.c \
		PLATFORM_API_WinOS_Util.c \
		PLATFORM_API_WinOS_Ports.c
	LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
	LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
2812
endif # OPENJDK_TARGET_OS windows
2813

2814
ifeq ($(OPENJDK_TARGET_OS), linux)
2815 2816
	EXTRA_SOUND_JNI_LIBS += jsoundalsa
	LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX
2817
endif # OPENJDK_TARGET_OS linux
2818

2819 2820
ifeq ($(OPENJDK_TARGET_OS), macosx)
	LIBJSOUND_LANG:=C++
2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836
	LIBJSOUND_CFLAGS += -DX_PLATFORM=X_MACOSX \
                            -DUSE_PORTS=TRUE \
                            -DUSE_DAUDIO=TRUE \
                            -DUSE_PLATFORM_MIDI_OUT=TRUE \
                            -DUSE_PLATFORM_MIDI_IN=TRUE
	LIBJSOUND_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/com/sun/media/sound
	LIBJSOUND_SRC_FILES += \
		PLATFORM_API_MacOSX_Utils.cpp \
		PLATFORM_API_MacOSX_PCM.cpp \
		PLATFORM_API_MacOSX_Ports.cpp \
                PLATFORM_API_MacOSX_MidiIn.c \
                PLATFORM_API_MacOSX_MidiOut.c \
                PLATFORM_API_MacOSX_MidiUtils.c
	LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
	LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
	LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
2837
endif # OPENJDK_TARGET_OS macosx
2838

2839
ifeq ($(OPENJDK_TARGET_OS), solaris)
2840 2841 2842 2843 2844 2845 2846 2847 2848 2849
	LIBJSOUND_CFLAGS += -DX_PLATFORM=X_SOLARIS \
                            -DUSE_PORTS=TRUE \
                            -DUSE_DAUDIO=TRUE
	LIBJSOUND_SRC_FILES += \
		PLATFORM_API_SolarisOS_Utils.c \
		PLATFORM_API_SolarisOS_Ports.c \
		PLATFORM_API_SolarisOS_PCM.c
	LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
	LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
	LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
2850
endif # OPENJDK_TARGET_OS solaris
2851 2852 2853 2854 2855


ifeq ($(JVM_VARIANT_ZERO), true)
	LIBJSOUND_CFLAGS += -DX_ARCH=X_ZERO
else
2856
  ifeq ($(OPENJDK_TARGET_CPU), x86)
2857
	LIBJSOUND_CFLAGS += -DX_ARCH=X_I586
2858
  endif
2859

2860
  ifeq ($(OPENJDK_TARGET_CPU), sparc)
2861
	LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARC
2862
  endif
2863

2864
  ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
2865
	LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARCV9
2866
  endif
2867

2868
  ifeq ($(OPENJDK_TARGET_CPU), x86_64)
2869
	LIBJSOUND_CFLAGS += -DX_ARCH=X_AMD64
2870
  endif
2871

2872
  ifeq ($(OPENJDK_TARGET_CPU), arm)
2873
	LIBJSOUND_CFLAGS += -DX_ARCH=X_ARM
2874
  endif
2875

2876
  ifeq ($(OPENJDK_TARGET_CPU), ppc)
2877
	LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC
2878
  endif
2879 2880 2881 2882 2883
endif

LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'

$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND,\
2884 2885
		LIBRARY:=jsound,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2886
		SRC:=$(LIBJSOUND_SRC_DIRS),\
2887
		INCLUDE_FILES:=$(LIBJSOUND_SRC_FILES),\
2888
		LANG:=$(LIBJSOUND_LANG),\
2889
		OPTIMIZATION:=LOW, \
2890 2891
		CFLAGS:=$(CFLAGS_JDKLIB) \
		        $(LIBJSOUND_CFLAGS), \
2892 2893
		CXXFLAGS:=$(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsound/mapfile-vers, \
2894 2895
		LDFLAGS:=$(LDFLAGS_JDKLIB)\
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2896 2897 2898
		LDFLAGS_macosx:=-framework CoreAudio -framework CoreFoundation \
				-framework CoreServices -framework AudioUnit $(LIBCXX) \
				-framework CoreMIDI -framework AudioToolbox,\
2899
		LDFLAGS_windows:=$(WIN_JAVA_LIB) advapi32.lib winmm.lib,\
O
ohair 已提交
2900
		LDFLAGS_SUFFIX_posix:=-ljava -ljvm,\
2901
		LDFLAGS_SUFFIX_solaris:=-lc ,\
2902 2903
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2904 2905 2906
			  -D "JDK_FNAME=jsound.dll" \
			  -D "JDK_INTERNAL_NAME=jsound" \
			  -D "JDK_FTYPE=0x2L",\
2907
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsound,\
2908
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2909

2910
$(BUILD_LIBJSOUND) : $(BUILD_LIBJAVA)
2911

2912
BUILD_LIBRARIES += $(BUILD_LIBJSOUND)
2913 2914 2915 2916 2917 2918

##########################################################################################

ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)),)

$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDALSA,\
2919 2920
		LIBRARY:=jsoundalsa,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2921
		SRC:=$(LIBJSOUND_SRC_DIRS),\
2922
		INCLUDE_FILES:=Utilities.c $(LIBJSOUND_MIDIFILES) $(LIBJSOUND_PORTFILES) \
2923 2924 2925 2926 2927 2928 2929 2930
                                $(LIBJSOUND_DAUDIOFILES) \
				PLATFORM_API_LinuxOS_ALSA_CommonUtils.c   \
				PLATFORM_API_LinuxOS_ALSA_PCM.c     \
				PLATFORM_API_LinuxOS_ALSA_PCMUtils.c   \
				PLATFORM_API_LinuxOS_ALSA_MidiIn.c  \
				PLATFORM_API_LinuxOS_ALSA_MidiOut.c \
				PLATFORM_API_LinuxOS_ALSA_MidiUtils.c \
				PLATFORM_API_LinuxOS_ALSA_Ports.c,\
2931 2932
		LANG:=C,\
		OPTIMIZATION:=LOW, \
2933
		CFLAGS:=$(CFLAGS_JDKLIB) $(ALSA_CFLAGS) \
2934 2935 2936 2937 2938
			$(LIBJSOUND_CFLAGS) \
			-DUSE_DAUDIO=TRUE \
			-DUSE_PORTS=TRUE  \
			-DUSE_PLATFORM_MIDI_OUT=TRUE \
			-DUSE_PLATFORM_MIDI_IN=TRUE, \
2939
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsoundalsa/mapfile-vers, \
2940 2941
		LDFLAGS:=$(LDFLAGS_JDKLIB)\
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
2942
		LDFLAGS_SUFFIX:=$(ALSA_LIBS) -ljava -ljvm,\
2943 2944
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundalsa,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2945

2946
$(BUILD_LIBJSOUNDALSA) : $(BUILD_LIBJAVA)
2947

2948
BUILD_LIBRARIES += $(BUILD_LIBJSOUNDALSA)
2949 2950 2951 2952 2953 2954 2955 2956

endif

##########################################################################################

ifneq ($(filter jsoundds, $(EXTRA_SOUND_JNI_LIBS)),)

$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDDS,\
2957 2958
		LIBRARY:=jsoundds,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2959
		SRC:=$(LIBJSOUND_SRC_DIRS),\
2960
		INCLUDE_FILES:=Utilities.c $(LIBJSOUND_DAUDIOFILES) \
2961
				PLATFORM_API_WinOS_DirectSound.cpp, \
2962 2963 2964
		LANG:=C++,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
2965
			$(LIBJSOUND_CFLAGS) \
2966 2967
			-DUSE_DAUDIO=TRUE \
                        -I$(DXSDK_INCLUDE_PATH), \
2968
		LDFLAGS:=$(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
2969 2970
			 $(call SET_SHARED_LIBRARY_ORIGIN),\
		LDFLAGS_SUFFIX:=$(LDFLAGS_JDKLIB_SUFFIX) dsound.lib winmm.lib user32.lib ole32.lib,\
2971 2972
		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
		RC_FLAGS:=$(RC_FLAGS)\
O
ohair 已提交
2973 2974 2975
			  -D "JDK_FNAME=jsoundds.dll" \
			  -D "JDK_INTERNAL_NAME=jsoundds" \
			  -D "JDK_FTYPE=0x2L",\
2976
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundds,\
2977
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
2978

2979
$(BUILD_LIBJSOUNDDS) : $(BUILD_LIBJAVA)
2980

2981
BUILD_LIBRARIES += $(BUILD_LIBJSOUNDDS)
2982 2983 2984 2985 2986

endif

##########################################################################################

2987
ifeq ($(OPENJDK_TARGET_OS), solaris)
2988 2989 2990
ifndef OPENJDK

$(eval $(call SetupNativeCompilation,BUILD_LIBJ2UCRYPTO,\
2991 2992
		LIBRARY:=j2ucrypto,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
2993
		SRC:=$(JDK_TOPDIR)/src/closed/solaris/native/com/oracle/security/ucrypto,\
2994 2995 2996
		LANG:=C,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
2997
			-I$(JDK_TOPDIR)/src/closed/solaris/native/com/oracle/security/ucrypto ,\
2998
		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2ucrypto/mapfile-vers, \
2999
		LDFLAGS:=$(LDFLAGS_JDKLIB),\
3000
		LDFLAGS_SUFFIX:=$(LIBDL),\
3001
		LDFLAGS_SUFFIX_solaris:=-lc,\
3002 3003
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2ucrypto,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
3004

3005
$(BUILD_LIBJ2UCRYPTO) : $(BUILD_LIBJAVA)
3006

3007
BUILD_LIBRARIES += $(BUILD_LIBJ2UCRYPTO)
3008 3009 3010 3011 3012 3013

endif
endif

##########################################################################################

3014
ifeq ($(OPENJDK_TARGET_OS), macosx)
3015 3016

$(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE,\
3017 3018
		LIBRARY:=AppleScriptEngine,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
3019
		SRC:=$(JDK_TOPDIR)/src/macosx/native/apple/applescript,\
3020 3021 3022
		LANG:=C,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
3023 3024 3025 3026 3027
			-I$(JDK_TOPDIR)/src/macosx/native/apple/applescript \
			-F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                        -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
		LDFLAGS:=$(LDFLAGS_JDKLIB)\
			 $(call SET_SHARED_LIBRARY_ORIGIN), \
3028 3029 3030 3031 3032
		LDFLAGS_SUFFIX:=-framework Cocoa \
                                -framework Carbon \
                                -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                                -framework JavaNativeFoundation \
                                $(LDFLAGS_JDKLIB_SUFFIX),\
3033 3034
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libAppleScriptEngine,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
3035

3036 3037 3038
$(BUILD_LIBAPPLESCRIPTENGINE) : $(BUILD_LIBJAVA)

BUILD_LIBRARIES += $(BUILD_LIBAPPLESCRIPTENGINE)
3039 3040 3041 3042 3043

endif

##########################################################################################

3044
ifeq ($(OPENJDK_TARGET_OS), macosx)
3045 3046

$(eval $(call SetupNativeCompilation,BUILD_LIBOSXAPP,\
3047 3048
		LIBRARY:=osxapp,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
3049
		SRC:=$(JDK_TOPDIR)/src/macosx/native/sun/osxapp,\
3050 3051 3052
		LANG:=C,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
3053
			-I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
O
ohair 已提交
3054
			-I$(JDK_OUTPUTDIR)/gensrc/sun/osxapp \
3055 3056 3057 3058
                        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                        -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks,\
		LDFLAGS:=$(LDFLAGS_JDKLIB)\
			 $(call SET_SHARED_LIBRARY_ORIGIN), \
3059
		LDFLAGS_SUFFIX_macosx:=\
3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072
	-framework Accelerate \
	-framework ApplicationServices \
	-framework AudioToolbox \
	-framework Carbon \
	-framework Cocoa \
	-framework Security \
	-framework ExceptionHandling \
        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
	-framework JavaNativeFoundation \
	-framework JavaRuntimeSupport \
	-framework OpenGL \
	-framework IOSurface \
	-framework QuartzCore, \
3073 3074
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxapp,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
3075

3076
BUILD_LIBRARIES += $(BUILD_LIBOSXAPP)
3077 3078 3079 3080 3081

endif

##########################################################################################

3082
ifeq ($(OPENJDK_TARGET_OS), macosx)
3083

3084
LIBOSX_DIRS:=\
3085 3086 3087 3088 3089 3090 3091
  $(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \
  $(JDK_TOPDIR)/src/macosx/native/java/util \
  $(JDK_TOPDIR)/src/macosx/native/com/apple/eio \
  $(JDK_TOPDIR)/src/macosx/native/apple/security \
  $(JDK_TOPDIR)/src/macosx/native/apple/launcher

$(eval $(call SetupNativeCompilation,BUILD_LIBOSX,\
3092 3093
		LIBRARY:=osx,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
3094
		SRC:=$(LIBOSX_DIRS),\
3095 3096 3097
		LANG:=C,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
3098 3099 3100 3101 3102 3103
                        $(foreach dir,$(LIBOSX_DIRS),-I$(dir)) \
                        -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
                        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                        -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks,\
		LDFLAGS:=$(LDFLAGS_JDKLIB)\
			 $(call SET_SHARED_LIBRARY_ORIGIN), \
3104
		LDFLAGS_SUFFIX_macosx:=\
3105 3106 3107 3108 3109 3110 3111 3112 3113
    -losxapp \
    -framework Cocoa \
    -framework ApplicationServices \
    -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
    -framework JavaNativeFoundation \
    -framework JavaRuntimeSupport \
    -framework Security \
    -framework SystemConfiguration \
    $(LDFLAGS_JDKLIB_SUFFIX), \
3114 3115
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosx,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
3116

3117
BUILD_LIBRARIES += $(BUILD_LIBOSX)
3118

3119
$(BUILD_LIBOSX) : $(BUILD_LIBOSXAPP)
3120

3121
$(BUILD_LIBOSX) : $(BUILD_LIBJAVA)
3122 3123 3124 3125 3126

endif

##########################################################################################

3127
ifeq ($(OPENJDK_TARGET_OS), macosx)
3128

3129
LIBAWT_LWAWT_FILES:=\
3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203
        awt.m \
        ApplicationDelegate.m \
        CFRetainedResource.m \
        CGLGraphicsConfig.m \
        CGLSurfaceData.m \
        CGLLayer.m \
        CGraphicsConfig.m \
        CGraphicsDevice.m \
        CGraphicsEnv.m \
        CCharToGlyphMapper.m \
        CSystemColors.m \
        AWTFont.m \
        CGGlyphOutlines.m \
        CGGlyphImages.m \
        CoreTextSupport.m \
        AWTStrike.m \
        InitIDs.m \
        AWTEvent.m \
        AWTView.m \
        AWTWindow.m \
        AWTSurfaceLayers.m \
        CCursorManager.m \
        CClipboard.m \
        CDataTransferer.m \
        CDragSource.m \
        CDragSourceContextPeer.m \
        CDropTarget.m \
        CDropTargetContextPeer.m \
        CInputMethod.m \
        CDesktopPeer.m \
        OSVersion.m \
        DnDUtilities.m \
        CFileDialog.m \
        CImage.m \
        CMenu.m \
        CMenuBar.m \
        CMenuComponent.m \
        CMenuItem.m \
        CPopupMenu.m \
        CRobot.m \
        CTrayIcon.m \
        CWrapper.m \
        JavaAccessibilityAction.m \
        JavaAccessibilityUtilities.m \
        JavaComponentAccessibility.m \
        JavaTextAccessibility.m \
        LWCToolkit.m \
        GeomUtilities.m \
        CPrinterJob.m \
        PrintModel.m \
        PrinterSurfaceData.m \
        PrinterView.m \
        QuartzSurfaceData.m \
        QuartzRenderer.m \
        CTextPipe.m \
        ImageSurfaceData.m \
        awt_DrawingSurface.m \
        \
        OGLBlitLoops.c \
        OGLBufImgOps.c \
        OGLContext.c \
        OGLFuncs.c \
        OGLMaskBlit.c \
        OGLMaskFill.c \
        OGLPaints.c \
        OGLRenderQueue.c \
        OGLRenderer.c \
        OGLSurfaceData.c \
        OGLTextRenderer.c \
        OGLVertexCache.c \
        AccelGlyphCache.c \
        CUPSfuncs.c


3204
LIBAWT_LWAWT_DIRS:=\
3205 3206 3207 3208 3209 3210 3211 3212
  $(JDK_TOPDIR)/src/macosx/native/sun/awt \
  $(JDK_TOPDIR)/src/macosx/native/sun/font \
  $(JDK_TOPDIR)/src/macosx/native/sun/java2d/opengl \
  $(JDK_TOPDIR)/src/solaris/native/sun/awt \
  $(JDK_TOPDIR)/src/share/native/sun/font \
  $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \

$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_LWAWT,\
3213 3214
		LIBRARY:=awt_lwawt,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
3215
		SRC:=$(LIBAWT_LWAWT_DIRS),\
3216
		LANG:=C,\
3217
		INCLUDE_FILES:=$(LIBAWT_LWAWT_FILES),\
3218 3219
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
3220 3221
                        $(X_CFLAGS) \
                        $(X_LIBS) \
3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234
                        $(foreach dir,$(LIBAWT_LWAWT_DIRS),-I$(dir)) \
                        -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
                        -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
                        -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d \
                        -I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
                        -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
                        -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
                        -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
                        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
                        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                        -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks,\
		LDFLAGS:=$(LDFLAGS_JDKLIB)\
			 $(call SET_SHARED_LIBRARY_ORIGIN), \
3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247
		LDFLAGS_SUFFIX_macosx:=-lawt -lmlib_image -losxapp -ljvm $(LIBM) \
				       -framework Accelerate \
				       -framework ApplicationServices \
				       -framework AudioToolbox \
				       -framework Carbon \
				       -framework Cocoa \
				       -framework Security \
				       -framework ExceptionHandling \
				       -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
				       -framework JavaNativeFoundation \
				       -framework JavaRuntimeSupport \
				       -framework OpenGL \
				       -framework QuartzCore -ljava,\
3248 3249
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libawt_lwawt,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
3250

3251
BUILD_LIBRARIES += $(BUILD_LIBAWT_LWAWT)
3252

3253
$(BUILD_LIBAWT_LWAWT) : $(BUILD_LIBAWT)
3254

3255
$(BUILD_LIBAWT_LWAWT) : $(BUILD_LIBMLIB_IMAGE)
3256

3257
$(BUILD_LIBAWT_LWAWT) : $(BUILD_LIBOSXAPP)
3258

3259
$(BUILD_LIBAWT_LWAWT) : $(BUILD_LIBJAVA)
3260 3261 3262 3263 3264

endif

##########################################################################################

3265
ifeq ($(OPENJDK_TARGET_OS), macosx)
3266 3267

$(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI,\
3268 3269
		LIBRARY:=osxui,\
                OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
3270
		SRC:=$(JDK_TOPDIR)/src/macosx/native/com/apple/laf,\
3271 3272 3273
		LANG:=C,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=$(CFLAGS_JDKLIB) \
3274 3275 3276 3277 3278
                        -I$(JDK_TOPDIR)/src/macosx/native/com/apple/laf \
			-I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
			-I$(JDK_TOPDIR)/src/macosx/native/sun/awt \
                        -F/System/Library/Frameworks/JavaVM.framework/Frameworks, \
		LDFLAGS:=$(LDFLAGS_JDKLIB)\
3279 3280 3281 3282 3283 3284 3285 3286 3287 3288
			 $(call SET_SHARED_LIBRARY_ORIGIN) \
			 -Xlinker -rpath -Xlinker @loader_path,\
		LDFLAGS_SUFFIX_macosx:=-lawt -losxapp -lawt_lwawt \
				       -framework Cocoa \
				       -framework Carbon \
				       -framework ApplicationServices \
				       -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
				       -framework JavaNativeFoundation \
				       -framework JavaRuntimeSupport \
				       -ljava -ljvm,\
3289 3290
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libosxui,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
3291 3292 3293

BUILD_LIBRARIES += $(BUILD_LIBOSXUI)

3294
$(BUILD_LIBOSXUI) : $(BUILD_LIBAWT)
3295 3296

$(BUILD_LIBOSXUI) : $(BUILD_LIBOSXAPP)
3297

3298
$(BUILD_LIBOSXUI) : $(BUILD_LIBAWT_LWAWT)
3299

3300
#$(BUILD_LIBOSXUI) : $(BUILD_LIBJAVA)
3301

3302 3303 3304 3305 3306
endif

##########################################################################################

ifeq ($(OPENJDK_TARGET_OS), macosx)
3307

3308 3309 3310 3311
# Ugly hack to mimic behaviour in old build where this is built as an xcode project.
SET_SHARED_LIBRARY_NAME=-Xlinker -install_name -Xlinker /usr/local/lib/libJObjC.dylib

$(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC32,\
3312
		LIBRARY:=JObjC,\
3313 3314 3315 3316 3317 3318 3319 3320
                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc32,\
		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/native \
                     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/native ,\
		LANG:=C,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=-fpascal-strings \
                        -fobjc-gc \
                        -gdwarf-2 \
3321
                        $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers_jobjc \
3322 3323 3324 3325 3326 3327 3328 3329
                        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
			-m32,\
		LDFLAGS:=$(LDFLAGS_JDKLIB)\
			-m32, \
		LDFLAGS_SUFFIX:=-framework Foundation -framework JavaVM \
                                  -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                                  -framework JavaNativeFoundation \
                                  -lffi, \
3330 3331
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc32,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
3332 3333 3334 3335

$(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC64,\
		LIBRARY:=JObjC,\
                OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc64,\
3336 3337 3338 3339 3340 3341 3342
		SRC:=$(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/native \
                     $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/native ,\
		LANG:=C,\
		OPTIMIZATION:=LOW, \
		CFLAGS:=-fpascal-strings \
                        -fobjc-gc \
                        -gdwarf-2 \
3343
                        $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers_jobjc \
3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354
                        -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
			, \
		LDFLAGS:=-fpascal-strings \
                         -fobjc-gc \
                         -gdwarf-2 \
                         $(LDFLAGS_JDKLIB)\
			 $(call SET_SHARED_LIBRARY_ORIGIN), \
		LDFLAGS_SUFFIX:=-framework Foundation -framework JavaVM \
                                  -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
                                  -framework JavaNativeFoundation \
                                  -lffi, \
3355 3356
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjobjc64,\
		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
3357 3358 3359

$(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX): $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
	$(LIPO) -create -output $@ $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
3360

3361
BUILD_LIBRARIES += $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX)
3362 3363 3364

endif

3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455
##########################################################################################

ifndef OPENJDK
ifeq ($(OPENJDK_TARGET_OS), windows)

  ACCESSBRIDGE_SRCDIR:=$(JDK_TOPDIR)/src/closed/windows/native/sun/bridge

  define SetupAccessBridge
    # Parameter 1 Suffix
    # Parameter 2 Machine
    # Parameter 3 ACCESSBRIDGE_ARCH_ suffix

    $(call SetupNativeCompilation,BUILD_JAWTACCESSBRIDGE$1,\
		LIBRARY=JAWTAccessBridge$1,\
		OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
		SRC:=$(ACCESSBRIDGE_SRCDIR),\
		INCLUDE_FILES:=JAWTAccessBridge.cpp,\
		LANG:=C++,\
		OPTIMIZATION:=LOW,\
		CFLAGS:=$(CFLAGS_JDKLIB) \
			-DACCESSBRIDGE_ARCH_$3,\
		LDFLAGS:=$(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
			 winspool.lib jawt.lib comdlg32.lib advapi32.lib shell32.lib \
			 ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
			 -subsystem:windows -machine:$2 \
			 -def:$(ACCESSBRIDGE_SRCDIR)/JAWTAccessBridge.DEF,\
		VERSIONINFO_RESOURCE:=$(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc,\
		RC_FLAGS:=$(RC_FLAGS),\
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjawtaccessbridge$1,\
		DEBUG_SYMBOLS:=true)

    $$(BUILD_JAWTACCESSBRIDGE$1): $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)

    $(call SetupNativeCompilation,BUILD_JAVAACCESSBRIDGE$1,\
		LIBRARY=JavaAccessBridge$1,\
		OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
		SRC:=$(ACCESSBRIDGE_SRCDIR),\
		INCLUDE_FILES:=AccessBridgeATInstance.cpp AccessBridgeDebug.cpp \
			       AccessBridgeJavaEntryPoints.cpp \
			       AccessBridgeMessages.cpp JavaAccessBridge.cpp,\
		LANG:=C++,\
		OPTIMIZATION:=LOW,\
		CFLAGS:=$(CFLAGS_JDKLIB) \
			-DACCESSBRIDGE_ARCH_$3,\
		LDFLAGS:=$(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
			 winspool.lib comdlg32.lib advapi32.lib shell32.lib \
			 ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
			 -subsystem:windows -machine:$2 \
			 -def:$(ACCESSBRIDGE_SRCDIR)/JavaAccessBridge.DEF,\
		VERSIONINFO_RESOURCE:=$(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc,\
		RC_FLAGS:=$(RC_FLAGS),\
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjavaaccessbridge$1,\
		DEBUG_SYMBOLS:=true)

    $(call SetupNativeCompilation,BUILD_WINDOWSACCESSBRIDGE$1,\
		LIBRARY=WindowsAccessBridge$1,\
		OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
		SRC:=$(ACCESSBRIDGE_SRCDIR),\
		INCLUDE_FILES:=AccessBridgeJavaVMInstance.cpp AccessBridgeMessageQueue.cpp \
			       AccessBridgeMessages.cpp AccessBridgeWindowsEntryPoints.cpp \
			       WinAccessBridge.cpp AccessBridgeDebug.cpp \
			       AccessBridgeEventHandler.cpp,\
		LANG:=C++,\
		OPTIMIZATION:=LOW,\
		CFLAGS:=$(filter-out -MD,$(CFLAGS_JDKLIB)) -MT \
			-DACCESSBRIDGE_ARCH_$3,\
		LDFLAGS:=$(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
			 winspool.lib comdlg32.lib advapi32.lib shell32.lib \
			 ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
			 -subsystem:windows -machine:$2 \
			 -def:$(ACCESSBRIDGE_SRCDIR)/WinAccessBridge.DEF,\
		VERSIONINFO_RESOURCE:=$(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc,\
		RC_FLAGS:=$(RC_FLAGS),\
		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libwindowsaccessbridge$1,\
		DEBUG_SYMBOLS:=true)

    BUILD_LIBRARIES += $$(BUILD_JAWTACCESSBRIDGE$1) $$(BUILD_JAVAACCESSBRIDGE$1) \
		       $$(BUILD_WINDOWSACCESSBRIDGE$1)

  endef

  ifeq ($(OPENJDK_TARGET_CPU_BITS),32)
    $(eval $(call SetupAccessBridge,-32,I386,32))
    $(eval $(call SetupAccessBridge,,I386,LEGACY))
  else
    $(eval $(call SetupAccessBridge,-64,X64,64))
  endif
endif
endif


3456 3457 3458 3459 3460
##########################################################################################

all: $(COPY_FILES) $(BUILD_LIBRARIES)

.PHONY: all