jdk/make/common/Rules.gmk
author katleman
Thu, 27 Dec 2012 12:15:06 -0800
changeset 14945 25285d2ea668
parent 14342 8435a30053c1
permissions -rw-r--r--
Added tag jdk8-b70 for changeset 2981496fa5fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 12047
diff changeset
     2
# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
    23
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
# Rules shared by all Java makefiles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
# Used to apply to source file $<, checks code conventions, issues warnings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
define check-conventions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
  if [ "$(CONVENTION_WATCH)" = "true" ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
    if [ "`$(CAT) -n -v -t $< | $(EGREP) -v '\@\(\#\)' | $(EGREP) '\^[MLI]'`" != "" ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
      $(ECHO) "WARNING: File contains tabs, ^M, or ^L characters: $<"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
      if [ "$(CONVENTION_DETAILS)" = "true" ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
        $(CAT) -n -v -t $< | $(EGREP) -v '\@\(\#\)' | $(EGREP) '\^[MLI]' ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
      fi; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    fi; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
  fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
# Make sure the default rule is all
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
rules_default_rule: all
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
# Directory set up.  (Needed by deploy workspace)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
$(CLASSDESTDIR) $(CLASSHDRDIR) $(OBJDIR) $(OUTPUTDIR) $(BINDIR) $(LIBDIR) $(LIBDIR)/$(LIBARCH) $(TEMPDIR) $(EXTDIR):
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
	$(MKDIR) -p $@ 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
# All source tree areas for java/properties files (a few may be closed)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    54
ifeq ($(PLATFORM), macosx)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    55
  ifdef OPENJDK
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    56
    ALL_CLASSES_SRC = $(call JavaSrcDirList,,classes)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    57
  else
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    58
    ALL_CLASSES_SRC = \
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    59
	  $(CLOSED_SHARE_SRC)/classes $(CLOSED_PLATFORM_SRC)/classes \
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    60
	  $(call JavaSrcDirList,,classes)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    61
  endif
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
else
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    63
  ifdef OPENJDK
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    64
    ALL_CLASSES_SRC = $(SHARE_SRC)/classes $(PLATFORM_SRC)/classes
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    65
  else
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    66
    ALL_CLASSES_SRC = \
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    67
	  $(CLOSED_SHARE_SRC)/classes $(CLOSED_PLATFORM_SRC)/classes \
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    68
	  $(SHARE_SRC)/classes $(PLATFORM_SRC)/classes
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
    69
  endif
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
# If AUTO_FILES_PROPERTIES_DIRS used, automatically find properties files
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
ifdef AUTO_FILES_PROPERTIES_DIRS
4115
e09be02771b6 6888701: Change all template java source files to a .java-template file suffix
ohair
parents: 715
diff changeset
    76
  AUTO_FILES_PROPERTIES_FILTERS1  = $(SCM_DIRs) ',*'
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
  AUTO_FILES_PROPERTIES_FILTERS1 += $(AUTO_PROPERTIES_PRUNE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
  FILES_properties_find_filters1 = $(AUTO_FILES_PROPERTIES_FILTERS1:%=-name % -prune -o)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  FILES_properties_auto1 := \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     $(shell \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        for dir in $(ALL_CLASSES_SRC) ; do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
          if [ -d $$dir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            ( $(CD) $$dir; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
              for sdir in $(AUTO_FILES_PROPERTIES_DIRS); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                if [ -d $$sdir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                  $(FIND) $$sdir $(FILES_properties_find_filters1) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                                 -name '*.properties' -print ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                fi ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
              done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            ); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
          fi; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
      )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
  FILES_properties_auto1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
endif # AUTO_FILES_PROPERTIES_DIRS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
# Add any automatically found properties files to the properties file list
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
FILES_properties += $(FILES_properties_auto1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
# Get Resources help
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
include $(JDK_TOPDIR)/make/common/internal/Resources.gmk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
# Compiling .java files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
# Automatically add to FILES_java if AUTO_FILES_JAVA_DIRS is defined
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
#    There are two basic types of sources, normal source files and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
#    generated ones. The Normal sources will be located in:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
#         $(ALL_CLASSES_SRC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
#    The generated sources, which might show up late to dinner, are at:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
#         $(GENSRCDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
#    and since they could be generated late, we need to be careful that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
#    we look for these sources late and not use the ':=' assignment which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
#    might miss their generation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
ifdef AUTO_FILES_JAVA_DIRS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
  # Filter out these files or directories
4115
e09be02771b6 6888701: Change all template java source files to a .java-template file suffix
ohair
parents: 715
diff changeset
   124
  AUTO_FILES_JAVA_SOURCE_FILTERS1  = $(SCM_DIRs) ',*'
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
  AUTO_FILES_JAVA_SOURCE_FILTERS2  = 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
  AUTO_FILES_JAVA_SOURCE_FILTERS1 += $(AUTO_JAVA_PRUNE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
  AUTO_FILES_JAVA_SOURCE_FILTERS2 += $(AUTO_JAVA_PRUNE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
  # First list is the normal sources that should always be there,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
  #   by using the ':=', which means we do this processing once.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
  FILES_java_find_filters1 = $(AUTO_FILES_JAVA_SOURCE_FILTERS1:%=-name % -prune -o)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
  FILES_java_auto1 := \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     $(shell \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        for dir in $(ALL_CLASSES_SRC) ; do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
          if [ -d $$dir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            ( $(CD) $$dir; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
              for sdir in $(AUTO_FILES_JAVA_DIRS); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                if [ -d $$sdir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                  $(FIND) $$sdir $(FILES_java_find_filters1) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                                 -name '*.java' -print ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                fi ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
              done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            ); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
          fi; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
      )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
  # Second list is the generated sources that should be rare, but will likely
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
  #   show up late and we need to look for them at the last minute, so we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
  #   cannot use the ':=' assigment here. But if this gets expanded multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
  #   times, the if tests should make them relatively cheap.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
  FILES_java_find_filters2 = $(AUTO_FILES_JAVA_SOURCE_FILTERS2:%=-name % -prune -o)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
  FILES_java_auto2 = \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     $(shell \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        for dir in $(GENSRCDIR); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
          if [ -d $$dir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            ( $(CD) $$dir; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
              for sdir in $(AUTO_FILES_JAVA_DIRS); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                if [ -d $$sdir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                  $(FIND) $$sdir $(FILES_java_find_filters2) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                                 -name '*.java' -print ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                fi ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
              done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            ); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
          fi; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
      )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
  FILES_java_auto1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
  FILES_java_auto2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
# Add all found java sources to FILES_java macro (if AUTO_FILES_JAVA_DIRS used)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
FILES_java += $(FILES_java_auto1) $(FILES_java_auto2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
# File that will hold java source names that need compiling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
JAVA_SOURCE_LIST=$(TEMPDIR)/.classes.list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
# Add a java source to the list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
define add-java-file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
$(ECHO) "$?" >> $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
$(check-conventions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
ifdef DEMOS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
$(CLASSDESTDIR)/%.class: $(SOURCEPATH)/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
#Redirect zh_HK java files to tmp directory which created from zh_TW
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
#$(CLASSDESTDIR)/%_zh_HK.class: $(JDK_L10N_TMP_OUTPUTDIR)/%_zh_HK.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
#	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
# Rules for closed files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
# If filenames are duplicated between open/closed workspaces, prefer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
# the closed files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
# Rule ordering in this Makefile is important: some targets depend
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
# on closed files replacing open ones, and thus the closed file rules
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
# must be found before the open ones.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
# Don't reorder without consulting teams that depend on this behavior.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
ifndef OPENJDK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
$(CLASSDESTDIR)/%.class: $(CLOSED_PLATFORM_SRC)/classes/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
$(CLASSDESTDIR)/%.class: $(CLOSED_SHARE_SRC)/classes/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
$(CLASSDESTDIR)/%.class: $(GENSRCDIR)/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
	@$(add-java-file)
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
   213
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
   214
ifeq ($(PLATFORM), macosx)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
   215
$(CLASSDESTDIR)/%.class: $(JDK_TOPDIR)/src/macosx/classes/%.java
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
   216
	@$(add-java-file)
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
   217
endif
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
$(CLASSDESTDIR)/%.class: $(PLATFORM_SRC)/classes/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
	@$(add-java-file)
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 11285
diff changeset
   220
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
$(CLASSDESTDIR)/%.class: $(SHARE_SRC)/classes/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
#Redirect zh_HK java files to tmp directory which created from zh_TW
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
$(CLASSDESTDIR)/%_zh_HK.class: $(JDK_L10N_TMP_OUTPUTDIR)/%_zh_HK.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
# List of class files needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
FILES_class = $(FILES_java:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
# Got to include exported files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
FILES_class += $(FILES_export:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
# Construct list of java sources we need to compile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
source_list_prime:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
	@$(MKDIR) -p $(TEMPDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
# Note that we slip resources in so that compiled properties files get created:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
$(JAVA_SOURCE_LIST) : source_list_prime resources $(FILES_class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
	@$(TOUCH) $@
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
.delete.classlist:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
	@$(RM) $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
# Make sure all newer sources are compiled (in a batch)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
classes : $(CLASSES_INIT) .delete.classlist .compile.classlist
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
.compile.classlist : $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
	@$(MKDIR) -p $(CLASSDESTDIR)
313
4ca328b9cf83 6641585: jdk/make/javax/Makefile should not have both SUBDIRS and AUTO_FILES_JAVA_DIRS
ohair
parents: 2
diff changeset
   250
	@$(RM) $<.filtered
4ca328b9cf83 6641585: jdk/make/javax/Makefile should not have both SUBDIRS and AUTO_FILES_JAVA_DIRS
ohair
parents: 2
diff changeset
   251
	@$(CAT) $< | $(NAWK) 'length>0' | $(SORT) -u > $<.filtered
11118
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   252
	@numfiles=`$(WC) -l < $<.filtered` ; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   253
	  if [ $$numfiles -ge 1 ] ; then \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   254
	    $(ECHO) "# Java sources to be compiled: (listed in file $<)"; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   255
	    $(CAT) $<.filtered; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   256
	    $(ECHO) "# Running javac: $$numfiles files; in $(CURDIR)"; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   257
	    $(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
11285
ba471669d352 7122235: stop the build if javac fails
smarks
parents: 11118
diff changeset
   258
	    $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered && \
11118
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   259
	    $(ECHO) "# javac finished"; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   260
	  fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
	@$(java-vm-cleanup)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
clobber clean::
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
	$(RM) $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
ifndef DONT_CLOBBER_CLASSES
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
  ifndef PACKAGE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    DONT_CLOBBER_CLASSES = true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    DONT_CLOBBER_CLASSES = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
packages.clean:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
ifeq ($(DONT_CLOBBER_CLASSES),false)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
  ifdef AUTO_FILES_JAVA_DIRS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
	@for sdir in $(AUTO_FILES_JAVA_DIRS); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
	  $(ECHO) "$(RM) -r $(CLASSDESTDIR)/$$sdir"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
	  $(RM) -r $(CLASSDESTDIR)/$$sdir; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
	$(RM) -r $(CLASSDESTDIR)/$(PKGDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
ifdef DEMOS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
classes.clean:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
	$(RM) -r $(DEMODST) $(CLASSDESTDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
classes.clean: packages.clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
	$(RM) $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
# C and C++ make dependencies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
include $(JDK_TOPDIR)/make/common/internal/NativeCompileRules.gmk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
# Running Javah to generate stuff into CClassHeaders.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
ifdef FILES_export
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
CLASSES.export  = $(subst /,.,$(FILES_export:%.java=%))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
CLASSES.export += $(subst /,.,$(FILES_export2:%.java=%))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
CLASSES.export += $(subst /,.,$(FILES_export3:%.java=%))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
CLASSES_export  = $(FILES_export:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
CLASSES_export += $(FILES_export2:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
CLASSES_export += $(FILES_export3:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
# Fix when deploy workspace makefiles don't depend on this name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
#CLASSHDR_DOTFILE=$(CLASSHDRDIR)/.classheaders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
CLASSHDR_DOTFILE=$(OBJDIR)/.class.headers.$(ARCH)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
classheaders: classes $(CLASSHDR_DOTFILE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
$(CLASSHDR_DOTFILE): $(CLASSES_export)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
	$(prep-target)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
	@$(ECHO) "# Running javah:"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
	$(JAVAH_CMD) -d $(CLASSHDRDIR)/ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
		$(CLASSES.export) $(subst $$,\$$,$(EXPORTED_inner))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
	@$(java-vm-cleanup)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
	@$(TOUCH) $@
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
classheaders.clean:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
	$(RM) $(CLASSHDR_DOTFILE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
	$(RM) -r $(CLASSHDRDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
else # FILES_export
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
classheaders: classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
classheaders.clean: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
endif # FILES_export
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
clean clobber:: classheaders.clean classes.clean .delete.classlist
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
# Default dependencies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
all: build
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
build: classheaders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
default: all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
.PHONY: all build clean clobber \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        .delete.classlist classes .compile.classlist classes.clean \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
	 classheaders classheaders.clean \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
	 batch_compile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355