corba/make/common/Defs.gmk
author ohair
Wed, 02 Sep 2009 09:20:17 -0700
changeset 3871 3d528461f61d
parent 4 02bb8761fcce
child 5555 b2b5ed3f0d0d
permissions -rw-r--r--
6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building) Reviewed-by: jjg, iris
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     1
#
3871
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
     2
# Copyright 1995-2009 Sun Microsystems, Inc.  All Rights Reserved.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02bb8761fcce Initial load
duke
parents:
diff changeset
     4
#
02bb8761fcce Initial load
duke
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
02bb8761fcce Initial load
duke
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
02bb8761fcce Initial load
duke
parents:
diff changeset
     7
# published by the Free Software Foundation.  Sun designates this
02bb8761fcce Initial load
duke
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
02bb8761fcce Initial load
duke
parents:
diff changeset
     9
# by Sun in the LICENSE file that accompanied this code.
02bb8761fcce Initial load
duke
parents:
diff changeset
    10
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
02bb8761fcce Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02bb8761fcce Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
02bb8761fcce Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
02bb8761fcce Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
02bb8761fcce Initial load
duke
parents:
diff changeset
    16
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
02bb8761fcce Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
02bb8761fcce Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02bb8761fcce Initial load
duke
parents:
diff changeset
    20
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
02bb8761fcce Initial load
duke
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
02bb8761fcce Initial load
duke
parents:
diff changeset
    23
# have any questions.
02bb8761fcce Initial load
duke
parents:
diff changeset
    24
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    25
02bb8761fcce Initial load
duke
parents:
diff changeset
    26
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    27
# Common variables used by all the Java makefiles.  This file should
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
# not contain rules.
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
# On Solaris, the 'make' utility from Sun will not work with these makefiles.
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
#    This little rule is only understood by Sun's make, and is harmless
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
#    when seen by the GNU make tool. If using Sun's make, this causes the
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
#    make command to fail.
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
SUN_MAKE_TEST:sh = echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
include $(BUILDDIR)/common/shared/Platform.gmk
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
TOPDIR=$(BUILDDIR)/..
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
include $(TOPDIR)/make/common/CancelImplicits.gmk
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
# Historically PLATFORM_SRC used to be src/$(PLATFORM), but we switched it to
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
# src/solaris so if you want to build on Linux you didn't need a src/linux
02bb8761fcce Initial load
duke
parents:
diff changeset
    47
# directory.  In an ideal world it would be called src/genunix but we are not
02bb8761fcce Initial load
duke
parents:
diff changeset
    48
# there yet.
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
ifndef SHARE_SRC
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
  SHARE_SRC    = $(TOPDIR)/src/share
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
_OUTPUTDIR=$(TOPDIR)/build/$(PLATFORM)-$(ARCH)
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
# Get platform definitions
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
include $(TOPDIR)/make/common/Defs-$(PLATFORM).gmk
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
# Localizations for the different parts of the product beyond English
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
JRE_LOCALES   = de es fr it ja ko sv zh_CN zh_TW zh_HK
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
PLUGIN_LOCALES = de es fr it ja ko sv zh_CN zh_TW zh_HK
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
JDK_LOCALES  = ja zh_CN
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
# A list of locales we support but don't have resource files.
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
# This is defined to optimize the search of resource bundles.
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
JRE_NONEXIST_LOCALES = en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
# All libraries except libjava and libjvm itself link against libjvm and
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
# libjava, the latter for its exported common utilities.  libjava only links
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
# against libjvm.  Programs' makefiles take their own responsibility for
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
# adding other libs.
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
ifdef PACKAGE
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
# put JAVALIB first, but do not lose any platform specific values....
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
  LDLIBS_COMMON = $(JAVALIB)
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
endif # PACKAGE
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
# Libraries that must appear ahead of libc.so on the link command line
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
#
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
ifdef PROGRAM
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
  ifeq ($(PLATFORM), solaris)
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
    LDLIBS_COMMON = -lthread -ldl
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
  ifeq ($(PLATFORM), linux)
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
    LDLIBS_COMMON = -ldl
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
endif # PROGRAM
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
LDLIBS_COMMON += $(EXTRA_LIBS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
# Default is to build, not import native binaries
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
ifndef IMPORT_NATIVE_BINARIES
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
  IMPORT_NATIVE_BINARIES=false
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
# If importing libraries in, no incremental builds
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
ifeq ($(IMPORT_NATIVE_BINARIES),true)
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
 INCREMENTAL_BUILD=false
02bb8761fcce Initial load
duke
parents:
diff changeset
   113
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   114
02bb8761fcce Initial load
duke
parents:
diff changeset
   115
# for generated libraries
02bb8761fcce Initial load
duke
parents:
diff changeset
   116
LIBDIR              = $(OUTPUTDIR)/lib
02bb8761fcce Initial load
duke
parents:
diff changeset
   117
ABS_LIBDIR          = $(ABS_OUTPUTDIR)/lib
02bb8761fcce Initial load
duke
parents:
diff changeset
   118
# Optional place to save the windows .lib files
02bb8761fcce Initial load
duke
parents:
diff changeset
   119
LIBFILES_DIR        = $(OUTPUTDIR)/libfiles
02bb8761fcce Initial load
duke
parents:
diff changeset
   120
# for ext jre files
02bb8761fcce Initial load
duke
parents:
diff changeset
   121
EXTDIR              = $(LIBDIR)/ext
02bb8761fcce Initial load
duke
parents:
diff changeset
   122
# for generated include files
02bb8761fcce Initial load
duke
parents:
diff changeset
   123
INCLUDEDIR          = $(OUTPUTDIR)/include
02bb8761fcce Initial load
duke
parents:
diff changeset
   124
# for generated class files
02bb8761fcce Initial load
duke
parents:
diff changeset
   125
CLASSBINDIR         = $(OUTPUTDIR)/classes
02bb8761fcce Initial load
duke
parents:
diff changeset
   126
DEMOCLASSDIR        = $(OUTPUTDIR)/democlasses
02bb8761fcce Initial load
duke
parents:
diff changeset
   127
# for generated tool class files
02bb8761fcce Initial load
duke
parents:
diff changeset
   128
BUILDTOOLCLASSDIR   = $(OUTPUTDIR)/btclasses
02bb8761fcce Initial load
duke
parents:
diff changeset
   129
# for build tool jar files
02bb8761fcce Initial load
duke
parents:
diff changeset
   130
BUILDTOOLJARDIR     = $(OUTPUTDIR)/btjars
02bb8761fcce Initial load
duke
parents:
diff changeset
   131
ABS_BUILDTOOLJARDIR = $(ABS_OUTPUTDIR)/btjars
02bb8761fcce Initial load
duke
parents:
diff changeset
   132
# for generated java source files
02bb8761fcce Initial load
duke
parents:
diff changeset
   133
GENSRCDIR           = $(OUTPUTDIR)/gensrc
02bb8761fcce Initial load
duke
parents:
diff changeset
   134
# for generated C source files (not javah)
02bb8761fcce Initial load
duke
parents:
diff changeset
   135
GENNATIVESRCDIR     = $(OUTPUTDIR)/gennativesrc
02bb8761fcce Initial load
duke
parents:
diff changeset
   136
# for imported source files
02bb8761fcce Initial load
duke
parents:
diff changeset
   137
IMPORTSRCDIR        = $(OUTPUTDIR)/impsrc
02bb8761fcce Initial load
duke
parents:
diff changeset
   138
# for imported documents
02bb8761fcce Initial load
duke
parents:
diff changeset
   139
IMPORTDOCDIR        = $(OUTPUTDIR)/impdoc
02bb8761fcce Initial load
duke
parents:
diff changeset
   140
# for generated demo
02bb8761fcce Initial load
duke
parents:
diff changeset
   141
DEMODIR             = $(OUTPUTDIR)/demo
02bb8761fcce Initial load
duke
parents:
diff changeset
   142
# for sample code
02bb8761fcce Initial load
duke
parents:
diff changeset
   143
SAMPLEDIR           = $(OUTPUTDIR)/sample
02bb8761fcce Initial load
duke
parents:
diff changeset
   144
# for generated documentation
02bb8761fcce Initial load
duke
parents:
diff changeset
   145
DOCSDIR             = $(OUTPUTDIR)/docs$(DOCSDIRSUFFIX)
02bb8761fcce Initial load
duke
parents:
diff changeset
   146
DOCSDIRSUFFIX       =
02bb8761fcce Initial load
duke
parents:
diff changeset
   147
02bb8761fcce Initial load
duke
parents:
diff changeset
   148
# An attempt is made to generate unique enough directories for the
02bb8761fcce Initial load
duke
parents:
diff changeset
   149
# generated files to not have name collisisons. Most build units
02bb8761fcce Initial load
duke
parents:
diff changeset
   150
# defines PRODUCT (except Release.gmk), but then they may or may 
02bb8761fcce Initial load
duke
parents:
diff changeset
   151
# not define PACKAGE, THREADIR (only HPI uses this), PROGRAM, and 
02bb8761fcce Initial load
duke
parents:
diff changeset
   152
# LIBRARY. This code chunk attempts to generate a unique 
02bb8761fcce Initial load
duke
parents:
diff changeset
   153
# OBJDIR/CLASSHDRDIR for each build unit based on which of those 
02bb8761fcce Initial load
duke
parents:
diff changeset
   154
# values are set within each build unit.
02bb8761fcce Initial load
duke
parents:
diff changeset
   155
02bb8761fcce Initial load
duke
parents:
diff changeset
   156
UNIQUE_LOCATION_STRING = tmp
02bb8761fcce Initial load
duke
parents:
diff changeset
   157
02bb8761fcce Initial load
duke
parents:
diff changeset
   158
ifneq ($(PRODUCT),)
02bb8761fcce Initial load
duke
parents:
diff changeset
   159
  UNIQUE_LOCATION_STRING += /$(PRODUCT)
02bb8761fcce Initial load
duke
parents:
diff changeset
   160
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   161
02bb8761fcce Initial load
duke
parents:
diff changeset
   162
ifneq ($(PACKAGE),)
02bb8761fcce Initial load
duke
parents:
diff changeset
   163
  UNIQUE_LOCATION_STRING += /$(PACKAGE)
02bb8761fcce Initial load
duke
parents:
diff changeset
   164
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   165
02bb8761fcce Initial load
duke
parents:
diff changeset
   166
ifneq ($(PROGRAM),)
02bb8761fcce Initial load
duke
parents:
diff changeset
   167
  UNIQUE_LOCATION_STRING += /$(PROGRAM)
02bb8761fcce Initial load
duke
parents:
diff changeset
   168
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   169
02bb8761fcce Initial load
duke
parents:
diff changeset
   170
ifneq ($(LIBRARY),)
02bb8761fcce Initial load
duke
parents:
diff changeset
   171
  ifneq ($(LIBRARY_OUTPUT),)
02bb8761fcce Initial load
duke
parents:
diff changeset
   172
    UNIQUE_LOCATION_STRING += /$(LIBRARY_OUTPUT)
02bb8761fcce Initial load
duke
parents:
diff changeset
   173
  else
02bb8761fcce Initial load
duke
parents:
diff changeset
   174
    UNIQUE_LOCATION_STRING += /$(LIBRARY)
02bb8761fcce Initial load
duke
parents:
diff changeset
   175
  endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   176
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   177
02bb8761fcce Initial load
duke
parents:
diff changeset
   178
ifneq ($(THREADDIR),)
02bb8761fcce Initial load
duke
parents:
diff changeset
   179
  UNIQUE_LOCATION_STRING += /$(THREADDIR)
02bb8761fcce Initial load
duke
parents:
diff changeset
   180
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   181
02bb8761fcce Initial load
duke
parents:
diff changeset
   182
# the use of += above makes a space separated list which we need to 
02bb8761fcce Initial load
duke
parents:
diff changeset
   183
# remove for filespecs.
02bb8761fcce Initial load
duke
parents:
diff changeset
   184
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   185
NULLSTRING :=
02bb8761fcce Initial load
duke
parents:
diff changeset
   186
ONESPACE := $(NULLSTRING) # space before this comment is required.
02bb8761fcce Initial load
duke
parents:
diff changeset
   187
UNIQUE_PATH = $(subst $(ONESPACE),,$(UNIQUE_LOCATION_STRING))
02bb8761fcce Initial load
duke
parents:
diff changeset
   188
02bb8761fcce Initial load
duke
parents:
diff changeset
   189
# TEMPDIR is a unique general purpose directory
02bb8761fcce Initial load
duke
parents:
diff changeset
   190
# need to use 'override' because GNU Make on Linux exports the wrong
02bb8761fcce Initial load
duke
parents:
diff changeset
   191
# value.
02bb8761fcce Initial load
duke
parents:
diff changeset
   192
override TEMPDIR      = $(OUTPUTDIR)/$(UNIQUE_PATH)
02bb8761fcce Initial load
duke
parents:
diff changeset
   193
override ABS_TEMPDIR  = $(ABS_OUTPUTDIR)/$(UNIQUE_PATH)
02bb8761fcce Initial load
duke
parents:
diff changeset
   194
02bb8761fcce Initial load
duke
parents:
diff changeset
   195
# This must be created right away for pattern rules in Sanity.gmk to work.
02bb8761fcce Initial load
duke
parents:
diff changeset
   196
dummy1:=$(shell $(MKDIR) -p $(TEMPDIR))
02bb8761fcce Initial load
duke
parents:
diff changeset
   197
dummy2:=$(shell $(MKDIR) -p $(TEMP_DISK))
02bb8761fcce Initial load
duke
parents:
diff changeset
   198
02bb8761fcce Initial load
duke
parents:
diff changeset
   199
# OBJDIRNAME is the name of the directory where the object code is to
02bb8761fcce Initial load
duke
parents:
diff changeset
   200
#   be placed. It's name depends on whether the data model architecture 
02bb8761fcce Initial load
duke
parents:
diff changeset
   201
#   is 32-bit or not.
02bb8761fcce Initial load
duke
parents:
diff changeset
   202
ifneq ($(ARCH_DATA_MODEL), 32)
02bb8761fcce Initial load
duke
parents:
diff changeset
   203
  OBJDIRNAME  = obj$(ARCH_DATA_MODEL)$(OBJDIRNAME_SUFFIX)
02bb8761fcce Initial load
duke
parents:
diff changeset
   204
else
02bb8761fcce Initial load
duke
parents:
diff changeset
   205
  OBJDIRNAME  = obj$(OBJDIRNAME_SUFFIX)
02bb8761fcce Initial load
duke
parents:
diff changeset
   206
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   207
OBJDIR      = $(TEMPDIR)/$(OBJDIRNAME)
02bb8761fcce Initial load
duke
parents:
diff changeset
   208
02bb8761fcce Initial load
duke
parents:
diff changeset
   209
# CLASSHDRDIR is where the generated C Class Header files go.
02bb8761fcce Initial load
duke
parents:
diff changeset
   210
CLASSHDRDIR = $(TEMPDIR)/CClassHeaders
02bb8761fcce Initial load
duke
parents:
diff changeset
   211
02bb8761fcce Initial load
duke
parents:
diff changeset
   212
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   213
# CLASSDESTDIR can be used to specify the directory where generated classes
02bb8761fcce Initial load
duke
parents:
diff changeset
   214
# are to be placed. The default is CLASSBINDIR.
02bb8761fcce Initial load
duke
parents:
diff changeset
   215
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   216
ifndef CLASSDESTDIR
02bb8761fcce Initial load
duke
parents:
diff changeset
   217
CLASSDESTDIR = $(CLASSBINDIR)
02bb8761fcce Initial load
duke
parents:
diff changeset
   218
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   219
02bb8761fcce Initial load
duke
parents:
diff changeset
   220
INCLUDES = -I. -I$(CLASSHDRDIR) \
02bb8761fcce Initial load
duke
parents:
diff changeset
   221
	$(patsubst %,-I%,$(subst $(CLASSPATH_SEPARATOR), ,$(VPATH.h))) $(OTHER_INCLUDES)
02bb8761fcce Initial load
duke
parents:
diff changeset
   222
OTHER_CPPFLAGS = $(INCLUDES)
02bb8761fcce Initial load
duke
parents:
diff changeset
   223
02bb8761fcce Initial load
duke
parents:
diff changeset
   224
02bb8761fcce Initial load
duke
parents:
diff changeset
   225
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   226
# vpaths.  These are the default locations searched for source files.
02bb8761fcce Initial load
duke
parents:
diff changeset
   227
# GNUmakefiles of individual areas often override the default settings.
02bb8761fcce Initial load
duke
parents:
diff changeset
   228
# There are no longer default vpath entries for C and assembler files
02bb8761fcce Initial load
duke
parents:
diff changeset
   229
# so we can ensure that libraries don't get their hands on JVM files.
02bb8761fcce Initial load
duke
parents:
diff changeset
   230
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   231
# We define an intermediate variable for Java files because
02bb8761fcce Initial load
duke
parents:
diff changeset
   232
# we use its value later to help define $SOURCEPATH
02bb8761fcce Initial load
duke
parents:
diff changeset
   233
02bb8761fcce Initial load
duke
parents:
diff changeset
   234
VPATH0.java = $(GENSRCDIR)$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/classes
02bb8761fcce Initial load
duke
parents:
diff changeset
   235
VPATH.java = $(VPATH0.java)
02bb8761fcce Initial load
duke
parents:
diff changeset
   236
vpath %.java $(VPATH.java)
02bb8761fcce Initial load
duke
parents:
diff changeset
   237
vpath %.class $(CLASSBINDIR)
02bb8761fcce Initial load
duke
parents:
diff changeset
   238
vpath %.$(OBJECT_SUFFIX) $(OBJDIR)
02bb8761fcce Initial load
duke
parents:
diff changeset
   239
02bb8761fcce Initial load
duke
parents:
diff changeset
   240
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   241
# VPATH.h is used elsewhere to generate include flags.  By default, 
02bb8761fcce Initial load
duke
parents:
diff changeset
   242
# anyone has access to the include files that the JVM area exports,
02bb8761fcce Initial load
duke
parents:
diff changeset
   243
# namely jni.h, jvm.h, and jni_utils.h, plus their platform-specific
02bb8761fcce Initial load
duke
parents:
diff changeset
   244
# relatives.
02bb8761fcce Initial load
duke
parents:
diff changeset
   245
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   246
ifeq ($(PLATFORM), windows)
02bb8761fcce Initial load
duke
parents:
diff changeset
   247
  VPATH.h = $(BOOTDIR)/include;$(BOOTDIR)/include/$(PLATFORM_INCLUDE_NAME)
02bb8761fcce Initial load
duke
parents:
diff changeset
   248
else
02bb8761fcce Initial load
duke
parents:
diff changeset
   249
  VPATH.h = $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/include$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/javavm/include
02bb8761fcce Initial load
duke
parents:
diff changeset
   250
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   251
vpath %.h   $(VPATH.h)
02bb8761fcce Initial load
duke
parents:
diff changeset
   252
02bb8761fcce Initial load
duke
parents:
diff changeset
   253
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   254
# Used in two ways: helps link against libjava.so. Also if overridden
02bb8761fcce Initial load
duke
parents:
diff changeset
   255
# determines where your shared library is installed.
02bb8761fcce Initial load
duke
parents:
diff changeset
   256
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   257
ifndef LIB_LOCATION
02bb8761fcce Initial load
duke
parents:
diff changeset
   258
  LIB_LOCATION    =  $(LIBDIR)/$(LIBARCH)
02bb8761fcce Initial load
duke
parents:
diff changeset
   259
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   260
02bb8761fcce Initial load
duke
parents:
diff changeset
   261
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   262
# Java header and stub variables
02bb8761fcce Initial load
duke
parents:
diff changeset
   263
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   264
CLASSHDRS     = $(patsubst %,$(CLASSHDRDIR)/%.h,$(subst .,_,$(CLASSES.export)))
02bb8761fcce Initial load
duke
parents:
diff changeset
   265
CLASSSTUBOBJS = classstubs.$(OBJECT_SUFFIX)
02bb8761fcce Initial load
duke
parents:
diff changeset
   266
STUBPREAMBLE  = $(INCLUDEDIR)/StubPreamble.h
02bb8761fcce Initial load
duke
parents:
diff changeset
   267
02bb8761fcce Initial load
duke
parents:
diff changeset
   268
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   269
# Classpath seen by javac (different from the one seen by the VM
02bb8761fcce Initial load
duke
parents:
diff changeset
   270
# running javac), and useful variables.
02bb8761fcce Initial load
duke
parents:
diff changeset
   271
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   272
SOURCEPATH	= $(VPATH.java)
02bb8761fcce Initial load
duke
parents:
diff changeset
   273
PKG		= $(shell $(EXPR) $(PACKAGE) : '\([a-z]*\)')
02bb8761fcce Initial load
duke
parents:
diff changeset
   274
PKGDIR		= $(subst .,/,$(PACKAGE))
02bb8761fcce Initial load
duke
parents:
diff changeset
   275
02bb8761fcce Initial load
duke
parents:
diff changeset
   276
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   277
# The java/javac/jdk variables (JAVAC_CMD, JAVA_CMD, etc.)
02bb8761fcce Initial load
duke
parents:
diff changeset
   278
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   279
include $(BUILDDIR)/common/shared/Defs-java.gmk
02bb8761fcce Initial load
duke
parents:
diff changeset
   280
02bb8761fcce Initial load
duke
parents:
diff changeset
   281
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   282
# Set opt level to ALT_OPT if set otherwise _OPT
02bb8761fcce Initial load
duke
parents:
diff changeset
   283
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   284
POPT = $(_OPT$(ALT_OPT))$(ALT_OPT)
02bb8761fcce Initial load
duke
parents:
diff changeset
   285
02bb8761fcce Initial load
duke
parents:
diff changeset
   286
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   287
# Convenient macros
02bb8761fcce Initial load
duke
parents:
diff changeset
   288
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   289
02bb8761fcce Initial load
duke
parents:
diff changeset
   290
# Prepare $@ target, remove old one and making sure directory exists
02bb8761fcce Initial load
duke
parents:
diff changeset
   291
define prep-target
02bb8761fcce Initial load
duke
parents:
diff changeset
   292
$(MKDIR) -p $(@D)
02bb8761fcce Initial load
duke
parents:
diff changeset
   293
$(RM) $@
02bb8761fcce Initial load
duke
parents:
diff changeset
   294
endef
02bb8761fcce Initial load
duke
parents:
diff changeset
   295
02bb8761fcce Initial load
duke
parents:
diff changeset
   296
# Simple install of $< file to $@
02bb8761fcce Initial load
duke
parents:
diff changeset
   297
define install-file
02bb8761fcce Initial load
duke
parents:
diff changeset
   298
$(prep-target)
02bb8761fcce Initial load
duke
parents:
diff changeset
   299
$(CP) $< $@
02bb8761fcce Initial load
duke
parents:
diff changeset
   300
endef
02bb8761fcce Initial load
duke
parents:
diff changeset
   301
02bb8761fcce Initial load
duke
parents:
diff changeset
   302
# Cleanup rule for after debug java run (hotspot.log file is left around)
02bb8761fcce Initial load
duke
parents:
diff changeset
   303
#   (This could be an old leftover file in a read-only area, use the @- prefix)
02bb8761fcce Initial load
duke
parents:
diff changeset
   304
HOTSPOT_LOG_NAME = hotspot.log
02bb8761fcce Initial load
duke
parents:
diff changeset
   305
define java-vm-cleanup
02bb8761fcce Initial load
duke
parents:
diff changeset
   306
if [ -w $(HOTSPOT_LOG_NAME) ] ; then $(RM) $(HOTSPOT_LOG_NAME); fi
02bb8761fcce Initial load
duke
parents:
diff changeset
   307
endef
02bb8761fcce Initial load
duke
parents:
diff changeset
   308
02bb8761fcce Initial load
duke
parents:
diff changeset
   309
# Default make settings for processing SUBDIRS with clobber or clean names
02bb8761fcce Initial load
duke
parents:
diff changeset
   310
SUBDIRS_MAKEFLAGS-clobber = INCREMENTAL_BUILD=false
02bb8761fcce Initial load
duke
parents:
diff changeset
   311
SUBDIRS_MAKEFLAGS-clean   = INCREMENTAL_BUILD=false
02bb8761fcce Initial load
duke
parents:
diff changeset
   312
02bb8761fcce Initial load
duke
parents:
diff changeset
   313
# Given a SUBDIRS list, cd into them and make them
02bb8761fcce Initial load
duke
parents:
diff changeset
   314
#   SUBDIRS_MAKEFLAGS      Make settings for a subdir make
02bb8761fcce Initial load
duke
parents:
diff changeset
   315
#   SUBDIRS_MAKEFLAGS-$@   Make settings specific to this target
02bb8761fcce Initial load
duke
parents:
diff changeset
   316
define SUBDIRS-loop
02bb8761fcce Initial load
duke
parents:
diff changeset
   317
@for i in DUMMY $(SUBDIRS) ; do \
02bb8761fcce Initial load
duke
parents:
diff changeset
   318
  if [ "$$i" != "DUMMY" ] ; then \
3871
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   319
    $(MAKE) -C $${i} $@ \
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   320
          $(SUBDIRS_MAKEFLAGS) \
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   321
          $(SUBDIRS_MAKEFLAGS-$@) \
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   322
          FULL_VERSION=$(FULL_VERSION) \
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   323
          RELEASE=$(RELEASE) || exit 1; \
4
02bb8761fcce Initial load
duke
parents:
diff changeset
   324
  fi ; \
02bb8761fcce Initial load
duke
parents:
diff changeset
   325
done
02bb8761fcce Initial load
duke
parents:
diff changeset
   326
endef
02bb8761fcce Initial load
duke
parents:
diff changeset
   327
02bb8761fcce Initial load
duke
parents:
diff changeset
   328
# Given a OTHERSUBDIRS list, cd into them and make them (extra loop define)
02bb8761fcce Initial load
duke
parents:
diff changeset
   329
#   OTHERSUBDIRS_MAKEFLAGS      Make settings for a subdir make
02bb8761fcce Initial load
duke
parents:
diff changeset
   330
define OTHERSUBDIRS-loop
02bb8761fcce Initial load
duke
parents:
diff changeset
   331
@for i in DUMMY $(OTHERSUBDIRS) ; do \
02bb8761fcce Initial load
duke
parents:
diff changeset
   332
  if [ "$$i" != "DUMMY" ] ; then \
3871
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   333
    $(MAKE) -C $${i} $@ \
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   334
          $(OTHERSUBDIRS_MAKEFLAGS) \
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   335
          FULL_VERSION=$(FULL_VERSION) \
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   336
          RELEASE=$(RELEASE) || exit 1; \
4
02bb8761fcce Initial load
duke
parents:
diff changeset
   337
  fi ; \
02bb8761fcce Initial load
duke
parents:
diff changeset
   338
done
02bb8761fcce Initial load
duke
parents:
diff changeset
   339
endef
02bb8761fcce Initial load
duke
parents:
diff changeset
   340
02bb8761fcce Initial load
duke
parents:
diff changeset
   341
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   342
# Create BYFILE OPT and DBG settings, if CFLAGS_OPT/foobar.o is set then it is
02bb8761fcce Initial load
duke
parents:
diff changeset
   343
#    used for this file, otherwise the default settings are used.
02bb8761fcce Initial load
duke
parents:
diff changeset
   344
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   345
CFLAGS_$(VARIANT)/BYFILE    = $(CFLAGS_$(VARIANT)/$(@F)) \
02bb8761fcce Initial load
duke
parents:
diff changeset
   346
                              $(CFLAGS_$(VARIANT)$(CFLAGS_$(VARIANT)/$(@F)))
02bb8761fcce Initial load
duke
parents:
diff changeset
   347
CXXFLAGS_$(VARIANT)/BYFILE  = $(CXXFLAGS_$(VARIANT)/$(@F)) \
02bb8761fcce Initial load
duke
parents:
diff changeset
   348
                              $(CXXFLAGS_$(VARIANT)$(CXXFLAGS_$(VARIANT)/$(@F)))
02bb8761fcce Initial load
duke
parents:
diff changeset
   349
02bb8761fcce Initial load
duke
parents:
diff changeset
   350
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   351
# Tool flags
02bb8761fcce Initial load
duke
parents:
diff changeset
   352
#
02bb8761fcce Initial load
duke
parents:
diff changeset
   353
ASFLAGS         = $(ASFLAGS_$(VARIANT)) $(ASFLAGS_COMMON) $(OTHER_ASFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   354
CFLAGS          = $(CFLAGS_$(VARIANT)/BYFILE)   $(CFLAGS_COMMON) $(OTHER_CFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   355
CXXFLAGS        = $(CXXFLAGS_$(VARIANT)/BYFILE) $(CXXFLAGS_COMMON) $(OTHER_CXXFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   356
CPPFLAGS        = $(CPPFLAGS_$(VARIANT)) $(CPPFLAGS_COMMON) $(OTHER_CPPFLAGS) \
02bb8761fcce Initial load
duke
parents:
diff changeset
   357
		  $(DEFINES) $(OPTIONS:%=-D%)
02bb8761fcce Initial load
duke
parents:
diff changeset
   358
LDFLAGS         = $(LDFLAGS_$(VARIANT)) $(LDFLAGS_COMMON) $(OTHER_LDFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   359
LDLIBS          = $(OTHER_LDLIBS) $(LDLIBS_$(VARIANT)) $(LDLIBS_COMMON)
02bb8761fcce Initial load
duke
parents:
diff changeset
   360
LINTFLAGS       = $(LINTFLAGS_$(VARIANT)) $(LINTFLAGS_COMMON) \
02bb8761fcce Initial load
duke
parents:
diff changeset
   361
		  $(OTHER_LINTFLAGS)
02bb8761fcce Initial load
duke
parents:
diff changeset
   362
02bb8761fcce Initial load
duke
parents:
diff changeset
   363
# this should be moved into Defs-<platform>.gmk.....
02bb8761fcce Initial load
duke
parents:
diff changeset
   364
ifeq ($(PLATFORM), windows)
02bb8761fcce Initial load
duke
parents:
diff changeset
   365
  VERSION_DEFINES = -DRELEASE="\"$(RELEASE)\""
02bb8761fcce Initial load
duke
parents:
diff changeset
   366
else
02bb8761fcce Initial load
duke
parents:
diff changeset
   367
  VERSION_DEFINES = -DRELEASE='"$(RELEASE)"'
02bb8761fcce Initial load
duke
parents:
diff changeset
   368
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   369
3871
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   370
# Prevent the use of many default suffix rules we do not need
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   371
.SUFFIXES:
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   372
.SUFFIXES: .c .o .h .obj .cpp .hpp .java .class
4
02bb8761fcce Initial load
duke
parents:
diff changeset
   373
3871
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   374
# Make sure we are all insane
4
02bb8761fcce Initial load
duke
parents:
diff changeset
   375
ifdef INSANE
02bb8761fcce Initial load
duke
parents:
diff changeset
   376
  export INSANE
02bb8761fcce Initial load
duke
parents:
diff changeset
   377
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   378
3871
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   379
# Make sure we have the current year
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   380
ifndef COPYRIGHT_YEAR
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   381
  ifdef ALT_COPYRIGHT_YEAR
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   382
    COPYRIGHT_YEAR := $(ALT_COPYRIGHT_YEAR)
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   383
  else
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   384
    COPYRIGHT_YEAR := $(shell $(DATE) '+%Y')
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   385
  endif
3d528461f61d 6875240: Reduce Makefile build time by limiting repeated exec's (mostly for cygwin building)
ohair
parents: 4
diff changeset
   386
  export COPYRIGHT_YEAR
4
02bb8761fcce Initial load
duke
parents:
diff changeset
   387
endif
02bb8761fcce Initial load
duke
parents:
diff changeset
   388
02bb8761fcce Initial load
duke
parents:
diff changeset
   389
# Install of imported file (JDK_IMPORT_PATH, or some other external location)
02bb8761fcce Initial load
duke
parents:
diff changeset
   390
define install-import-file
02bb8761fcce Initial load
duke
parents:
diff changeset
   391
@$(ECHO) "ASSEMBLY_IMPORT: $@"
02bb8761fcce Initial load
duke
parents:
diff changeset
   392
$(install-file)
02bb8761fcce Initial load
duke
parents:
diff changeset
   393
endef
02bb8761fcce Initial load
duke
parents:
diff changeset
   394
02bb8761fcce Initial load
duke
parents:
diff changeset
   395
.PHONY: all build clean clobber