jdk/make/common/Rules.gmk
author kvn
Wed, 05 Mar 2008 11:33:31 -0800
changeset 210 6da234892f4a
parent 2 90ce3da70b43
child 313 4ca328b9cf83
permissions -rw-r--r--
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation Summary: In Parse::do_if() 'c' (CmpNode) node may be changed during BoolNode transformation so 'c' may became dead but the node is referenced later in the code. Reviewed-by: never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
# Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# by Sun in the LICENSE file that accompanied this code.
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
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
# have any questions.
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
  AUTO_FILES_PROPERTIES_FILTERS1  = $(SCM_DIRs) 'X-*' '*-X-*' ',*'
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
  AUTO_FILES_JAVA_SOURCE_FILTERS1  = $(SCM_DIRs) 'X-*' '*-X-*' '*-template.java' ',*'
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)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
	@if [ `$(CAT) $(JAVA_SOURCE_LIST) | $(WC) -l` -ge 1 ] ; then \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
	  $(ECHO) "# Java sources to be compiled: (listed in file $(JAVA_SOURCE_LIST))"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
	  $(CAT) $(JAVA_SOURCE_LIST); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
	  $(ECHO) "# Running javac:"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
	  $(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$(JAVA_SOURCE_LIST); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
	  $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$(JAVA_SOURCE_LIST); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
	fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
	@$(java-vm-cleanup)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
clobber clean::
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
	$(RM) $(JAVA_SOURCE_LIST)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
ifndef DONT_CLOBBER_CLASSES
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
  ifndef PACKAGE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    DONT_CLOBBER_CLASSES = true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    DONT_CLOBBER_CLASSES = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
packages.clean:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
ifeq ($(DONT_CLOBBER_CLASSES),false)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
  ifdef AUTO_FILES_JAVA_DIRS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
	@for sdir in $(AUTO_FILES_JAVA_DIRS); do \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
	  $(ECHO) "$(RM) -r $(CLASSDESTDIR)/$$sdir"; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
	  $(RM) -r $(CLASSDESTDIR)/$$sdir; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
	$(RM) -r $(CLASSDESTDIR)/$(PKGDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
ifdef DEMOS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
classes.clean:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
	$(RM) -r $(DEMODST) $(CLASSDESTDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
classes.clean: packages.clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
	$(RM) $(JAVA_SOURCE_LIST)
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
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
# C and C++ make dependencies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
include $(JDK_TOPDIR)/make/common/internal/NativeCompileRules.gmk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
# Running Javah to generate stuff into CClassHeaders.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
ifdef FILES_export
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
CLASSES.export  = $(subst /,.,$(FILES_export:%.java=%))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
CLASSES.export += $(subst /,.,$(FILES_export2:%.java=%))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
CLASSES.export += $(subst /,.,$(FILES_export3:%.java=%))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
CLASSES_export  = $(FILES_export:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
CLASSES_export += $(FILES_export2:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
CLASSES_export += $(FILES_export3:%.java=$(CLASSDESTDIR)/%.class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
# Fix when deploy workspace makefiles don't depend on this name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
#CLASSHDR_DOTFILE=$(CLASSHDRDIR)/.classheaders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
CLASSHDR_DOTFILE=$(OBJDIR)/.class.headers.$(ARCH)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
classheaders: classes $(CLASSHDR_DOTFILE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
$(CLASSHDR_DOTFILE): $(CLASSES_export)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
	$(prep-target)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
	@$(ECHO) "# Running javah:"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
	$(JAVAH_CMD) -d $(CLASSHDRDIR)/ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
		$(CLASSES.export) $(subst $$,\$$,$(EXPORTED_inner))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
	@$(java-vm-cleanup)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
	@$(TOUCH) $@
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
classheaders.clean:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
	$(RM) $(CLASSHDR_DOTFILE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
	$(RM) -r $(CLASSHDRDIR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
else # FILES_export
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
classheaders: classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
classheaders.clean: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
endif # FILES_export
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
clean clobber:: classheaders.clean classes.clean .delete.classlist
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
# Default dependencies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
all: build
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
build: classheaders
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
default: all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
.PHONY: all build clean clobber \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
        .delete.classlist classes .compile.classlist classes.clean \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
	 classheaders classheaders.clean \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
	 batch_compile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335