make/gensrc/GensrcProperties.gmk
changeset 50590 5fa19bad622d
parent 47217 72e3ae9a25eb
child 52065 dea8a62cdfc3
equal deleted inserted replaced
50589:e5d741569070 50590:5fa19bad622d
     1 #
     1 #
     2 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
     2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.  Oracle designates this
     7 # published by the Free Software Foundation.  Oracle designates this
    57 # Remaining parameters are named arguments. These include:
    57 # Remaining parameters are named arguments. These include:
    58 # SRC_DIRS   Directories containing properties files to process.
    58 # SRC_DIRS   Directories containing properties files to process.
    59 # EXCLUDE   Exclude files matching this pattern.
    59 # EXCLUDE   Exclude files matching this pattern.
    60 # CLASS   The super class for the generated classes.
    60 # CLASS   The super class for the generated classes.
    61 # MODULE_PATH_ROOT   Module path root, defaults to $(TOPDIR)/src.
    61 # MODULE_PATH_ROOT   Module path root, defaults to $(TOPDIR)/src.
       
    62 # KEEP_ALL_TRANSLATIONS Set to true to skip filtering of excluded translations.
    62 SetupCompileProperties = $(NamedParamsMacroTemplate)
    63 SetupCompileProperties = $(NamedParamsMacroTemplate)
    63 define SetupCompilePropertiesBody
    64 define SetupCompilePropertiesBody
    64   # Set default value unless overridden
    65   # Set default value unless overridden
    65   ifeq ($$($1_MODULE_PATH_ROOT), )
    66   ifeq ($$($1_MODULE_PATH_ROOT), )
    66     $1_MODULE_PATH_ROOT := $(TOPDIR)/src
    67     $1_MODULE_PATH_ROOT := $(TOPDIR)/src
    71 
    72 
    72   ifneq ($$($1_EXCLUDE), )
    73   ifneq ($$($1_EXCLUDE), )
    73     $1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES))
    74     $1_SRC_FILES := $$(filter-out $$($1_EXCLUDE), $$($1_SRC_FILES))
    74   endif
    75   endif
    75 
    76 
       
    77   # Filter out any excluded translations
       
    78   ifneq ($$($1_KEEP_ALL_TRANSLATIONS), true)
       
    79     $1_SRC_FILES := $$(call FilterExcludedTranslations, $$($1_SRC_FILES), .properties)
       
    80   endif
       
    81 
    76   # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
    82   # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
    77   # to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
    83   # to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
    78   # Strip away prefix and suffix, leaving for example only:
       
    79   # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
       
    80   $1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
    84   $1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
    81       $(SUPPORT_OUTPUTDIR)/gensrc/%, \
    85       $(SUPPORT_OUTPUTDIR)/gensrc/%, \
    82       $$(patsubst %.properties, %.java, \
    86       $$(patsubst %.properties, %.java, \
    83       $$(subst /$(OPENJDK_TARGET_OS)/classes,, \
    87       $$(subst /$(OPENJDK_TARGET_OS)/classes,, \
    84       $$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \
    88       $$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \
    97       $$(addprefix _SPACE_, $$($1_JAVAS)))))
   101       $$(addprefix _SPACE_, $$($1_JAVAS)))))
    98 
   102 
    99   $1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.marker
   103   $1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.marker
   100   $1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
   104   $1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
   101 
   105 
   102 # Now setup the rule for the generation of the resource bundles.
   106   # Now setup the rule for the generation of the resource bundles.
   103   $$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
   107   $$($1_TARGET): $$($1_SRC_FILES) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
   104 	$(MKDIR) -p $$(@D) $$($1_DIRS)
   108 	$(MKDIR) -p $$(@D) $$($1_DIRS)
   105 	$(ECHO) Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE)
   109 	$(ECHO) Compiling $$(words $$($1_SRC_FILES)) properties into resource bundles for $(MODULE)
   106 	$$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE)))
   110 	$$(eval $$(call ListPathsSafely, $1_CMDLINE, $$($1_CMDLINE_FILE)))
   107 	$(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)
   111 	$(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)