make/ZipSource.gmk
author goetz
Fri, 20 Jul 2018 09:33:49 +0200
changeset 51213 24c4780f69a5
parent 50590 5fa19bad622d
child 52804 28094715ae71
permissions -rw-r--r--
8207766: [testbug] Adapt tests for Aix. Reviewed-by: clanger, mbaesken
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     1
#
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
     2
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     4
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    10
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    15
# accompanied this code).
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    16
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    20
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    23
# questions.
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    24
#
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    25
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    26
default: all
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    27
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    28
include $(SPEC)
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    29
include MakeBase.gmk
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    30
include JavaCompilation.gmk
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    31
include Modules.gmk
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    32
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    33
SRC_ZIP_WORK_DIR := $(SUPPORT_OUTPUTDIR)/src
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    34
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    35
# Hook to include the corresponding custom file, if present.
47314
743814386712 8188814: Simplify IncludeCustomExtension
ihse
parents: 41658
diff changeset
    36
$(eval $(call IncludeCustomExtension, ZipSource.gmk))
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    37
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    38
################################################################################
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    39
# Create the directory structure for src.zip using symlinks.
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    40
# <module>/<package>/<file>.java
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    41
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    42
# Find extra source dirs for a module that are not part of normal compilation
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    43
# but should be included in src.zip.
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    44
# $1: Module to find dirs for
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    45
ExtraSrcDirs = \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    46
    $(wildcard $(SUPPORT_OUTPUTDIR)/rmic/$(strip $1))
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    47
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    48
ALL_MODULES := $(FindAllModules)
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    49
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    50
# Generate the src dirs in the first make invocation and then call this makefile
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    51
# again to create src.zip.
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    52
$(foreach m, $(ALL_MODULES), \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    53
  $(foreach d, $(call FindModuleSrcDirs, $m) $(call ExtraSrcDirs, $m), \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    54
    $(eval $d_TARGET := $(SRC_ZIP_WORK_DIR)/$(patsubst $(TOPDIR)/%,%,$d)/$m) \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    55
    $(if $(SRC_GENERATED), , \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    56
      $(eval $$($d_TARGET): $d ; \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    57
          $$(if $(filter $(TOPDIR)/%, $d), $$(link-file-relative), $$(link-file-absolute)) \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    58
      ) \
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    59
    ) \
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    60
    $(eval SRC_ZIP_SRCS += $$($d_TARGET)) \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    61
    $(eval SRC_ZIP_SRCS_$m += $$($d_TARGET)) \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    62
  ) \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    63
)
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    64
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    65
TARGETS += $(SRC_ZIP_SRCS)
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    66
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    67
################################################################################
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    68
# Only evaluate the creation of src.zip in a sub make call when the symlinked
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    69
# src directory structure has been generated.
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    70
ifeq ($(SRC_GENERATED), true)
50590
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    71
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    72
  # Rewrite the EXCLUDE_TRANSLATIONS locales as exclude patters for java files
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    73
  TRANSLATIONS_PATTERN := $(addprefix %_, $(addsuffix .java, $(EXCLUDE_TRANSLATIONS)))
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    74
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    75
  # Add excludes for translations for all modules except jdk.localedata
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    76
  $(foreach s, $(SRC_ZIP_SRCS), \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    77
    $(if $(filter $(notdir $s), jdk.localedata), , \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    78
      $(eval BUILD_SRC_ZIP_EXCLUDE_PATTERNS_$(dir $s) := $$(TRANSLATIONS_PATTERN)) \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    79
    ) \
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    80
  )
5fa19bad622d 8204973: Add build support for filtering translations
erikj
parents: 47314
diff changeset
    81
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    82
  $(eval $(call SetupZipArchive, BUILD_SRC_ZIP, \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    83
      SRC := $(dir $(SRC_ZIP_SRCS)), \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    84
      INCLUDES := $(SRC_ZIP_INCLUDES), \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    85
      INCLUDE_FILES := $(SRC_ZIP_INCLUDE_FILES), \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    86
      EXCLUDES := $(SRC_ZIP_EXCLUDES), \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    87
      EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    88
      SUFFIXES := .java, \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    89
      ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    90
  ))
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
    91
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    92
  do-zip: $(BUILD_SRC_ZIP)
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    93
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    94
  .PHONY: do-zip
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    95
endif
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    96
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    97
zip: $(SRC_ZIP_SRCS)
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    98
	+$(MAKE) $(MAKE_ARGS) -f ZipSource.gmk do-zip SRC_GENERATED=true
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
    99
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
   100
TARGETS += zip
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
   101
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
   102
################################################################################
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
   103
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
   104
all: $(TARGETS)
27560
adc258b13e2c 8049367: Modular Run-Time Images
chegar
parents:
diff changeset
   105
41658
14de1ab85d25 8062810: Examine src.zip in JDK image and decide if source classes should be organized by module
erikj
parents: 28600
diff changeset
   106
.PHONY: default all zip