jdk/makefiles/Images.gmk
changeset 15140 87c70ee15c73
parent 14994 a544909d1d1c
parent 15129 38c7422a92ff
child 15681 8ca785029fe2
equal deleted inserted replaced
15125:a406c61365c3 15140:87c70ee15c73
    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.
    65 	$(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
    74 	$(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
    66 	$$(install-file)
    75 	$$(install-file)
    67 
    76 
    68   $4 += $2/$$($2_$3_FILE)
    77   $4 += $2/$$($2_$3_FILE)
    69 endef
    78 endef
    70 
       
    71 JDK_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2sdk-image
       
    72 JRE_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2re-image
       
    73 
       
    74 JDK_OVERLAY_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2sdk-overlay-image
       
    75 JRE_OVERLAY_IMAGE_DIR:=$(IMAGES_OUTPUTDIR)/j2re-overlay-image
       
    76 
    79 
    77 ################################################################################
    80 ################################################################################
    78 #
    81 #
    79 # JRE and JDK build rules
    82 # JRE and JDK build rules
    80 #
    83 #
   131 WINDOWS_JDKJRE_BIN_FILES := \
   134 WINDOWS_JDKJRE_BIN_FILES := \
   132 	$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
   135 	$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
   133 	$(SALIB_NAME)
   136 	$(SALIB_NAME)
   134 
   137 
   135 # Find all files in bin dir
   138 # Find all files in bin dir
   136 ALL_BIN_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f)
   139 ALL_BIN_LIST := $(call CacheFind,$(JDK_OUTPUTDIR)/bin)
   137 
   140 
   138 # Prevent sjavac from entering the images.
   141 # Prevent sjavac from entering the images.
   139 ALL_BIN_LIST := $(filter-out %/sjavac,$(ALL_BIN_LIST))
   142 ALL_BIN_LIST := $(filter-out %/sjavac,$(ALL_BIN_LIST))
   140 
   143 
   141 # For unknown reason the debuginfo files for executables are not put into images
   144 # For unknown reason the debuginfo files for executables are not put into images
   143 ifneq ($(OPENJDK_TARGET_OS),windows)
   146 ifneq ($(OPENJDK_TARGET_OS),windows)
   144     ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
   147     ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
   145 else
   148 else
   146 # On windows, the libraries are in the bin dir, only filter out debuginfo files
   149 # On windows, the libraries are in the bin dir, only filter out debuginfo files
   147 # for executables. "java" is both a library and executable.
   150 # for executables. "java" is both a library and executable.
   148     ALL_BIN_EXEC_FILES := $(filter-out java.exe,$(notdir $(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name "*.exe")))
   151     ALL_BIN_EXEC_FILES := $(filter-out java.exe,$(notdir $(filter %.exe,$(ALL_BIN_LIST))))
   149     ALL_BIN_DEBUG_FILTER := $(addprefix %,$(patsubst %.exe,%.debuginfo,$(ALL_BIN_EXEC_FILES)) \
   152     ALL_BIN_DEBUG_FILTER := $(addprefix %,$(patsubst %.exe,%.debuginfo,$(ALL_BIN_EXEC_FILES)) \
   150 					   $(patsubst %.exe,%.diz,$(ALL_BIN_EXEC_FILES))) %.pdb
   153 					   $(patsubst %.exe,%.diz,$(ALL_BIN_EXEC_FILES))) %.pdb
   151     ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER),$(ALL_BIN_LIST))
   154     ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER),$(ALL_BIN_LIST))
   152 endif
   155 endif
   153 
   156 
   211     JDK_LIB_FILES += jexec
   214     JDK_LIB_FILES += jexec
   212 endif
   215 endif
   213 
   216 
   214 # Find all files to copy from $(JDK_OUTPUTDIR)/lib
   217 # Find all files to copy from $(JDK_OUTPUTDIR)/lib
   215 # Jar files are not expected to be here
   218 # Jar files are not expected to be here
   216 ALL_JDKOUT_LIB_LIST := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
   219 ALL_JDKOUT_LIB_LIST := $(call not-containing,_the.,$(filter-out %.jar,\
   217                        \( -name "_the*" -o -name "javac_state " -o -name "*.jar" \) )
   220                             $(call CacheFind,$(JDK_OUTPUTDIR)/lib)))
   218 # Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
   221 # Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
   219 # This is were the jar files are and might not exist if building overlay-images
   222 # This is were the jar files are and might not exist if building overlay-images
   220 ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),)
   223 ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib),)
   221     ALL_IMAGES_LIB_LIST := $(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \
   224     ALL_IMAGES_LIB_LIST := $(call not-containing,_the.,\
   222                        \( -name "_the*" -o -name "javac_state " \) )
   225                             $(call CacheFind,$(IMAGES_OUTPUTDIR)/lib))
   223 endif
   226 endif
   224 
   227 
   225 # Filter files to copy for each destination
   228 # Filter files to copy for each destination
   226 JRE_JDKOUT_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
   229 JRE_JDKOUT_LIB_LIST := $(filter-out $(addprefix %,$(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
   227                        $(ALL_JDKOUT_LIB_LIST))
   230                        $(ALL_JDKOUT_LIB_LIST))
   492 		$(ECHO) $(LOG_INFO) Copying '$$(patsubst $(OUTPUT_ROOT)/%,%,$$@)'
   495 		$(ECHO) $(LOG_INFO) Copying '$$(patsubst $(OUTPUT_ROOT)/%,%,$$@)'
   493 		$$(call install-file)
   496 		$$(call install-file)
   494 
   497 
   495     JDK_OVERLAY_DEMO_TARGETS += $$($1_TARGET)
   498     JDK_OVERLAY_DEMO_TARGETS += $$($1_TARGET)
   496 endef
   499 endef
   497 JDK_OVERLAY_DEMO_SOURCES := $(shell $(FIND) $(JDK_OUTPUTDIR)/demo -name "*$(SHARED_LIBRARY_SUFFIX)")
   500 JDK_OVERLAY_DEMO_SOURCES := $(filter %$(SHARED_LIBRARY_SUFFIX),$(call CacheFind,$(JDK_OUTPUTDIR)/demo))
   498 $(foreach lib,$(JDK_OVERLAY_DEMO_SOURCES),$(eval $(call CreateOverlayDemoRule,$(lib))))
   501 $(foreach lib,$(JDK_OVERLAY_DEMO_SOURCES),$(eval $(call CreateOverlayDemoRule,$(lib))))
   499 
   502 
   500 ################################################################################
   503 ################################################################################
   501 # /sample dir
   504 # /sample dir
   502 
   505 
   503 $(foreach f,$(shell $(FIND) $(JDK_OUTPUTDIR)/sample -type f),\
   506 $(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/sample),\
   504     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_SAMPLE_TARGETS)))
   507     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_SAMPLE_TARGETS)))
   505 
   508 
   506 ################################################################################
   509 ################################################################################
   507 # /db dir
   510 # /db dir
   508 
   511 
   517     $(JDK_IMAGE_DIR)/db/README-JDK.html: $(JDK_TOPDIR)/src/closed/share/db/README-JDK.html
   520     $(JDK_IMAGE_DIR)/db/README-JDK.html: $(JDK_TOPDIR)/src/closed/share/db/README-JDK.html
   518 	$(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
   521 	$(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
   519 	$(install-file)
   522 	$(install-file)
   520 
   523 
   521     JDK_DB_TARGETS := $(patsubst $(JDK_TOPDIR)/src/closed/share/db/%,$(IMAGES_OUTPUTDIR)/_unzip/%.unzipped,\
   524     JDK_DB_TARGETS := $(patsubst $(JDK_TOPDIR)/src/closed/share/db/%,$(IMAGES_OUTPUTDIR)/_unzip/%.unzipped,\
   522 			$(shell $(FIND) $(JDK_TOPDIR)/src/closed/share/db -name "*.zip" ! -name "*demo*")) \
   525 			$(call not-containing,demo,$(wildcard $(JDK_TOPDIR)/src/closed/share/db/*.zip))) \
   523 		      $(JDK_IMAGE_DIR)/db/README-JDK.html
   526 		      $(JDK_IMAGE_DIR)/db/README-JDK.html
   524 
   527 
   525 endif
   528 endif
   526 
   529 
   527 ################################################################################
   530 ################################################################################
   528 # /include dir
   531 # /include dir
   529 
   532 
   530 $(foreach f,$(shell $(FIND) $(JDK_OUTPUTDIR)/include -type f),\
   533 $(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/include),\
   531     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_INCLUDE_TARGETS)))
   534     $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_INCLUDE_TARGETS)))
   532 
   535 
   533 ################################################################################
   536 ################################################################################
   534 # doc files
   537 # doc files
   535 
   538 
   624 ################################################################################
   627 ################################################################################
   625 # Post processing (strip etc)
   628 # Post processing (strip etc)
   626 
   629 
   627 ifneq ($(POST_STRIP_CMD),)
   630 ifneq ($(POST_STRIP_CMD),)
   628     ifeq ($(OPENJDK_TARGET_OS), windows)
   631     ifeq ($(OPENJDK_TARGET_OS), windows)
   629         EXEC_LIST_BIN:=$(shell $(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*.exe \
   632         EXEC_LIST_BIN:=$(filter-out %$(notdir $(MSVCR_DLL)),$(filter %.exe %.dll,$(ALL_BIN_LIST)))
   630 		-o -name \*.dll | $(EGREP) -v -i "$(MSVCR_DLL)")
       
   631     else
   633     else
   632         # Find all executables in JDK_OUTPUTDIR since they exist when this makefile is parsed
   634         # Find all executables in JDK_OUTPUTDIR since they exist when this makefile is parsed
   633         EXEC_LIST_BIN:=$(shell $(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX)` \
   635         EXEC_LIST_BIN:=$(shell $(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX)` \
   634 		| $(EGREP) 'ELF' | $(CUT) -d':' -f1)
   636 		| $(EGREP) 'ELF' | $(CUT) -d':' -f1)
   635         # On mac, the old build searches for static libraries for stripping instead of shared.
   637         # On mac, the old build searches for static libraries for stripping instead of shared.