jdk/make/gensrc/GensrcProperties.gmk
author chegar
Wed, 03 Dec 2014 14:22:58 +0000
changeset 27565 729f9700483a
parent 27088 ea6446a9121b
child 27799 097b1d6f6894
permissions -rw-r--r--
8049367: Modular Run-Time Images Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, bradford.wetmore@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, james.laskey@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com, sundararajan.athijegannathan@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     1
#
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 27088
diff changeset
     2
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     4
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    10
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    15
# accompanied this code).
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    16
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    20
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    23
# questions.
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    24
#
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    25
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    26
# This file defines macros that sets up rules for generating java classes
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    27
# from resource bundle properties files.
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    28
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    29
################################################################################
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    30
# Helper macro for SetupCopy-zh_HK.
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    31
define SetupOneCopy-zh_HK
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    32
  $1_$2_TARGET := $$(patsubst $(JDK_TOPDIR)/src/$(MODULE)/share/classes/%, \
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 27088
diff changeset
    33
      $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    34
      $$(subst _zh_TW,_zh_HK, $2))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    35
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    36
  $$($1_$2_TARGET): $2
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    37
	$(MKDIR) -p $$(@D)
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    38
	$(CAT) $$< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $$@
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    39
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    40
  $1 += $$($1_$2_TARGET)
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    41
endef
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    42
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    43
################################################################################
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    44
# Creates rules for copying zh_TW resources to zh_HK.
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    45
# Param 1 - Variable to add targets to
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    46
# Param 2 - Files to copy from
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    47
define SetupCopy-zh_HK
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    48
  $$(foreach f, $2, $$(eval $$(call SetupOneCopy-zh_HK,$1,$$f)))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    49
endef
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    50
23236
7c5997f59e20 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 23010
diff changeset
    51
################################################################################
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    52
# Creates a rule that runs CompileProperties on a set of properties files.
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    53
# Param 1 - Variable to add targets to, must not contain space
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    54
# Param 2 - Properties files to process
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    55
# Param 3 - The super class for the generated classes
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    56
define SetupCompileProperties
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    57
  $1_SRCS := $2
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    58
  $1_CLASS := $3
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    59
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    60
  # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    61
  # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    62
  # Strip away prefix and suffix, leaving for example only: 
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    63
  # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    64
  $1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 27088
diff changeset
    65
      $(SUPPORT_OUTPUTDIR)/gensrc/%, \
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    66
      $$(patsubst %.properties, %.java, \
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    67
      $$(subst /share/classes,, $$($1_SRCS))))
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    68
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    69
  # Generate the package dirs for the to be generated java files. Sort to remove
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    70
  # duplicates.
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    71
  $1_DIRS := $$(sort $$(dir $$($1_JAVAS)))
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    72
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    73
  # Now generate a sequence of:
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    74
  # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    75
  # suitable to be fed into the CompileProperties command.
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    76
  $1_CMDLINE := $$(subst _SPACE_, $(SPACE), \
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    77
      $$(join $$(addprefix -compile_SPACE_, $$($1_SRCS)), \
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    78
      $$(addsuffix _SPACE_$$($1_CLASS), \
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    79
      $$(addprefix _SPACE_, $$($1_JAVAS)))))
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    80
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 27088
diff changeset
    81
  $1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.done
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 27088
diff changeset
    82
  $1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13583
diff changeset
    83
27565
729f9700483a 8049367: Modular Run-Time Images
chegar
parents: 27088
diff changeset
    84
# Now setup the rule for the generation of the resource bundles.
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    85
  $$($1_TARGET): $$($1_SRCS) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    86
	$(MKDIR) -p $$(@D) $$($1_DIRS)
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    87
	$(ECHO) Compiling $$(words $$($1_SRCS)) properties into resource bundles for $(MODULE)
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    88
	$(RM) $$($1_CMDLINE_FILE)
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    89
	$$(call ListPathsSafely,$1_CMDLINE,\n, >> $$($1_CMDLINE_FILE))
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    90
	$(TOOL_COMPILEPROPERTIES) -quiet @$$($1_CMDLINE_FILE)
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    91
	$(TOUCH) $$@
13702
efd6a05935b2 7197849: Update new build-infra makefiles
ohair
parents: 13583
diff changeset
    92
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    93
  $$($1_JAVAS): $$($1_SRCS)
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    94
27088
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    95
  # Create zh_HK versions of all zh_TW files created above
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    96
  $$(eval $$(call SetupCopy-zh_HK,$1_HK,$$(filter %_zh_TW.java, $$($1_JAVAS))))
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    97
  # The zh_HK copy must wait for the compile properties tool to run
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    98
  $$($1_HK): $$($1_TARGET)
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
    99
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
   100
  $1 += $$($1_JAVAS) $$($1_TARGET) $$($1_HK)
ea6446a9121b 8055191: Split GensrcProperties.gmk into separate modules
erikj
parents: 26192
diff changeset
   101
endef
12317
9670c1610c53 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   102
23236
7c5997f59e20 8036611: Cleanup of handling of properties and other java resources in the build
erikj
parents: 23010
diff changeset
   103
################################################################################