355 # EXCLUDE_PATTERN exclude files matching any of these substrings
356 # EXTRA_FILES List of extra files not in any of the SRC dirs
357 # EXTRA_OBJECT_FILES List of extra object files to include when linking
358 # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
359 # RC_FLAGS flags for RC.
360 # EMBED_MANIFEST if true, embed manifest on Windows.
361 # MAPFILE mapfile
362 # REORDER reorder file
363 # USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
364 # mapfile for the output symbols file
365 # CC the compiler to use, default is $(CC)
366 # LD the linker to use, default is $(LD)
367 # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
368 # DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
369 # DISABLED_WARNINGS_C_<toolchain> Disable the given warnings for the specified toolchain
370 # when compiling C code
371 # DISABLED_WARNINGS_CXX_<toolchain> Disable the given warnings for the specified
372 # toolchain when compiling C++ code
373 # STRIP_SYMBOLS Set to true to strip the final binary if the toolchain allows for it
374 # DEBUG_SYMBOLS Set to false to disable generation of debug symbols
375 # CFLAGS_DEBUG_SYMBOLS Overrides the default cflags for enabling debug symbols
376 # CXXFLAGS_DEBUG_SYMBOLS Overrides the default cxxflags for enabling debug symbols
377 # STRIPFLAGS Optionally change the flags given to the strip command
378 # PRECOMPILED_HEADER Header file to use as precompiled header
379 # PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
380 SetupNativeCompilation = $(NamedParamsMacroTemplate)
381 define SetupNativeCompilationBody
382
383 # If we're doing a static build and producing a library
384 # force it to be a static library and remove the -l libraries
385 ifeq ($(STATIC_BUILD), true)
386 ifneq ($$($1_LIBRARY),)
387 $1_STATIC_LIBRARY := $$($1_LIBRARY)
388 $1_LIBRARY :=
389 endif
390 endif
391
392 ifneq (,$$($1_BIN))
393 $$(error BIN has been replaced with OBJECT_DIR)
394 endif
790 $$($1_REAL_MAPFILE) : $$($1_MAPFILE) $$($1_REORDER)
791 $$(call MakeDir, $$(@D))
792 $$(CP) $$($1_MAPFILE) $$@.tmp
793 $$(SED) -e 's=OUTPUTDIR=$$($1_OBJECT_DIR)=' $$($1_REORDER) >> $$@.tmp
794 $$(MV) $$@.tmp $$@
795 endif
796 endif
797 endif
798
799 # Pickup extra OPENJDK_TARGET_OS_TYPE and/or OPENJDK_TARGET_OS dependent variables
800 # for LDFLAGS and LIBS
801 $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS))
802 $1_EXTRA_LIBS:=$$($1_LIBS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LIBS_$(OPENJDK_TARGET_OS))
803 ifneq (,$$($1_REAL_MAPFILE))
804 $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE))
805 endif
806
807 # Need to make sure TARGET is first on list
808 $1 := $$($1_TARGET)
809
810 ifeq ($(COPY_DEBUG_SYMBOLS), true)
811 ifneq ($$($1_DEBUG_SYMBOLS), false)
812 # Only copy debug symbols for dynamic libraries and programs.
813 ifeq ($$($1_STATIC_LIBRARY), )
814 ifneq ($$($1_OUTPUT_DIR), $$($1_OBJECT_DIR))
815 # The dependency on TARGET is needed on windows for debuginfo files
816 # to be rebuilt properly.
817 $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/% $$($1_TARGET)
818 # Use cp -r since on macosx, the dSYM is a directory
819 $(CP) -r $$< $$@
820 endif
821
822 # Generate debuginfo files.
823 ifeq ($(OPENJDK_TARGET_OS), windows)
824 $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb" \
825 "-map:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map"
826 $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
827 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
828 # No separate command is needed for debuginfo on windows, instead
829 # touch target to make sure it has a later time stamp than the debug
830 # symbol files to avoid unnecessary relinking on rebuild.
837 $1_CREATE_DEBUGINFO_CMDS := \
838 $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
839 $(CD) $$($1_OUTPUT_DIR) && \
840 $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
841
842 else ifeq ($(OPENJDK_TARGET_OS), macosx)
843 $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
844 # On Macosx, the debuginfo generation doesn't touch the linked binary, but
845 # to avoid always relinking, touch it anyway to force a later timestamp than
846 # the dSYM files.
847 $1_CREATE_DEBUGINFO_CMDS := \
848 $(DSYMUTIL) --out $$($1_DEBUGINFO_FILES) $$($1_TARGET) $$(NEWLINE) \
849 $(TOUCH) $$($1_TARGET)
850 endif # OPENJDK_TARGET_OS
851
852 # This dependency dance ensures that debug info files get rebuilt
853 # properly if deleted.
854 $$($1_TARGET): $$($1_DEBUGINFO_FILES)
855 $$($1_DEBUGINFO_FILES): $$($1_ALL_OBJS)
856
857 ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
858 $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
859 $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
860
861 # The dependency on TARGET is needed for debuginfo files
862 # to be rebuilt properly.
863 $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
864 $(CD) $$($1_OBJECT_DIR) \
865 && $(ZIP) -q -r $$@ $$(notdir $$($1_DEBUGINFO_FILES))
866
867 else
868 $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_FILES))
869 endif
870 endif # !STATIC_LIBRARY
871 endif # $1_DEBUG_SYMBOLS != false
872 endif # COPY_DEBUG_SYMBOLS
873
874 ifeq ($$($1_STRIP_SYMBOLS), true)
875 ifneq ($$($1_STRIP), )
876 # Default to using the global STRIPFLAGS. Allow for overriding with an empty value
877 $1_STRIPFLAGS ?= $(STRIPFLAGS)
|
355 # EXCLUDE_PATTERN exclude files matching any of these substrings
356 # EXTRA_FILES List of extra files not in any of the SRC dirs
357 # EXTRA_OBJECT_FILES List of extra object files to include when linking
358 # VERSIONINFO_RESOURCE Input file for RC. Setting this implies that RC will be run
359 # RC_FLAGS flags for RC.
360 # EMBED_MANIFEST if true, embed manifest on Windows.
361 # MAPFILE mapfile
362 # REORDER reorder file
363 # USE_MAPFILE_FOR_SYMBOLS if true and this is a STATIC_BUILD, just copy the
364 # mapfile for the output symbols file
365 # CC the compiler to use, default is $(CC)
366 # LD the linker to use, default is $(LD)
367 # OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, HIGHEST_JVM, SIZE
368 # DISABLED_WARNINGS_<toolchain> Disable the given warnings for the specified toolchain
369 # DISABLED_WARNINGS_C_<toolchain> Disable the given warnings for the specified toolchain
370 # when compiling C code
371 # DISABLED_WARNINGS_CXX_<toolchain> Disable the given warnings for the specified
372 # toolchain when compiling C++ code
373 # STRIP_SYMBOLS Set to true to strip the final binary if the toolchain allows for it
374 # DEBUG_SYMBOLS Set to false to disable generation of debug symbols
375 # COPY_DEBUG_SYMBOLS Set to false to override global setting of debug symbol copying
376 # ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol
377 # zipping
378 # CFLAGS_DEBUG_SYMBOLS Overrides the default cflags for enabling debug symbols
379 # CXXFLAGS_DEBUG_SYMBOLS Overrides the default cxxflags for enabling debug symbols
380 # STRIPFLAGS Optionally change the flags given to the strip command
381 # PRECOMPILED_HEADER Header file to use as precompiled header
382 # PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
383 SetupNativeCompilation = $(NamedParamsMacroTemplate)
384 define SetupNativeCompilationBody
385
386 # If we're doing a static build and producing a library
387 # force it to be a static library and remove the -l libraries
388 ifeq ($(STATIC_BUILD), true)
389 ifneq ($$($1_LIBRARY),)
390 $1_STATIC_LIBRARY := $$($1_LIBRARY)
391 $1_LIBRARY :=
392 endif
393 endif
394
395 ifneq (,$$($1_BIN))
396 $$(error BIN has been replaced with OBJECT_DIR)
397 endif
793 $$($1_REAL_MAPFILE) : $$($1_MAPFILE) $$($1_REORDER)
794 $$(call MakeDir, $$(@D))
795 $$(CP) $$($1_MAPFILE) $$@.tmp
796 $$(SED) -e 's=OUTPUTDIR=$$($1_OBJECT_DIR)=' $$($1_REORDER) >> $$@.tmp
797 $$(MV) $$@.tmp $$@
798 endif
799 endif
800 endif
801
802 # Pickup extra OPENJDK_TARGET_OS_TYPE and/or OPENJDK_TARGET_OS dependent variables
803 # for LDFLAGS and LIBS
804 $1_EXTRA_LDFLAGS:=$$($1_LDFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS))
805 $1_EXTRA_LIBS:=$$($1_LIBS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LIBS_$(OPENJDK_TARGET_OS))
806 ifneq (,$$($1_REAL_MAPFILE))
807 $1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE))
808 endif
809
810 # Need to make sure TARGET is first on list
811 $1 := $$($1_TARGET)
812
813 ifneq ($$($1_COPY_DEBUG_SYMBOLS), false)
814 $1_COPY_DEBUG_SYMBOLS := $(COPY_DEBUG_SYMBOLS)
815 endif
816
817 ifneq ($$($1_ZIP_EXTERNAL_DEBUG_SYMBOLS), false)
818 $1_ZIP_EXTERNAL_DEBUG_SYMBOLS := $(ZIP_EXTERNAL_DEBUG_SYMBOLS)
819 endif
820
821 ifeq ($$($1_COPY_DEBUG_SYMBOLS), true)
822 ifneq ($$($1_DEBUG_SYMBOLS), false)
823 # Only copy debug symbols for dynamic libraries and programs.
824 ifeq ($$($1_STATIC_LIBRARY), )
825 ifneq ($$($1_OUTPUT_DIR), $$($1_OBJECT_DIR))
826 # The dependency on TARGET is needed on windows for debuginfo files
827 # to be rebuilt properly.
828 $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/% $$($1_TARGET)
829 # Use cp -r since on macosx, the dSYM is a directory
830 $(CP) -r $$< $$@
831 endif
832
833 # Generate debuginfo files.
834 ifeq ($(OPENJDK_TARGET_OS), windows)
835 $1_EXTRA_LDFLAGS += -debug "-pdb:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb" \
836 "-map:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map"
837 $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
838 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
839 # No separate command is needed for debuginfo on windows, instead
840 # touch target to make sure it has a later time stamp than the debug
841 # symbol files to avoid unnecessary relinking on rebuild.
848 $1_CREATE_DEBUGINFO_CMDS := \
849 $$($1_OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
850 $(CD) $$($1_OUTPUT_DIR) && \
851 $$($1_OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
852
853 else ifeq ($(OPENJDK_TARGET_OS), macosx)
854 $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
855 # On Macosx, the debuginfo generation doesn't touch the linked binary, but
856 # to avoid always relinking, touch it anyway to force a later timestamp than
857 # the dSYM files.
858 $1_CREATE_DEBUGINFO_CMDS := \
859 $(DSYMUTIL) --out $$($1_DEBUGINFO_FILES) $$($1_TARGET) $$(NEWLINE) \
860 $(TOUCH) $$($1_TARGET)
861 endif # OPENJDK_TARGET_OS
862
863 # This dependency dance ensures that debug info files get rebuilt
864 # properly if deleted.
865 $$($1_TARGET): $$($1_DEBUGINFO_FILES)
866 $$($1_DEBUGINFO_FILES): $$($1_ALL_OBJS)
867
868 ifeq ($$($1_ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
869 $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
870 $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
871
872 # The dependency on TARGET is needed for debuginfo files
873 # to be rebuilt properly.
874 $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
875 $(CD) $$($1_OBJECT_DIR) \
876 && $(ZIP) -q -r $$@ $$(notdir $$($1_DEBUGINFO_FILES))
877
878 else
879 $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_FILES))
880 endif
881 endif # !STATIC_LIBRARY
882 endif # $1_DEBUG_SYMBOLS != false
883 endif # COPY_DEBUG_SYMBOLS
884
885 ifeq ($$($1_STRIP_SYMBOLS), true)
886 ifneq ($$($1_STRIP), )
887 # Default to using the global STRIPFLAGS. Allow for overriding with an empty value
888 $1_STRIPFLAGS ?= $(STRIPFLAGS)
|