jdk/makefiles/Images.gmk
changeset 15126 bceb690ccf35
parent 14596 a1f29d55b5ee
child 15129 38c7422a92ff
equal deleted inserted replaced
14873:0d625373c69e 15126:bceb690ccf35
    27 include MakeBase.gmk
    27 include MakeBase.gmk
    28 include JavaCompilation.gmk
    28 include JavaCompilation.gmk
    29 include Setup.gmk
    29 include Setup.gmk
    30 
    30 
    31 default: images
    31 default: images
       
    32 
       
    33 # Prepare the find cache. Only used if running on windows.
       
    34 $(eval $(call FillCacheFind,\
       
    35     $(wildcard $(JDK_OUTPUTDIR)/bin \
       
    36                $(JDK_OUTPUTDIR)/lib \
       
    37                $(IMAGES_OUTPUTDIR)/lib \
       
    38                $(JDK_OUTPUTDIR)/include \
       
    39                $(JDK_OUTPUTDIR)/sample \
       
    40                $(JDK_OUTPUTDIR)/demo)))
    32 
    41 
    33 include Tools.gmk
    42 include Tools.gmk
    34 
    43 
    35 # Note: This double-colon rule is intentional, to support
    44 # Note: This double-colon rule is intentional, to support
    36 # custom make file integration.
    45 # custom make file integration.
   130 WINDOWS_JDKJRE_BIN_FILES := \
   139 WINDOWS_JDKJRE_BIN_FILES := \
   131 	$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
   140 	$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
   132 	$(SALIB_NAME)
   141 	$(SALIB_NAME)
   133 
   142 
   134 # Find all files in bin dir
   143 # Find all files in bin dir
   135 ALL_BIN_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f)
   144 ALL_BIN_LIST := $(call CacheFind,$(JDK_OUTPUTDIR)/bin)
   136 
   145 
   137 # Prevent sjavac from entering the images.
   146 # Prevent sjavac from entering the images.
   138 ALL_BIN_LIST := $(filter-out %/sjavac,$(ALL_BIN_LIST))
   147 ALL_BIN_LIST := $(filter-out %/sjavac,$(ALL_BIN_LIST))
   139 
   148 
   140 # For unknown reason the debuginfo files for executables are not put into images
   149 # For unknown reason the debuginfo files for executables are not put into images
   142 ifneq ($(OPENJDK_TARGET_OS),windows)
   151 ifneq ($(OPENJDK_TARGET_OS),windows)
   143     ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
   152     ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
   144 else
   153 else
   145 # On windows, the libraries are in the bin dir, only filter out debuginfo files
   154 # On windows, the libraries are in the bin dir, only filter out debuginfo files
   146 # for executables. "java" is both a library and executable.
   155 # for executables. "java" is both a library and executable.
   147     ALL_BIN_EXEC_FILES := $(filter-out java.exe,$(notdir $(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name "*.exe")))
   156     ALL_BIN_EXEC_FILES := $(filter-out java.exe,$(notdir $(filter %.exe,$(ALL_BIN_LIST))))
   148     ALL_BIN_DEBUG_FILTER := $(addprefix %,$(patsubst %.exe,%.debuginfo,$(ALL_BIN_EXEC_FILES)) \
   157     ALL_BIN_DEBUG_FILTER := $(addprefix %,$(patsubst %.exe,%.debuginfo,$(ALL_BIN_EXEC_FILES)) \
   149 					   $(patsubst %.exe,%.diz,$(ALL_BIN_EXEC_FILES))) %.pdb
   158 					   $(patsubst %.exe,%.diz,$(ALL_BIN_EXEC_FILES))) %.pdb
   150     ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER),$(ALL_BIN_LIST))
   159     ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER),$(ALL_BIN_LIST))
   151 endif
   160 endif
   152 
   161 
   210     JDK_LIB_FILES += jexec
   219     JDK_LIB_FILES += jexec
   211 endif
   220 endif
   212 
   221 
   213 # Find all files to copy from $(JDK_OUTPUTDIR)/lib
   222 # Find all files to copy from $(JDK_OUTPUTDIR)/lib
   214 # Jar files are not expected to be here
   223 # Jar files are not expected to be here
   215 ALL_JDKOUT_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
   224 ALL_JDKOUT_LIB_LIST := $(call not-containing,_the.,$(filter-out %.jar,\
   216                        \( -name "_the*" -o -name "javac_state " -o -name "*.jar" \) )
   225                             $(call CacheFind,$(JDK_OUTPUTDIR)/lib)))
   217 # Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
   226 # Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
   218 # This is were the jar files are and might not exist if building overlay-images
   227 # This is were the jar files are and might not exist if building overlay-images
   219 ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),)
   228 ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),)
   220     ALL_IMAGES_LIB_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
   229     ALL_IMAGES_LIB_LIST := $(call not-containing,_the.,\
   221                        \( -name "_the*" -o -name "javac_state " \) )
   230                             $(call CacheFind,$(IMAGES_OUTPUTDIR)/lib))
   222 endif
   231 endif
   223 
   232 
   224 # Filter files to copy for each destination
   233 # Filter files to copy for each destination
   225 JRE_JDKOUT_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
   234 JRE_JDKOUT_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
   226                        $(ALL_JDKOUT_LIB_LIST))
   235                        $(ALL_JDKOUT_LIB_LIST))
   491 		$(ECHO) $(LOG_INFO) Copying '$$(patsubst $(OUTPUT_ROOT)/%,%,$$@)'
   500 		$(ECHO) $(LOG_INFO) Copying '$$(patsubst $(OUTPUT_ROOT)/%,%,$$@)'
   492 		$$(call install-file)
   501 		$$(call install-file)
   493 
   502 
   494     JDK_OVERLAY_DEMO_TARGETS += $$($1_TARGET)
   503     JDK_OVERLAY_DEMO_TARGETS += $$($1_TARGET)
   495 endef
   504 endef
   496 JDK_OVERLAY_DEMO_SOURCES := $(shell $(FIND) $(JDK_OUTPUTDIR)/demo -name "*$(SHARED_LIBRARY_SUFFIX)")
   505 JDK_OVERLAY_DEMO_SOURCES := $(filter %$(SHARED_LIBRARY_SUFFIX),$(call CacheFind,$(JDK_OUTPUTDIR)/demo))
   497 $(foreach lib,$(JDK_OVERLAY_DEMO_SOURCES),$(eval $(call CreateOverlayDemoRule,$(lib))))
   506 $(foreach lib,$(JDK_OVERLAY_DEMO_SOURCES),$(eval $(call CreateOverlayDemoRule,$(lib))))
   498 
   507 
   499 ################################################################################
   508 ################################################################################
   500 # /sample dir
   509 # /sample dir
   501 
   510 
   502 $(foreach f,$(shell $(FIND) $(JDK_OUTPUTDIR)/sample -type f),\
   511 $(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/sample),\
   503     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_SAMPLE_TARGETS)))
   512     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_SAMPLE_TARGETS)))
   504 
   513 
   505 ################################################################################
   514 ################################################################################
   506 # /db dir
   515 # /db dir
   507 
   516 
   516     $(JDK_IMAGE_DIR)/db/README-JDK.html: $(JDK_TOPDIR)/src/closed/share/db/README-JDK.html
   525     $(JDK_IMAGE_DIR)/db/README-JDK.html: $(JDK_TOPDIR)/src/closed/share/db/README-JDK.html
   517 	$(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
   526 	$(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
   518 	$(install-file)
   527 	$(install-file)
   519 
   528 
   520     JDK_DB_TARGETS := $(patsubst $(JDK_TOPDIR)/src/closed/share/db/%,$(IMAGES_OUTPUTDIR)/_unzip/%.unzipped,\
   529     JDK_DB_TARGETS := $(patsubst $(JDK_TOPDIR)/src/closed/share/db/%,$(IMAGES_OUTPUTDIR)/_unzip/%.unzipped,\
   521 			$(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/db -name "*.zip" ! -name "*demo*")) \
   530 			$(call not-containing,demo,$(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip))) \
   522 		      $(JDK_IMAGE_DIR)/db/README-JDK.html
   531 		      $(JDK_IMAGE_DIR)/db/README-JDK.html
   523 
   532 
   524 endif
   533 endif
   525 
   534 
   526 ################################################################################
   535 ################################################################################
   527 # /include dir
   536 # /include dir
   528 
   537 
   529 $(foreach f,$(shell $(FIND) $(JDK_OUTPUTDIR)/include -type f),\
   538 $(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/include),\
   530     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_INCLUDE_TARGETS)))
   539     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_INCLUDE_TARGETS)))
   531 
   540 
   532 ################################################################################
   541 ################################################################################
   533 # doc files
   542 # doc files
   534 
   543 
   623 ################################################################################
   632 ################################################################################
   624 # Post processing (strip etc)
   633 # Post processing (strip etc)
   625 
   634 
   626 ifneq ($(POST_STRIP_CMD),)
   635 ifneq ($(POST_STRIP_CMD),)
   627     ifeq ($(OPENJDK_TARGET_OS), windows)
   636     ifeq ($(OPENJDK_TARGET_OS), windows)
   628         EXEC_LIST_BIN:=$(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*.exe \
   637         EXEC_LIST_BIN:=$(filter-out %$(notdir $(MSVCR_DLL)),$(filter %.exe %.dll,$(ALL_BIN_LIST)))
   629 		-o -name \*.dll | $(EGREP) -v -i "$(MSVCR_DLL)")
       
   630     else
   638     else
   631         # Find all executables in JDK_OUTPUTDIR since they exist when this makefile is parsed
   639         # Find all executables in JDK_OUTPUTDIR since they exist when this makefile is parsed
   632         EXEC_LIST_BIN:=$(shell $(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX)` \
   640         EXEC_LIST_BIN:=$(shell $(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX)` \
   633 		| $(EGREP) 'ELF' | $(CUT) -d':' -f1)
   641 		| $(EGREP) 'ELF' | $(CUT) -d':' -f1)
   634         # On mac, the old build searches for static libraries for stripping instead of shared.
   642         # On mac, the old build searches for static libraries for stripping instead of shared.