jdk/make/common/Rules.gmk
author smarks
Wed, 30 Nov 2011 13:11:16 -0800
changeset 11118 5935bcaa1e5c
parent 5506 202f599c92aa
child 11285 ba471669d352
permissions -rw-r--r--
7116322: enhance javac make rule with a little bit of instrumentation Reviewed-by: dholmes, ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
     2
# Copyright (c) 1995, 2008, 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
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
ifdef OPENJDK
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
  ALL_CLASSES_SRC = $(SHARE_SRC)/classes $(PLATFORM_SRC)/classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
  ALL_CLASSES_SRC = \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
	$(CLOSED_SHARE_SRC)/classes $(CLOSED_PLATFORM_SRC)/classes \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
	$(SHARE_SRC)/classes $(PLATFORM_SRC)/classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
# If AUTO_FILES_PROPERTIES_DIRS used, automatically find properties files
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
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
    66
  AUTO_FILES_PROPERTIES_FILTERS1  = $(SCM_DIRs) ',*'
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
  AUTO_FILES_PROPERTIES_FILTERS1 += $(AUTO_PROPERTIES_PRUNE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
  FILES_properties_find_filters1 = $(AUTO_FILES_PROPERTIES_FILTERS1:%=-name % -prune -o)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  FILES_properties_auto1 := \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     $(shell \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        for dir in $(ALL_CLASSES_SRC) ; do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
          if [ -d $$dir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
            ( $(CD) $$dir; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
              for sdir in $(AUTO_FILES_PROPERTIES_DIRS); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                if [ -d $$sdir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
                  $(FIND) $$sdir $(FILES_properties_find_filters1) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                                 -name '*.properties' -print ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                fi ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
              done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            ); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
          fi; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
      )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
  FILES_properties_auto1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
endif # AUTO_FILES_PROPERTIES_DIRS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
# Add any automatically found properties files to the properties file list
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
FILES_properties += $(FILES_properties_auto1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
# Get Resources help
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
include $(JDK_TOPDIR)/make/common/internal/Resources.gmk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
# Compiling .java files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
# Automatically add to FILES_java if AUTO_FILES_JAVA_DIRS is defined
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
#    There are two basic types of sources, normal source files and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
#    generated ones. The Normal sources will be located in:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
#         $(ALL_CLASSES_SRC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
#    The generated sources, which might show up late to dinner, are at:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
#         $(GENSRCDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
#    and since they could be generated late, we need to be careful that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
#    we look for these sources late and not use the ':=' assignment which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
#    might miss their generation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
ifdef AUTO_FILES_JAVA_DIRS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
  # 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
   114
  AUTO_FILES_JAVA_SOURCE_FILTERS1  = $(SCM_DIRs) ',*'
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
  AUTO_FILES_JAVA_SOURCE_FILTERS2  = 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
  AUTO_FILES_JAVA_SOURCE_FILTERS1 += $(AUTO_JAVA_PRUNE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
  AUTO_FILES_JAVA_SOURCE_FILTERS2 += $(AUTO_JAVA_PRUNE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
  # First list is the normal sources that should always be there,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
  #   by using the ':=', which means we do this processing once.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
  FILES_java_find_filters1 = $(AUTO_FILES_JAVA_SOURCE_FILTERS1:%=-name % -prune -o)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
  FILES_java_auto1 := \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     $(shell \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        for dir in $(ALL_CLASSES_SRC) ; do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
          if [ -d $$dir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            ( $(CD) $$dir; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
              for sdir in $(AUTO_FILES_JAVA_DIRS); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                if [ -d $$sdir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                  $(FIND) $$sdir $(FILES_java_find_filters1) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                                 -name '*.java' -print ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                fi ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
              done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            ); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
          fi; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
      )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
  # Second list is the generated sources that should be rare, but will likely
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
  #   show up late and we need to look for them at the last minute, so we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
  #   cannot use the ':=' assigment here. But if this gets expanded multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
  #   times, the if tests should make them relatively cheap.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
  FILES_java_find_filters2 = $(AUTO_FILES_JAVA_SOURCE_FILTERS2:%=-name % -prune -o)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
  FILES_java_auto2 = \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     $(shell \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        for dir in $(GENSRCDIR); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
          if [ -d $$dir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            ( $(CD) $$dir; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
              for sdir in $(AUTO_FILES_JAVA_DIRS); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                if [ -d $$sdir ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                  $(FIND) $$sdir $(FILES_java_find_filters2) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                                 -name '*.java' -print ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                fi ; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
              done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            ); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
          fi; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        done \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
      )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
  FILES_java_auto1 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
  FILES_java_auto2 =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
# Add all found java sources to FILES_java macro (if AUTO_FILES_JAVA_DIRS used)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
FILES_java += $(FILES_java_auto1) $(FILES_java_auto2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
# File that will hold java source names that need compiling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
JAVA_SOURCE_LIST=$(TEMPDIR)/.classes.list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
# Add a java source to the list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
define add-java-file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
$(ECHO) "$?" >> $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
$(check-conventions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
endef
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
ifdef DEMOS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
$(CLASSDESTDIR)/%.class: $(SOURCEPATH)/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
#Redirect zh_HK java files to tmp directory which created from zh_TW
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
#$(CLASSDESTDIR)/%_zh_HK.class: $(JDK_L10N_TMP_OUTPUTDIR)/%_zh_HK.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
#	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
# Rules for closed files
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
# If filenames are duplicated between open/closed workspaces, prefer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
# the closed files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
# Rule ordering in this Makefile is important: some targets depend
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
# on closed files replacing open ones, and thus the closed file rules
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
# must be found before the open ones.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
# Don't reorder without consulting teams that depend on this behavior.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
ifndef OPENJDK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
$(CLASSDESTDIR)/%.class: $(CLOSED_PLATFORM_SRC)/classes/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
$(CLASSDESTDIR)/%.class: $(CLOSED_SHARE_SRC)/classes/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
$(CLASSDESTDIR)/%.class: $(GENSRCDIR)/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
$(CLASSDESTDIR)/%.class: $(PLATFORM_SRC)/classes/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
$(CLASSDESTDIR)/%.class: $(SHARE_SRC)/classes/%.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
#Redirect zh_HK java files to tmp directory which created from zh_TW
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
$(CLASSDESTDIR)/%_zh_HK.class: $(JDK_L10N_TMP_OUTPUTDIR)/%_zh_HK.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
	@$(add-java-file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
# List of class files needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
FILES_class = $(FILES_java:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
# Got to include exported files.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
FILES_class += $(FILES_export:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
# Construct list of java sources we need to compile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
source_list_prime:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
	@$(MKDIR) -p $(TEMPDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
# Note that we slip resources in so that compiled properties files get created:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
$(JAVA_SOURCE_LIST) : source_list_prime resources $(FILES_class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
	@$(TOUCH) $@
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
.delete.classlist:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
	@$(RM) $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
# Make sure all newer sources are compiled (in a batch)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
classes : $(CLASSES_INIT) .delete.classlist .compile.classlist
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
.compile.classlist : $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
	@$(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
   234
	@$(RM) $<.filtered
4ca328b9cf83 6641585: jdk/make/javax/Makefile should not have both SUBDIRS and AUTO_FILES_JAVA_DIRS
ohair
parents: 2
diff changeset
   235
	@$(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
   236
	@numfiles=`$(WC) -l < $<.filtered` ; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   237
	  if [ $$numfiles -ge 1 ] ; then \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   238
	    $(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
   239
	    $(CAT) $<.filtered; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   240
	    $(ECHO) "# Running javac: $$numfiles files; in $(CURDIR)"; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   241
	    $(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   242
	    $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   243
	    $(ECHO) "# javac finished"; \
5935bcaa1e5c 7116322: enhance javac make rule with a little bit of instrumentation
smarks
parents: 5506
diff changeset
   244
	  fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
	@$(java-vm-cleanup)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
clobber clean::
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
	$(RM) $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
ifndef DONT_CLOBBER_CLASSES
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
  ifndef PACKAGE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    DONT_CLOBBER_CLASSES = true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    DONT_CLOBBER_CLASSES = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
packages.clean:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
ifeq ($(DONT_CLOBBER_CLASSES),false)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
  ifdef AUTO_FILES_JAVA_DIRS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
	@for sdir in $(AUTO_FILES_JAVA_DIRS); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
	  $(ECHO) "$(RM) -r $(CLASSDESTDIR)/$$sdir"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
	  $(RM) -r $(CLASSDESTDIR)/$$sdir; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
	$(RM) -r $(CLASSDESTDIR)/$(PKGDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
ifdef DEMOS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
classes.clean:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
	$(RM) -r $(DEMODST) $(CLASSDESTDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
classes.clean: packages.clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
	$(RM) $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
# C and C++ make dependencies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
include $(JDK_TOPDIR)/make/common/internal/NativeCompileRules.gmk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
# Running Javah to generate stuff into CClassHeaders.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
ifdef FILES_export
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
CLASSES.export  = $(subst /,.,$(FILES_export:%.java=%))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
CLASSES.export += $(subst /,.,$(FILES_export2:%.java=%))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
CLASSES.export += $(subst /,.,$(FILES_export3:%.java=%))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
CLASSES_export  = $(FILES_export:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
CLASSES_export += $(FILES_export2:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
CLASSES_export += $(FILES_export3:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
# Fix when deploy workspace makefiles don't depend on this name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
#CLASSHDR_DOTFILE=$(CLASSHDRDIR)/.classheaders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
CLASSHDR_DOTFILE=$(OBJDIR)/.class.headers.$(ARCH)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
classheaders: classes $(CLASSHDR_DOTFILE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
$(CLASSHDR_DOTFILE): $(CLASSES_export)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
	$(prep-target)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
	@$(ECHO) "# Running javah:"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
	$(JAVAH_CMD) -d $(CLASSHDRDIR)/ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
		$(CLASSES.export) $(subst $$,\$$,$(EXPORTED_inner))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
	@$(java-vm-cleanup)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
	@$(TOUCH) $@
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
classheaders.clean:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
	$(RM) $(CLASSHDR_DOTFILE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
	$(RM) -r $(CLASSHDRDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
else # FILES_export
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
classheaders: classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
classheaders.clean: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
endif # FILES_export
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
clean clobber:: classheaders.clean classes.clean .delete.classlist
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
# Default dependencies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
all: build
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
build: classheaders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
default: all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
.PHONY: all build clean clobber \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        .delete.classlist classes .compile.classlist classes.clean \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
	 classheaders classheaders.clean \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
	 batch_compile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339