112 $1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \ |
112 $1_$2_DEBUG_OUT_FLAGS:=-Fd$$(patsubst %$(OBJ_SUFFIX),%.pdb,$$($1_$2_OBJ)) \ |
113 -Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ)) |
113 -Fm$$(patsubst %$(OBJ_SUFFIX),%.map,$$($1_$2_OBJ)) |
114 endif |
114 endif |
115 endif |
115 endif |
116 |
116 |
117 $$($1_$2_OBJ) : $2 | $$($1_BUILD_INFO) |
117 $$($1_$2_OBJ) : $2 $$($1_COMPILE_VARDEPS_FILE) | $$($1_BUILD_INFO) |
118 $(ECHO) $(LOG_INFO) "Compiling $$(notdir $2) (for $$(notdir $$($1_TARGET)))" |
118 $(ECHO) $(LOG_INFO) "Compiling $$(notdir $2) (for $$(notdir $$($1_TARGET)))" |
119 ifneq ($(TOOLCHAIN_TYPE), microsoft) |
119 ifneq ($(TOOLCHAIN_TYPE), microsoft) |
120 # The Solaris studio compiler doesn't output the full path to the object file in the |
120 # The Solaris studio compiler doesn't output the full path to the object file in the |
121 # generated deps files. Fixing it with sed. If compiling assembly, don't try this. |
121 # generated deps files. Fixing it with sed. If compiling assembly, don't try this. |
122 ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s,$2), solstudio) |
122 ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s,$2), solstudio) |
304 ifeq ($$($1_OBJC),) |
304 ifeq ($$($1_OBJC),) |
305 $1_OBJC:=$(OBJC) |
305 $1_OBJC:=$(OBJC) |
306 endif |
306 endif |
307 |
307 |
308 # Make sure the dirs exist. |
308 # Make sure the dirs exist. |
309 $$(eval $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR))) |
309 $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR)) |
310 $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d))) |
310 $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d))) |
311 |
311 |
312 # Find all files in the source trees. Sort to remove duplicates. |
312 # Find all files in the source trees. Sort to remove duplicates. |
313 $1_ALL_SRCS := $$(sort $$(call CacheFind,$$($1_SRC))) |
313 $1_ALL_SRCS := $$(sort $$(call CacheFind,$$($1_SRC))) |
314 # Extract the C/C++ files. |
314 # Extract the C/C++ files. |
424 $$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION)) |
424 $$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION)) |
425 endif |
425 endif |
426 |
426 |
427 $1_BUILD_INFO := $$($1_OBJECT_DIR)/_build-info.marker |
427 $1_BUILD_INFO := $$($1_OBJECT_DIR)/_build-info.marker |
428 |
428 |
429 # Setup rule for printing progress info when compiling source files. |
429 # Track variable changes for all variables that affect the compilation command |
430 # This is a rough heuristic and may not always print accurate information. |
430 # lines for all object files in this setup. This includes at least all the |
431 $$($1_BUILD_INFO): $$($1_SRCS) |
431 # variables used in the call to add_native_source below. |
432 ifeq ($$(wildcard $$($1_TARGET)),) |
432 $1_COMPILE_VARDEPS := $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $(SYSROOT_CFLAGS) \ |
433 $(ECHO) 'Creating $$($1_BASENAME) from $$(words $$?) file(s)' |
433 $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) \ |
434 else |
434 $$($1_CC) $$($1_CXX) $$($1_OBJC) $$($1_ASFLAGS) \ |
435 $(ECHO) 'Updating $$($1_BASENAME) from $$(words $$?) file(s)' |
435 $$(foreach s, $$($1_SRCS), \ |
436 endif |
436 $$($1_$$(notdir $$s)_CFLAGS) $$($1_$$(notdir $$s)_CXXFLAGS)) |
437 $(TOUCH) $$@ |
437 $1_COMPILE_VARDEPS_FILE := $$(call DependOnVariable, $1_COMPILE_VARDEPS, \ |
|
438 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).comp.vardeps) |
438 |
439 |
439 # Now call add_native_source for each source file we are going to compile. |
440 # Now call add_native_source for each source file we are going to compile. |
440 $$(foreach p,$$($1_SRCS), \ |
441 $$(foreach p,$$($1_SRCS), \ |
441 $$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR), \ |
442 $$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR), \ |
442 $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $(SYSROOT_CFLAGS), \ |
443 $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $(SYSROOT_CFLAGS), \ |
443 $$($1_CC), \ |
444 $$($1_CC), \ |
444 $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $(SYSROOT_CFLAGS), \ |
445 $$($1_CXXFLAGS) $$($1_EXTRA_CXXFLAGS) $(SYSROOT_CFLAGS), \ |
445 $$($1_CXX),$$($1_OBJC),$$($1_ASFLAGS)))) |
446 $$($1_CXX),$$($1_OBJC),$$($1_ASFLAGS)))) |
446 |
447 |
|
448 # Setup rule for printing progress info when compiling source files. |
|
449 # This is a rough heuristic and may not always print accurate information. |
|
450 $$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE) |
|
451 ifeq ($$(wildcard $$($1_TARGET)),) |
|
452 $(ECHO) 'Creating $$($1_BASENAME) from $$(words $$(filter-out %.vardeps, $$?)) file(s)' |
|
453 else |
|
454 $(ECHO) 'Updating $$($1_BASENAME) from $$(words $$(filter-out %.vardeps, $$?)) file(s)' |
|
455 endif |
|
456 $(TOUCH) $$@ |
|
457 |
447 # On windows we need to create a resource file |
458 # On windows we need to create a resource file |
448 ifeq ($(OPENJDK_TARGET_OS), windows) |
459 ifeq ($(OPENJDK_TARGET_OS), windows) |
449 ifneq (,$$($1_VERSIONINFO_RESOURCE)) |
460 ifneq (,$$($1_VERSIONINFO_RESOURCE)) |
450 $1_RES:=$$($1_OBJECT_DIR)/$$($1_BASENAME).res |
461 $1_RES:=$$($1_OBJECT_DIR)/$$($1_BASENAME).res |
451 $1_RES_DEP:=$$($1_RES).d |
462 $1_RES_DEP:=$$($1_RES).d |
452 -include $$($1_RES_DEP) |
463 -include $$($1_RES_DEP) |
453 $$($1_RES): $$($1_VERSIONINFO_RESOURCE) |
464 |
|
465 $1_RES_VARDEPS := $(RC) $$($1_RC_FLAGS) |
|
466 $1_RES_VARDEPS_FILE := $$(call DependOnVariable, $1_RES_VARDEPS, \ |
|
467 $$($1_RES).vardeps) |
|
468 |
|
469 $$($1_RES): $$($1_VERSIONINFO_RESOURCE) $$($1_RES_VARDEPS_FILE) |
454 $(ECHO) $(LOG_INFO) "Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET)))" |
470 $(ECHO) $(LOG_INFO) "Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET)))" |
455 $(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE) |
471 $(RC) $$($1_RC_FLAGS) $(CC_OUT_OPTION)$$@ $$($1_VERSIONINFO_RESOURCE) |
456 # Windows RC compiler does not support -showIncludes, so we mis-use CL for this. |
472 # Windows RC compiler does not support -showIncludes, so we mis-use CL for this. |
457 $(CC) $$($1_RC_FLAGS) -showIncludes -nologo -TC \ |
473 $(CC) $$($1_RC_FLAGS) -showIncludes -nologo -TC \ |
458 $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || exit 0 |
474 $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || exit 0 |
460 && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw) > $$($1_RES_DEP) |
476 && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw) > $$($1_RES_DEP) |
461 endif |
477 endif |
462 ifneq (,$$($1_MANIFEST)) |
478 ifneq (,$$($1_MANIFEST)) |
463 $1_GEN_MANIFEST:=$$($1_OBJECT_DIR)/$$($1_PROGRAM).manifest |
479 $1_GEN_MANIFEST:=$$($1_OBJECT_DIR)/$$($1_PROGRAM).manifest |
464 IMVERSIONVALUE:=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VERSION).$(COOKED_BUILD_NUMBER) |
480 IMVERSIONVALUE:=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VERSION).$(COOKED_BUILD_NUMBER) |
465 $$($1_GEN_MANIFEST): $$($1_MANIFEST) |
481 $1_MANIFEST_VARDEPS_FILE := $$(call DependOnVariable, IMVERSIONVALUE, \ |
|
482 $$($1_GEN_MANIFEST).vardeps) |
|
483 $$($1_GEN_MANIFEST): $$($1_MANIFEST) $$($1_MANIFEST_VARDEPS_FILE) |
466 $(SED) 's%IMVERSION%$$(IMVERSIONVALUE)%g;s%PROGRAM%$$($1_PROGRAM)%g' $$< > $$@ |
484 $(SED) 's%IMVERSION%$$(IMVERSIONVALUE)%g;s%PROGRAM%$$($1_PROGRAM)%g' $$< > $$@ |
467 endif |
485 endif |
468 endif |
486 endif |
469 |
487 |
470 # mapfile doesnt seem to be implemented on macosx (yet??) |
488 # mapfile doesnt seem to be implemented on macosx (yet??) |
573 $1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib" |
591 $1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib" |
574 endif |
592 endif |
575 |
593 |
576 $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX) |
594 $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX) |
577 |
595 |
|
596 $1_VARDEPS := $$($1_LD) $(SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ |
|
597 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |
|
598 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ |
|
599 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) |
|
600 |
578 $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \ |
601 $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \ |
579 $$($1_DEBUGINFO_EXTRA_DEPS) |
602 $$($1_DEBUGINFO_EXTRA_DEPS) $$($1_VARDEPS_FILE) |
580 $(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)" |
603 $(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)" |
581 $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(SYSROOT_LDFLAGS) \ |
604 $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(SYSROOT_LDFLAGS) \ |
582 $(LD_OUT_OPTION)$$@ \ |
605 $(LD_OUT_OPTION)$$@ \ |
583 $$($1_EXPECTED_OBJS) $$($1_RES) \ |
606 $$($1_EXPECTED_OBJS) $$($1_RES) \ |
584 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |
607 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |
590 endif |
613 endif |
591 |
614 |
592 endif |
615 endif |
593 |
616 |
594 ifneq (,$$($1_STATIC_LIBRARY)) |
617 ifneq (,$$($1_STATIC_LIBRARY)) |
|
618 $1_VARDEPS := $(AR) $$($1_ARFLAGS) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |
|
619 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ |
|
620 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) |
|
621 |
595 # Generating a static library, ie object file archive. |
622 # Generating a static library, ie object file archive. |
596 $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) |
623 $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) |
597 $(ECHO) $(LOG_INFO) "Archiving $$($1_STATIC_LIBRARY)" |
624 $(ECHO) $(LOG_INFO) "Archiving $$($1_STATIC_LIBRARY)" |
598 $(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \ |
625 $(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \ |
599 $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |
626 $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |
600 endif |
627 endif |
601 |
628 |
602 ifneq (,$$($1_PROGRAM)) |
629 ifneq (,$$($1_PROGRAM)) |
603 # A executable binary has been specified, setup the target for it. |
630 # A executable binary has been specified, setup the target for it. |
604 $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX) |
631 $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX) |
605 |
632 |
|
633 $1_VARDEPS := $$($1_LDEXE) $(SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ |
|
634 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |
|
635 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ |
|
636 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) |
|
637 |
606 $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST) \ |
638 $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST) \ |
607 $$($1_DEBUGINFO_EXTRA_DEPS) |
639 $$($1_DEBUGINFO_EXTRA_DEPS) $$($1_VARDEPS_FILE) |
608 $(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)" |
640 $(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)" |
609 $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(SYSROOT_LDFLAGS) \ |
641 $$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(SYSROOT_LDFLAGS) \ |
610 $(EXE_OUT_OPTION)$$($1_TARGET) \ |
642 $(EXE_OUT_OPTION)$$($1_TARGET) \ |
611 $$($1_EXPECTED_OBJS) $$($1_RES) \ |
643 $$($1_EXPECTED_OBJS) $$($1_RES) \ |
612 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |
644 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) |