make/common/NativeCompilation.gmk

changeset 2236
19e8754f5415
parent 2221
888144400d97
child 2316
64a3eeabf6e5
child 2403
5af73acc6b6c
equal deleted inserted replaced
2234:1380ce862bbd 2236:19e8754f5415
258 258
259 ifeq ($$($1_CC),) 259 ifeq ($$($1_CC),)
260 $1_CC:=$(CC) 260 $1_CC:=$(CC)
261 endif 261 endif
262 262
263 ifeq ($$($1_STRIP_POLICY),)
264 $1_STRIP_POLICY:=$$(STRIP_POLICY)
265 endif
266
263 # Make sure the dirs exist. 267 # Make sure the dirs exist.
264 $$(eval $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR))) 268 $$(eval $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR)))
265 $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d))) 269 $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d)))
266 270
267 # Find all files in the source trees. Sort to remove duplicates. 271 # Find all files in the source trees. Sort to remove duplicates.
453 endif 457 endif
454 458
455 ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X 459 ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
456 ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows 460 ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
457 ifeq ($(OPENJDK_TARGET_OS), solaris) 461 ifeq ($(OPENJDK_TARGET_OS), solaris)
458 # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. 462 ifneq ($$($1_STRIP_POLICY), no_strip)
459 # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from 463 # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
460 # empty section headers until a fixed $(OBJCOPY) is available. 464 # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
461 # An empty section header has sh_addr == 0 and sh_size == 0. 465 # empty section headers until a fixed $(OBJCOPY) is available.
462 # This problem has only been seen on Solaris X64, but we call this tool 466 # An empty section header has sh_addr == 0 and sh_size == 0.
463 # on all Solaris builds just in case. 467 # This problem has only been seen on Solaris X64, but we call this tool
464 # 468 # on all Solaris builds just in case.
465 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. 469 #
466 # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. 470 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
467 $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \ 471 # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
472 $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
468 $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK) 473 $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
469 $(RM) $$@ 474 $(RM) $$@
470 $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$< 475 $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
471 $(OBJCOPY) --only-keep-debug $$< $$@ 476 $(OBJCOPY) --only-keep-debug $$< $$@
472 $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$< 477 $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
478 endif
473 else # not solaris 479 else # not solaris
474 $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) 480 ifneq ($$($1_STRIP_POLICY), no_strip)
481 $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
475 $(RM) $$@ 482 $(RM) $$@
476 $(OBJCOPY) --only-keep-debug $$< $$@ 483 $(OBJCOPY) --only-keep-debug $$< $$@
477 $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$< 484 $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
485 endif
478 endif # Touch to not retrigger rule on rebuild 486 endif # Touch to not retrigger rule on rebuild
487 ifneq ($$($1_STRIP_POLICY), no_strip)
479 $(TOUCH) $$@ 488 $(TOUCH) $$@
489 endif
480 endif # !windows 490 endif # !windows
481 endif # !macosx 491 endif # !macosx
482 492
483 ifeq ($(ZIP_DEBUGINFO_FILES), true) 493 ifeq ($(ZIP_DEBUGINFO_FILES), true)
484 ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet 494 ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet
498 else 508 else
499 ifeq ($(OPENJDK_TARGET_OS), windows) 509 ifeq ($(OPENJDK_TARGET_OS), windows)
500 $1 += $$($1_OUTPUT_DIR)/$$($1_LIBRARY).map \ 510 $1 += $$($1_OUTPUT_DIR)/$$($1_LIBRARY).map \
501 $$($1_OUTPUT_DIR)/$$($1_LIBRARY).pdb 511 $$($1_OUTPUT_DIR)/$$($1_LIBRARY).pdb
502 else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files 512 else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
503 $1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo 513 ifneq ($$($1_STRIP_POLICY), no_strip)
514 $1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
515 endif
504 endif 516 endif
505 endif 517 endif
506 endif 518 endif
507 endif 519 endif
508 520
537 endif 549 endif
538 550
539 ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X 551 ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
540 ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows 552 ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
541 ifeq ($(OPENJDK_TARGET_OS), solaris) 553 ifeq ($(OPENJDK_TARGET_OS), solaris)
542 # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set. 554 ifneq ($$($1_STRIP_POLICY), no_strip)
543 # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from 555 # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
544 # empty section headers until a fixed $(OBJCOPY) is available. 556 # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
545 # An empty section header has sh_addr == 0 and sh_size == 0. 557 # empty section headers until a fixed $(OBJCOPY) is available.
546 # This problem has only been seen on Solaris X64, but we call this tool 558 # An empty section header has sh_addr == 0 and sh_size == 0.
547 # on all Solaris builds just in case. 559 # This problem has only been seen on Solaris X64, but we call this tool
548 # 560 # on all Solaris builds just in case.
549 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections. 561 #
550 # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available. 562 # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
551 $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \ 563 # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
564 $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
552 $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK) 565 $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
553 $(RM) $$@ 566 $(RM) $$@
554 $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$< 567 $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
555 $(OBJCOPY) --only-keep-debug $$< $$@ 568 $(OBJCOPY) --only-keep-debug $$< $$@
556 $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$< 569 $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
570 endif
557 else # not solaris 571 else # not solaris
558 $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) 572 ifneq ($$($1_STRIP_POLICY), no_strip)
573 $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
559 $(RM) $$@ 574 $(RM) $$@
560 $(OBJCOPY) --only-keep-debug $$< $$@ 575 $(OBJCOPY) --only-keep-debug $$< $$@
561 $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$< 576 $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
577 endif
562 endif 578 endif
579 ifneq ($$($1_STRIP_POLICY), no_strip)
563 $(TOUCH) $$@ 580 $(TOUCH) $$@
581 endif
564 endif # !windows 582 endif # !windows
565 endif # !macosx 583 endif # !macosx
566 584
567 ifeq ($(ZIP_DEBUGINFO_FILES), true) 585 ifeq ($(ZIP_DEBUGINFO_FILES), true)
568 ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet 586 ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet
582 else 600 else
583 ifeq ($(OPENJDK_TARGET_OS), windows) 601 ifeq ($(OPENJDK_TARGET_OS), windows)
584 $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).map \ 602 $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).map \
585 $$($1_OUTPUT_DIR)/$$($1_PROGRAM).pdb 603 $$($1_OUTPUT_DIR)/$$($1_PROGRAM).pdb
586 else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files 604 else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
587 $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).debuginfo 605 ifneq ($$($1_STRIP_POLICY), no_strip)
606 $1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).debuginfo
607 endif
588 endif 608 endif
589 endif 609 endif
590 endif 610 endif
591 endif 611 endif
592 612

mercurial