47 # LD - The Linker |
47 # LD - The Linker |
48 # AR - Static linker |
48 # AR - Static linker |
49 # AS - Assembler |
49 # AS - Assembler |
50 # MT - Windows MT tool |
50 # MT - Windows MT tool |
51 # RC - Windows RC tool |
51 # RC - Windows RC tool |
|
52 # STRIP - The tool to use for stripping debug symbols |
52 # SYSROOT_CFLAGS - Compiler flags for using the specific sysroot |
53 # SYSROOT_CFLAGS - Compiler flags for using the specific sysroot |
53 # SYSROOT_LDFLAGS - Linker flags for using the specific sysroot |
54 # SYSROOT_LDFLAGS - Linker flags for using the specific sysroot |
54 DefineNativeToolchain = $(NamedParamsMacroTemplate) |
55 DefineNativeToolchain = $(NamedParamsMacroTemplate) |
55 define DefineNativeToolchainBody |
56 define DefineNativeToolchainBody |
56 # If extending another definition, get default values from that, |
57 # If extending another definition, get default values from that, |
62 $$(call SetIfEmpty, $1_LD, $$($$($1_EXTENDS)_LD)) |
63 $$(call SetIfEmpty, $1_LD, $$($$($1_EXTENDS)_LD)) |
63 $$(call SetIfEmpty, $1_AR, $$($$($1_EXTENDS)_AR)) |
64 $$(call SetIfEmpty, $1_AR, $$($$($1_EXTENDS)_AR)) |
64 $$(call SetIfEmpty, $1_AS, $$($$($1_EXTENDS)_AS)) |
65 $$(call SetIfEmpty, $1_AS, $$($$($1_EXTENDS)_AS)) |
65 $$(call SetIfEmpty, $1_MT, $$($$($1_EXTENDS)_MT)) |
66 $$(call SetIfEmpty, $1_MT, $$($$($1_EXTENDS)_MT)) |
66 $$(call SetIfEmpty, $1_RC, $$($$($1_EXTENDS)_RC)) |
67 $$(call SetIfEmpty, $1_RC, $$($$($1_EXTENDS)_RC)) |
|
68 $$(call SetIfEmpty, $1_STRIP, $$($$($1_EXTENDS)_STRIP)) |
67 $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_EXTENDS)_SYSROOT_CFLAGS)) |
69 $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_EXTENDS)_SYSROOT_CFLAGS)) |
68 $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_EXTENDS)_SYSROOT_LDFLAGS)) |
70 $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_EXTENDS)_SYSROOT_LDFLAGS)) |
69 endif |
71 endif |
70 endef |
72 endef |
71 |
73 |
263 # DEBUG_SYMBOLS add debug symbols (if configured on) |
266 # DEBUG_SYMBOLS add debug symbols (if configured on) |
264 # CC the compiler to use, default is $(CC) |
267 # CC the compiler to use, default is $(CC) |
265 # LD the linker to use, default is $(LD) |
268 # LD the linker to use, default is $(LD) |
266 # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST |
269 # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST |
267 # DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain |
270 # DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain |
|
271 # STRIP_SYMBOLS Set to true to strip the final binary if the toolchain allows for it |
|
272 # STRIPFLAGS Optionally change the flags given to the strip command |
268 SetupNativeCompilation = $(NamedParamsMacroTemplate) |
273 SetupNativeCompilation = $(NamedParamsMacroTemplate) |
269 define SetupNativeCompilationBody |
274 define SetupNativeCompilationBody |
270 |
275 |
271 ifneq (,$$($1_BIN)) |
276 ifneq (,$$($1_BIN)) |
272 $$(error BIN has been replaced with OBJECT_DIR) |
277 $$(error BIN has been replaced with OBJECT_DIR) |
365 $$(call SetIfEmpty, $1_LD, $$($$($1_TOOLCHAIN)_LD)) |
370 $$(call SetIfEmpty, $1_LD, $$($$($1_TOOLCHAIN)_LD)) |
366 $$(call SetIfEmpty, $1_AR, $$($$($1_TOOLCHAIN)_AR)) |
371 $$(call SetIfEmpty, $1_AR, $$($$($1_TOOLCHAIN)_AR)) |
367 $$(call SetIfEmpty, $1_AS, $$($$($1_TOOLCHAIN)_AS)) |
372 $$(call SetIfEmpty, $1_AS, $$($$($1_TOOLCHAIN)_AS)) |
368 $$(call SetIfEmpty, $1_MT, $$($$($1_TOOLCHAIN)_MT)) |
373 $$(call SetIfEmpty, $1_MT, $$($$($1_TOOLCHAIN)_MT)) |
369 $$(call SetIfEmpty, $1_RC, $$($$($1_TOOLCHAIN)_RC)) |
374 $$(call SetIfEmpty, $1_RC, $$($$($1_TOOLCHAIN)_RC)) |
|
375 $$(call SetIfEmpty, $1_STRIP, $$($$($1_TOOLCHAIN)_STRIP)) |
370 $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_CFLAGS)) |
376 $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_CFLAGS)) |
371 $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_LDFLAGS)) |
377 $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$($$($1_TOOLCHAIN)_SYSROOT_LDFLAGS)) |
372 |
378 |
373 ifneq ($$($1_MANIFEST), ) |
379 ifneq ($$($1_MANIFEST), ) |
374 ifeq ($$($1_MANIFEST_VERSION), ) |
380 ifeq ($$($1_MANIFEST_VERSION), ) |
655 endif |
661 endif |
656 endif # !MacOS X |
662 endif # !MacOS X |
657 endif # $1_DEBUG_SYMBOLS |
663 endif # $1_DEBUG_SYMBOLS |
658 endif # !STATIC_LIBRARY |
664 endif # !STATIC_LIBRARY |
659 |
665 |
|
666 ifeq ($$($1_STRIP_SYMBOLS), true) |
|
667 ifneq ($$($1_STRIP), ) |
|
668 # Default to using the global STRIPFLAGS. Allow for overriding with an empty value |
|
669 $1_STRIPFLAGS ?= $(STRIPFLAGS) |
|
670 $1_STRIP_CMD := $$($1_STRIP) $$($1_STRIPFLAGS) $$($1_TARGET) |
|
671 endif |
|
672 endif |
|
673 |
660 ifneq (,$$($1_LIBRARY)) |
674 ifneq (,$$($1_LIBRARY)) |
661 # Generating a dynamic library. |
675 # Generating a dynamic library. |
662 $1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME)) |
676 $1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME)) |
663 ifeq ($(OPENJDK_TARGET_OS), windows) |
677 ifeq ($(OPENJDK_TARGET_OS), windows) |
664 $1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib" |
678 $1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib" |
665 endif |
679 endif |
666 |
680 |
667 $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX) |
681 $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX) |
668 |
682 |
669 $1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ |
683 $1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ |
670 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) $$($1_CREATE_DEBUGINFO_CMDS) |
684 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) $$($1_CREATE_DEBUGINFO_CMDS) \ |
|
685 $$($1_STRIP_CMD) |
671 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ |
686 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ |
672 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) |
687 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) |
673 |
688 |
674 $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \ |
689 $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \ |
675 $$($1_VARDEPS_FILE) |
690 $$($1_VARDEPS_FILE) |
678 $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \ |
693 $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \ |
679 $(LD_OUT_OPTION)$$@ \ |
694 $(LD_OUT_OPTION)$$@ \ |
680 $$($1_EXPECTED_OBJS) $$($1_RES) \ |
695 $$($1_EXPECTED_OBJS) $$($1_RES) \ |
681 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)) |
696 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)) |
682 $$($1_CREATE_DEBUGINFO_CMDS) |
697 $$($1_CREATE_DEBUGINFO_CMDS) |
|
698 $$($1_STRIP_CMD) |
683 # Touch target to make sure it has a later time stamp than the debug |
699 # Touch target to make sure it has a later time stamp than the debug |
684 # symbol files to avoid unnecessary relinking on rebuild. |
700 # symbol files to avoid unnecessary relinking on rebuild. |
685 ifeq ($(OPENJDK_TARGET_OS), windows) |
701 ifeq ($(OPENJDK_TARGET_OS), windows) |
686 $(TOUCH) $$@ |
702 $(TOUCH) $$@ |
687 endif |
703 endif |
706 # A executable binary has been specified, setup the target for it. |
722 # A executable binary has been specified, setup the target for it. |
707 $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX) |
723 $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX) |
708 |
724 |
709 $1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ |
725 $1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \ |
710 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) $$($1_MT) \ |
726 $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX) $$($1_MT) \ |
711 $$($1_CODESIGN) $$($1_CREATE_DEBUGINFO_CMDS) $$($1_MANIFEST_VERSION) |
727 $$($1_CODESIGN) $$($1_CREATE_DEBUGINFO_CMDS) $$($1_MANIFEST_VERSION) \ |
|
728 $$($1_STRIP_CMD) |
712 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ |
729 $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \ |
713 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) |
730 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps) |
714 |
731 |
715 $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_MANIFEST) \ |
732 $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_MANIFEST) \ |
716 $$($1_VARDEPS_FILE) |
733 $$($1_VARDEPS_FILE) |
731 ifneq (,$$($1_CODESIGN)) |
748 ifneq (,$$($1_CODESIGN)) |
732 $(CODESIGN) -s openjdk_codesign $$@ |
749 $(CODESIGN) -s openjdk_codesign $$@ |
733 endif |
750 endif |
734 endif |
751 endif |
735 $$($1_CREATE_DEBUGINFO_CMDS) |
752 $$($1_CREATE_DEBUGINFO_CMDS) |
|
753 $$($1_STRIP_CMD) |
736 # Touch target to make sure it has a later time stamp than the debug |
754 # Touch target to make sure it has a later time stamp than the debug |
737 # symbol files to avoid unnecessary relinking on rebuild. |
755 # symbol files to avoid unnecessary relinking on rebuild. |
738 ifeq ($(OPENJDK_TARGET_OS), windows) |
756 ifeq ($(OPENJDK_TARGET_OS), windows) |
739 $(TOUCH) $$@ |
757 $(TOUCH) $$@ |
740 endif |
758 endif |