1 # |
1 # |
2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
2 # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 # |
4 # |
5 # This code is free software; you can redistribute it and/or modify it |
5 # This code is free software; you can redistribute it and/or modify it |
6 # under the terms of the GNU General Public License version 2 only, as |
6 # under the terms of the GNU General Public License version 2 only, as |
7 # published by the Free Software Foundation. Oracle designates this |
7 # published by the Free Software Foundation. Oracle designates this |
229 $$(OUTPUTDIR)/,,$$($1_OBJ))).json |
229 $$(OUTPUTDIR)/,,$$($1_OBJ))).json |
230 $$($1_BASE)_ALL_OBJS_JSON += $$($1_OBJ_JSON) |
230 $$($1_BASE)_ALL_OBJS_JSON += $$($1_OBJ_JSON) |
231 |
231 |
232 # Only continue if this object file hasn't been processed already. This lets |
232 # Only continue if this object file hasn't been processed already. This lets |
233 # the first found source file override any other with the same name. |
233 # the first found source file override any other with the same name. |
234 ifeq ($$(findstring $$($1_OBJ), $$($$($1_BASE)_OBJS_SO_FAR)), ) |
234 ifeq ($$($1_OBJ_PROCESSED), ) |
235 $$($1_BASE)_OBJS_SO_FAR += $$($1_OBJ) |
235 $1_OBJ_PROCESSED := true |
236 # This is the definite source file to use for $1_FILENAME. |
236 # This is the definite source file to use for $1_FILENAME. |
237 $1_SRC_FILE := $$($1_FILE) |
237 $1_SRC_FILE := $$($1_FILE) |
238 |
238 |
239 ifneq ($$($1_DISABLE_THIS_FILE_DEFINE), true) |
239 ifneq ($$($1_DEFINE_THIS_FILE), false) |
240 $1_THIS_FILE = -DTHIS_FILE='"$$($1_FILENAME)"' |
240 ifneq ($$($$($1_BASE)_DEFINE_THIS_FILE), false) |
|
241 $1_THIS_FILE = -DTHIS_FILE='"$$($1_FILENAME)"' |
|
242 endif |
241 endif |
243 endif |
242 |
244 |
243 ifeq ($$($1_OPTIMIZATION), ) |
245 ifeq ($$($1_OPTIMIZATION), ) |
244 $1_OPT_CFLAGS := $$($$($1_BASE)_OPT_CFLAGS) |
246 $1_OPT_CFLAGS := $$($$($1_BASE)_OPT_CFLAGS) |
245 $1_OPT_CXXFLAGS := $$($$($1_BASE)_OPT_CXXFLAGS) |
247 $1_OPT_CXXFLAGS := $$($$($1_BASE)_OPT_CXXFLAGS) |
306 $$(error Internal error in NativeCompilation.gmk: no compiler for file $$($1_FILENAME)) |
308 $$(error Internal error in NativeCompilation.gmk: no compiler for file $$($1_FILENAME)) |
307 endif |
309 endif |
308 |
310 |
309 ifeq ($$(filter %.s %.S, $$($1_FILENAME)), ) |
311 ifeq ($$(filter %.s %.S, $$($1_FILENAME)), ) |
310 # And this is the dependency file for this obj file. |
312 # And this is the dependency file for this obj file. |
311 $1_DEP := $$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_OBJ)) |
313 $1_DEPS_FILE := $$(patsubst %$(OBJ_SUFFIX),%.d,$$($1_OBJ)) |
312 # The dependency target file lists all dependencies as empty targets to |
314 # The dependency target file lists all dependencies as empty targets to |
313 # avoid make error "No rule to make target" for removed files |
315 # avoid make error "No rule to make target" for removed files |
314 $1_DEP_TARGETS := $$(patsubst %$(OBJ_SUFFIX),%.d.targets,$$($1_OBJ)) |
316 $1_DEPS_TARGETS_FILE := $$(patsubst %$(OBJ_SUFFIX),%.d.targets,$$($1_OBJ)) |
315 |
317 |
316 # Include previously generated dependency information. (if it exists) |
318 # Only try to load individual dependency information files if the global |
317 -include $$($1_DEP) |
319 # file hasn't been loaded (could happen if make was interrupted). |
318 -include $$($1_DEP_TARGETS) |
320 ifneq ($$($$($1_BASE)_DEPS_FILE_LOADED), true) |
|
321 # Include previously generated dependency information. (if it exists) |
|
322 -include $$($1_DEPS_FILE) |
|
323 -include $$($1_DEPS_TARGETS_FILE) |
|
324 endif |
319 endif |
325 endif |
320 |
326 |
321 ifneq ($$(strip $$($1_CFLAGS) $$($1_CXXFLAGS) $$($1_OPTIMIZATION)), ) |
327 ifneq ($$(strip $$($1_CFLAGS) $$($1_CXXFLAGS) $$($1_OPTIMIZATION)), ) |
322 $1_VARDEPS := $$($1_CFLAGS) $$($1_CXXFLAGS) $$($1_OPTIMIZATION) |
328 $1_VARDEPS := $$($1_CFLAGS) $$($1_CXXFLAGS) $$($1_OPTIMIZATION) |
323 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_OBJ).vardeps) |
329 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_OBJ).vardeps) |
338 ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s, $$($1_FILENAME)), solstudio) |
344 ifeq ($(TOOLCHAIN_TYPE)$$(filter %.s, $$($1_FILENAME)), solstudio) |
339 # The Solaris studio compiler doesn't output the full path to the |
345 # The Solaris studio compiler doesn't output the full path to the |
340 # object file in the generated deps files. Fixing it with sed. If |
346 # object file in the generated deps files. Fixing it with sed. If |
341 # compiling assembly, don't try this. |
347 # compiling assembly, don't try this. |
342 $$(call ExecuteWithLog, $$@, \ |
348 $$(call ExecuteWithLog, $$@, \ |
343 $$($1_COMPILER) $$($1_DEP_FLAG) $$($1_DEP).tmp $$($1_COMPILE_OPTIONS)) |
349 $$($1_COMPILER) $$($1_DEP_FLAG) $$($1_DEPS_FILE).tmp $$($1_COMPILE_OPTIONS)) |
344 $(SED) 's|^$$(@F):|$$@:|' $$($1_DEP).tmp > $$($1_DEP) |
350 $(SED) 's|^$$(@F):|$$@:|' $$($1_DEPS_FILE).tmp > $$($1_DEPS_FILE) |
345 else |
351 else |
346 $$(call ExecuteWithLog, $$@, \ |
352 $$(call ExecuteWithLog, $$@, \ |
347 $$($1_COMPILER) $$($1_DEP_FLAG) $$($1_DEP) $$($1_COMPILE_OPTIONS)) |
353 $$($1_COMPILER) $$($1_DEP_FLAG) $$($1_DEPS_FILE) $$($1_COMPILE_OPTIONS)) |
348 endif |
354 endif |
349 # Create a dependency target file from the dependency file. |
355 # Create a dependency target file from the dependency file. |
350 # Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ |
356 # Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ |
351 ifneq ($$($1_DEP), ) |
357 ifneq ($$($1_DEPS_FILE), ) |
352 $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_DEP) > $$($1_DEP_TARGETS) |
358 $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_DEPS_FILE) > $$($1_DEPS_TARGETS_FILE) |
353 endif |
359 endif |
354 else |
360 else |
355 # The Visual Studio compiler lacks a feature for generating make |
361 # The Visual Studio compiler lacks a feature for generating make |
356 # dependencies, but by setting -showIncludes, all included files are |
362 # dependencies, but by setting -showIncludes, all included files are |
357 # printed. These are filtered out and parsed into make dependences. |
363 # printed. These are filtered out and parsed into make dependences. |
361 # pipefail is always active on Windows. |
367 # pipefail is always active on Windows. |
362 $$(call ExecuteWithLog, $$@, \ |
368 $$(call ExecuteWithLog, $$@, \ |
363 $$($1_COMPILER) -showIncludes $$($1_COMPILE_OPTIONS)) \ |
369 $$($1_COMPILER) -showIncludes $$($1_COMPILE_OPTIONS)) \ |
364 | $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \ |
370 | $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \ |
365 -e "^$$($1_FILENAME)$$$$" || test "$$$$?" = "1" ; \ |
371 -e "^$$($1_FILENAME)$$$$" || test "$$$$?" = "1" ; \ |
366 $(ECHO) $$@: \\ > $$($1_DEP) ; \ |
372 $(ECHO) $$@: \\ > $$($1_DEPS_FILE) ; \ |
367 $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_OBJ).log \ |
373 $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_OBJ).log \ |
368 | $(SORT) -u >> $$($1_DEP) ; \ |
374 | $(SORT) -u >> $$($1_DEPS_FILE) ; \ |
369 $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_DEP) > $$($1_DEP_TARGETS) |
375 $(ECHO) >> $$($1_DEPS_FILE) ; \ |
|
376 $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_DEPS_FILE) > $$($1_DEPS_TARGETS_FILE) |
370 endif |
377 endif |
371 endif |
378 endif |
372 endef |
379 endef |
373 |
380 |
374 # Setup make rules for creating a native binary (a shared library or an |
381 # Setup make rules for creating a native binary (a shared library or an |
420 # ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol |
427 # ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol |
421 # zipping |
428 # zipping |
422 # STRIPFLAGS Optionally change the flags given to the strip command |
429 # STRIPFLAGS Optionally change the flags given to the strip command |
423 # PRECOMPILED_HEADER Header file to use as precompiled header |
430 # PRECOMPILED_HEADER Header file to use as precompiled header |
424 # PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH |
431 # PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH |
|
432 # DEFINE_THIS_FILE Set to false to not set the THIS_FILE preprocessor macro |
425 # |
433 # |
426 # After being called, some variables are exported from this macro, all prefixed |
434 # After being called, some variables are exported from this macro, all prefixed |
427 # with parameter 1 followed by a '_': |
435 # with parameter 1 followed by a '_': |
428 # TARGET The library or executable created by the macro |
436 # TARGET The library or executable created by the macro |
429 # TARGET_DEPS All prerequisites for the target calculated by the macro |
437 # TARGET_DEPS All prerequisites for the target calculated by the macro |
483 |
491 |
484 $1_BASENAME := $$($1_PREFIX)$$($1_NAME)$$($1_SUFFIX) |
492 $1_BASENAME := $$($1_PREFIX)$$($1_NAME)$$($1_SUFFIX) |
485 $1_TARGET := $$($1_OUTPUT_DIR)/$$($1_BASENAME) |
493 $1_TARGET := $$($1_OUTPUT_DIR)/$$($1_BASENAME) |
486 $1_NOSUFFIX := $$($1_PREFIX)$$($1_NAME) |
494 $1_NOSUFFIX := $$($1_PREFIX)$$($1_NAME) |
487 $1_SAFE_NAME := $$(strip $$(subst /,_, $1)) |
495 $1_SAFE_NAME := $$(strip $$(subst /,_, $1)) |
|
496 |
|
497 # Need to make sure TARGET is first on list |
|
498 $1 := $$($1_TARGET) |
488 |
499 |
489 # Setup the toolchain to be used |
500 # Setup the toolchain to be used |
490 $$(call SetIfEmpty, $1_TOOLCHAIN, TOOLCHAIN_DEFAULT) |
501 $$(call SetIfEmpty, $1_TOOLCHAIN, TOOLCHAIN_DEFAULT) |
491 $$(call SetIfEmpty, $1_CC, $$($$($1_TOOLCHAIN)_CC)) |
502 $$(call SetIfEmpty, $1_CC, $$($$($1_TOOLCHAIN)_CC)) |
492 $$(call SetIfEmpty, $1_CXX, $$($$($1_TOOLCHAIN)_CXX)) |
503 $$(call SetIfEmpty, $1_CXX, $$($$($1_TOOLCHAIN)_CXX)) |
503 # Make sure the dirs exist. |
514 # Make sure the dirs exist. |
504 $$(call MakeDir, $$($1_OBJECT_DIR) $$($1_OUTPUT_DIR)) |
515 $$(call MakeDir, $$($1_OBJECT_DIR) $$($1_OUTPUT_DIR)) |
505 $$(foreach d, $$($1_SRC), $$(if $$(wildcard $$d), , \ |
516 $$(foreach d, $$($1_SRC), $$(if $$(wildcard $$d), , \ |
506 $$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d))) |
517 $$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d))) |
507 |
518 |
508 # Find all files in the source trees. Preserve order. |
519 $1_SRCS_RAW := $$(call FindFiles, $$($1_SRC)) |
509 $1_SRCS := $$(foreach s, $$($1_SRC), $$(call CacheFind, $$(s))) |
520 # Order src files according to the order of the src dirs |
|
521 $1_SRCS := $$(foreach d, $$($1_SRC), $$(filter $$d%, $$($1_SRCS_RAW))) |
510 $1_SRCS := $$(filter $$(NATIVE_SOURCE_EXTENSIONS), $$($1_SRCS)) |
522 $1_SRCS := $$(filter $$(NATIVE_SOURCE_EXTENSIONS), $$($1_SRCS)) |
511 # Extract the C/C++ files. |
523 # Extract the C/C++ files. |
512 ifneq ($$($1_EXCLUDE_PATTERNS), ) |
524 ifneq ($$($1_EXCLUDE_PATTERNS), ) |
513 # We must not match the exclude pattern against the src root(s). |
525 # We must not match the exclude pattern against the src root(s). |
514 $1_SRCS_WITHOUT_ROOTS := $$($1_SRCS) |
526 $1_SRCS_WITHOUT_ROOTS := $$($1_SRCS) |
693 |
705 |
694 $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$($1_GENERATED_PCH_SRC)), \ |
706 $$(eval $$(call SetupCompileNativeFile, $1_$$(notdir $$($1_GENERATED_PCH_SRC)), \ |
695 FILE := $$($1_GENERATED_PCH_SRC), \ |
707 FILE := $$($1_GENERATED_PCH_SRC), \ |
696 BASE := $1, \ |
708 BASE := $1, \ |
697 EXTRA_CXXFLAGS := -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \ |
709 EXTRA_CXXFLAGS := -Fp$$($1_PCH_FILE) -Yc$$(notdir $$($1_PRECOMPILED_HEADER)), \ |
698 DISABLE_THIS_FILE_DEFINE := true, \ |
710 DEFINE_THIS_FILE := false, \ |
699 )) |
711 )) |
700 |
712 |
701 $1_USE_PCH_FLAGS := \ |
713 $1_USE_PCH_FLAGS := \ |
702 -Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER)) |
714 -Fp$$($1_PCH_FILE) -Yu$$(notdir $$($1_PRECOMPILED_HEADER)) |
703 |
715 |
716 $1_USE_PCH_FLAGS := -I$$($1_OBJECT_DIR)/precompiled |
728 $1_USE_PCH_FLAGS := -I$$($1_OBJECT_DIR)/precompiled |
717 else ifeq ($(TOOLCHAIN_TYPE), clang) |
729 else ifeq ($(TOOLCHAIN_TYPE), clang) |
718 $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).pch |
730 $1_PCH_FILE := $$($1_OBJECT_DIR)/precompiled/$$(notdir $$($1_PRECOMPILED_HEADER)).pch |
719 $1_USE_PCH_FLAGS := -include-pch $$($1_PCH_FILE) |
731 $1_USE_PCH_FLAGS := -include-pch $$($1_PCH_FILE) |
720 endif |
732 endif |
721 $1_PCH_DEP := $$($1_PCH_FILE).d |
733 $1_PCH_DEPS_FILE := $$($1_PCH_FILE).d |
722 $1_PCH_DEP_TARGETS := $$($1_PCH_FILE).d.targets |
734 $1_PCH_DEPS_TARGETS_FILE := $$($1_PCH_FILE).d.targets |
723 |
735 |
724 -include $$($1_PCH_DEP) |
736 -include $$($1_PCH_DEPS_FILE) |
725 -include $$($1_PCH_DEP_TARGETS) |
737 -include $$($1_PCH_DEPS_TARGETS_FILE) |
726 |
738 |
727 $1_PCH_COMMAND := $$($1_CC) $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS) \ |
739 $1_PCH_COMMAND := $$($1_CC) $$($1_CFLAGS) $$($1_EXTRA_CFLAGS) $$($1_SYSROOT_CFLAGS) \ |
728 $$($1_OPT_CFLAGS) -x c++-header -c $(C_FLAG_DEPS) $$($1_PCH_DEP) |
740 $$($1_OPT_CFLAGS) -x c++-header -c $(C_FLAG_DEPS) $$($1_PCH_DEPS_FILE) |
729 |
741 |
730 $$($1_PCH_FILE): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE) |
742 $$($1_PCH_FILE): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE) |
731 $$(call LogInfo, Generating precompiled header) |
743 $$(call LogInfo, Generating precompiled header) |
732 $$(call MakeDir, $$(@D)) |
744 $$(call MakeDir, $$(@D)) |
733 $$(call ExecuteWithLog, $$@, $$($1_PCH_COMMAND) $$< -o $$@) |
745 $$(call ExecuteWithLog, $$@, $$($1_PCH_COMMAND) $$< -o $$@) |
734 $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_PCH_DEP) > $$($1_PCH_DEP_TARGETS) |
746 $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_PCH_DEPS_FILE) \ |
|
747 > $$($1_PCH_DEPS_TARGETS_FILE) |
735 |
748 |
736 $$($1_ALL_OBJS): $$($1_PCH_FILE) |
749 $$($1_ALL_OBJS): $$($1_PCH_FILE) |
737 |
750 |
738 # Generate the corresponding compile_commands.json fragment. |
751 # Generate the corresponding compile_commands.json fragment. |
739 $1_PCH_FILE_JSON := $$(MAKESUPPORT_OUTPUTDIR)/compile-commands/$$(subst /,_,$$(subst \ |
752 $1_PCH_FILE_JSON := $$(MAKESUPPORT_OUTPUTDIR)/compile-commands/$$(subst /,_,$$(subst \ |
757 |
770 |
758 # Setup rule for printing progress info when compiling source files. |
771 # Setup rule for printing progress info when compiling source files. |
759 # This is a rough heuristic and may not always print accurate information. |
772 # This is a rough heuristic and may not always print accurate information. |
760 $$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE) |
773 $$($1_BUILD_INFO): $$($1_SRCS) $$($1_COMPILE_VARDEPS_FILE) |
761 ifeq ($$(wildcard $$($1_TARGET)), ) |
774 ifeq ($$(wildcard $$($1_TARGET)), ) |
762 $(ECHO) 'Creating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET)) from $$(words \ |
775 $$(call LogWarn, Creating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET)) from $$(words \ |
763 $$(filter-out %.vardeps, $$?)) file(s)' |
776 $$(filter-out %.vardeps, $$?)) file(s)) |
764 else |
777 else |
765 $(ECHO) $$(strip 'Updating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET))' \ |
778 $$(call LogWarn, $$(strip Updating $$(subst $$(OUTPUTDIR)/,,$$($1_TARGET)) \ |
766 $$(if $$(filter-out %.vardeps, $$?), \ |
779 $$(if $$(filter-out %.vardeps, $$?), \ |
767 'due to $$(words $$(filter-out %.vardeps, $$?)) file(s)', \ |
780 due to $$(words $$(filter-out %.vardeps, $$?)) file(s), \ |
768 $$(if $$(filter %.vardeps, $$?), 'due to makefile changes'))) |
781 $$(if $$(filter %.vardeps, $$?), due to makefile changes)))) |
769 endif |
782 endif |
770 $(TOUCH) $$@ |
783 $(TOUCH) $$@ |
771 |
784 |
772 # On windows we need to create a resource file |
785 # On windows we need to create a resource file |
773 ifeq ($(call isTargetOs, windows), true) |
786 ifeq ($(call isTargetOs, windows), true) |
774 ifneq ($$($1_VERSIONINFO_RESOURCE), ) |
787 ifneq ($$($1_VERSIONINFO_RESOURCE), ) |
775 $1_RES := $$($1_OBJECT_DIR)/$$($1_BASENAME).res |
788 $1_RES := $$($1_OBJECT_DIR)/$$($1_BASENAME).res |
776 $1_RES_DEP := $$($1_RES).d |
789 $1_RES_DEPS_FILE := $$($1_RES).d |
777 $1_RES_DEP_TARGETS := $$($1_RES).d.targets |
790 $1_RES_DEPS_TARGETS_FILE := $$($1_RES).d.targets |
778 -include $$($1_RES_DEP) |
791 -include $$($1_RES_DEPS_FILE) |
779 -include $$($1_RES_DEP_TARGETS) |
792 -include $$($1_RES_DEPS_TARGETS_FILE) |
780 |
793 |
781 $1_RES_VARDEPS := $$($1_RC) $$($1_RC_FLAGS) |
794 $1_RES_VARDEPS := $$($1_RC) $$($1_RC_FLAGS) |
782 $1_RES_VARDEPS_FILE := $$(call DependOnVariable, $1_RES_VARDEPS, \ |
795 $1_RES_VARDEPS_FILE := $$(call DependOnVariable, $1_RES_VARDEPS, \ |
783 $$($1_RES).vardeps) |
796 $$($1_RES).vardeps) |
784 |
797 |
791 # Windows RC compiler does not support -showIncludes, so we mis-use CL |
804 # Windows RC compiler does not support -showIncludes, so we mis-use CL |
792 # for this. Filter out RC specific arguments that are unknown to CL. |
805 # for this. Filter out RC specific arguments that are unknown to CL. |
793 # For some unknown reason, in this case CL actually outputs the show |
806 # For some unknown reason, in this case CL actually outputs the show |
794 # includes to stderr so need to redirect it to hide the output from the |
807 # includes to stderr so need to redirect it to hide the output from the |
795 # main log. |
808 # main log. |
796 $$(call ExecuteWithLog, $$($1_RES_DEP).obj, \ |
809 $$(call ExecuteWithLog, $$($1_RES_DEPS_FILE).obj, \ |
797 $$($1_CC) $$(filter-out -l%, $$($1_RC_FLAGS)) \ |
810 $$($1_CC) $$(filter-out -l%, $$($1_RC_FLAGS)) \ |
798 $$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \ |
811 $$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \ |
799 $(CC_OUT_OPTION)$$($1_RES_DEP).obj -P -Fi$$($1_RES_DEP).pp \ |
812 $(CC_OUT_OPTION)$$($1_RES_DEPS_FILE).obj -P -Fi$$($1_RES_DEPS_FILE).pp \ |
800 $$($1_VERSIONINFO_RESOURCE)) 2>&1 \ |
813 $$($1_VERSIONINFO_RESOURCE)) 2>&1 \ |
801 | $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \ |
814 | $(TR) -d '\r' | $(GREP) -v -e "^Note: including file:" \ |
802 -e "^$$(notdir $$($1_VERSIONINFO_RESOURCE))$$$$" || test "$$$$?" = "1" ; \ |
815 -e "^$$(notdir $$($1_VERSIONINFO_RESOURCE))$$$$" || test "$$$$?" = "1" ; \ |
803 $(ECHO) $$($1_RES): \\ > $$($1_RES_DEP) ; \ |
816 $(ECHO) $$($1_RES): \\ > $$($1_RES_DEPS_FILE) ; \ |
804 $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).obj.log >> $$($1_RES_DEP) ; \ |
817 $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEPS_FILE).obj.log \ |
805 $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_RES_DEP) > $$($1_RES_DEP_TARGETS) |
818 >> $$($1_RES_DEPS_FILE) ; \ |
806 endif |
819 $(ECHO) >> $$($1_RES_DEPS_FILE) ;\ |
|
820 $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_RES_DEPS_FILE) \ |
|
821 > $$($1_RES_DEPS_TARGETS_FILE) |
|
822 endif |
|
823 endif |
|
824 |
|
825 # Create a rule to collect all the individual make dependency files into a |
|
826 # single makefile. |
|
827 $1_DEPS_FILE := $$($1_OBJECT_DIR)/$1.d |
|
828 |
|
829 $$($1_DEPS_FILE): $$($1_ALL_OBJS) $$($1_RES) |
|
830 $(RM) $$@ |
|
831 # CD into dir to reduce risk of hitting command length limits, which |
|
832 # could otherwise happen if TOPDIR is a very long path. |
|
833 $(CD) $$($1_OBJECT_DIR) && $(CAT) *.d > $$@.tmp |
|
834 $(CD) $$($1_OBJECT_DIR) && $(CAT) *.d.targets | $(SORT) -u >> $$@.tmp |
|
835 # After generating the file, which happens after all objects have been |
|
836 # compiled, copy it to .old extension. On the next make invocation, this |
|
837 # .old file will be included by make. |
|
838 $(CP) $$@.tmp $$@.old |
|
839 $(MV) $$@.tmp $$@ |
|
840 |
|
841 $1 += $$($1_DEPS_FILE) |
|
842 |
|
843 # The include must be on the .old file, which represents the state from the |
|
844 # previous invocation of make. The file being included must not have a rule |
|
845 # defined for it as otherwise make will think it has to run the rule before |
|
846 # being able to include the file, which would be wrong since we specifically |
|
847 # need the file as it was generated by a previous make invocation. |
|
848 ifneq ($$(wildcard $$($1_DEPS_FILE).old), ) |
|
849 $1_DEPS_FILE_LOADED := true |
|
850 -include $$($1_DEPS_FILE).old |
807 endif |
851 endif |
808 |
852 |
809 ifneq ($(DISABLE_MAPFILES), true) |
853 ifneq ($(DISABLE_MAPFILES), true) |
810 $1_REAL_MAPFILE := $$($1_MAPFILE) |
854 $1_REAL_MAPFILE := $$($1_MAPFILE) |
811 ifeq ($(call isTargetOs, windows), false) |
855 ifeq ($(call isTargetOs, windows), false) |
826 $1_EXTRA_LDFLAGS += $$($1_LDFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS)) |
870 $1_EXTRA_LDFLAGS += $$($1_LDFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS)) |
827 $1_EXTRA_LIBS += $$($1_LIBS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LIBS_$(OPENJDK_TARGET_OS)) |
871 $1_EXTRA_LIBS += $$($1_LIBS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LIBS_$(OPENJDK_TARGET_OS)) |
828 ifneq ($$($1_REAL_MAPFILE), ) |
872 ifneq ($$($1_REAL_MAPFILE), ) |
829 $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE)) |
873 $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE)) |
830 endif |
874 endif |
831 |
|
832 # Need to make sure TARGET is first on list |
|
833 $1 := $$($1_TARGET) |
|
834 |
875 |
835 ifneq ($$($1_COPY_DEBUG_SYMBOLS), false) |
876 ifneq ($$($1_COPY_DEBUG_SYMBOLS), false) |
836 $1_COPY_DEBUG_SYMBOLS := $(COPY_DEBUG_SYMBOLS) |
877 $1_COPY_DEBUG_SYMBOLS := $(COPY_DEBUG_SYMBOLS) |
837 endif |
878 endif |
838 |
879 |
968 ifneq ($$(wildcard $$($1_IMPORT_LIBRARY)), $$($1_IMPORT_LIBRARY)) |
1009 ifneq ($$(wildcard $$($1_IMPORT_LIBRARY)), $$($1_IMPORT_LIBRARY)) |
969 $$(call LogDebug, Deleting $$($1_BASENAME) because import library is missing) |
1010 $$(call LogDebug, Deleting $$($1_BASENAME) because import library is missing) |
970 $$(shell $(RM) $$($1_TARGET)) |
1011 $$(shell $(RM) $$($1_TARGET)) |
971 endif |
1012 endif |
972 $$($1_IMPORT_LIBRARY): $$($1_TARGET) |
1013 $$($1_IMPORT_LIBRARY): $$($1_TARGET) |
973 $$(if $$(CORRECT_FUNCTION_IN_RECIPE_EVALUATION), \ |
|
974 $$(if $$(wildcard $$@), , $$(error $$@ was not created for $$<)) \ |
|
975 ) |
|
976 $(TOUCH) $$@ |
1014 $(TOUCH) $$@ |
|
1015 |
|
1016 $1 += $$($1_IMPORT_LIBRARY) |
977 endif |
1017 endif |
978 endif |
1018 endif |
979 |
1019 |
980 $1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ |
1020 $1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ |
981 $$(GLOBAL_LIBS) $$($1_LIBS) $$($1_EXTRA_LIBS) $$($1_MT) \ |
1021 $$(GLOBAL_LIBS) $$($1_LIBS) $$($1_EXTRA_LIBS) $$($1_MT) \ |