make/common/Defs.gmk

Mon, 30 Aug 2010 14:39:42 -0700

author
ohair
date
Mon, 30 Aug 2010 14:39:42 -0700
changeset 194
0f60cf26c5b5
parent 158
91006f157c46
child 240
f90b3e014e83
permissions
-rw-r--r--

6981043: Clean out all native code makefile logic from corba repository
Reviewed-by: jjg

duke@1 1 #
ohair@158 2 # Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
duke@1 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 #
duke@1 5 # This code is free software; you can redistribute it and/or modify it
duke@1 6 # under the terms of the GNU General Public License version 2 only, as
ohair@158 7 # published by the Free Software Foundation. Oracle designates this
duke@1 8 # particular file as subject to the "Classpath" exception as provided
ohair@158 9 # by Oracle in the LICENSE file that accompanied this code.
duke@1 10 #
duke@1 11 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 # version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 # accompanied this code).
duke@1 16 #
duke@1 17 # You should have received a copy of the GNU General Public License version
duke@1 18 # 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 #
ohair@158 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@158 22 # or visit www.oracle.com if you need additional information or have any
ohair@158 23 # questions.
duke@1 24 #
duke@1 25
duke@1 26 #
duke@1 27 # Common variables used by all the Java makefiles. This file should
duke@1 28 # not contain rules.
duke@1 29 #
duke@1 30
duke@1 31 #
duke@1 32 # On Solaris, the 'make' utility from Sun will not work with these makefiles.
duke@1 33 # This little rule is only understood by Sun's make, and is harmless
duke@1 34 # when seen by the GNU make tool. If using Sun's make, this causes the
duke@1 35 # make command to fail.
duke@1 36 #
duke@1 37 SUN_MAKE_TEST:sh = echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
duke@1 38
duke@1 39 include $(BUILDDIR)/common/shared/Platform.gmk
duke@1 40
duke@1 41 TOPDIR=$(BUILDDIR)/..
duke@1 42
duke@1 43 include $(TOPDIR)/make/common/CancelImplicits.gmk
duke@1 44
duke@1 45 # Historically PLATFORM_SRC used to be src/$(PLATFORM), but we switched it to
duke@1 46 # src/solaris so if you want to build on Linux you didn't need a src/linux
duke@1 47 # directory. In an ideal world it would be called src/genunix but we are not
duke@1 48 # there yet.
duke@1 49 #
duke@1 50 ifndef SHARE_SRC
duke@1 51 SHARE_SRC = $(TOPDIR)/src/share
duke@1 52 endif
duke@1 53
duke@1 54 _OUTPUTDIR=$(TOPDIR)/build/$(PLATFORM)-$(ARCH)
duke@1 55
duke@1 56 #
duke@1 57 # Get platform definitions
duke@1 58 #
duke@1 59
duke@1 60 include $(TOPDIR)/make/common/Defs-$(PLATFORM).gmk
duke@1 61
duke@1 62 #
duke@1 63 # Localizations for the different parts of the product beyond English
duke@1 64 #
duke@1 65
duke@1 66 JRE_LOCALES = de es fr it ja ko sv zh_CN zh_TW zh_HK
duke@1 67 PLUGIN_LOCALES = de es fr it ja ko sv zh_CN zh_TW zh_HK
duke@1 68 JDK_LOCALES = ja zh_CN
duke@1 69
duke@1 70 #
duke@1 71 # A list of locales we support but don't have resource files.
duke@1 72 # This is defined to optimize the search of resource bundles.
duke@1 73 #
duke@1 74 JRE_NONEXIST_LOCALES = en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh
duke@1 75
duke@1 76 LIBDIR = $(OUTPUTDIR)/lib
duke@1 77 ABS_LIBDIR = $(ABS_OUTPUTDIR)/lib
duke@1 78 # for ext jre files
duke@1 79 EXTDIR = $(LIBDIR)/ext
duke@1 80 # for generated class files
duke@1 81 CLASSBINDIR = $(OUTPUTDIR)/classes
duke@1 82 DEMOCLASSDIR = $(OUTPUTDIR)/democlasses
duke@1 83 # for generated tool class files
duke@1 84 BUILDTOOLCLASSDIR = $(OUTPUTDIR)/btclasses
duke@1 85 # for build tool jar files
duke@1 86 BUILDTOOLJARDIR = $(OUTPUTDIR)/btjars
duke@1 87 ABS_BUILDTOOLJARDIR = $(ABS_OUTPUTDIR)/btjars
duke@1 88 # for generated java source files
duke@1 89 GENSRCDIR = $(OUTPUTDIR)/gensrc
duke@1 90 # for imported source files
duke@1 91 IMPORTSRCDIR = $(OUTPUTDIR)/impsrc
duke@1 92 # for imported documents
duke@1 93 IMPORTDOCDIR = $(OUTPUTDIR)/impdoc
duke@1 94 # for generated demo
duke@1 95 DEMODIR = $(OUTPUTDIR)/demo
duke@1 96 # for sample code
duke@1 97 SAMPLEDIR = $(OUTPUTDIR)/sample
duke@1 98 # for generated documentation
duke@1 99 DOCSDIR = $(OUTPUTDIR)/docs$(DOCSDIRSUFFIX)
duke@1 100 DOCSDIRSUFFIX =
duke@1 101
duke@1 102 # An attempt is made to generate unique enough directories for the
duke@1 103 # generated files to not have name collisisons. Most build units
duke@1 104 # defines PRODUCT (except Release.gmk), but then they may or may
duke@1 105 # not define PACKAGE, THREADIR (only HPI uses this), PROGRAM, and
duke@1 106 # LIBRARY. This code chunk attempts to generate a unique
duke@1 107 # OBJDIR/CLASSHDRDIR for each build unit based on which of those
duke@1 108 # values are set within each build unit.
duke@1 109
duke@1 110 UNIQUE_LOCATION_STRING = tmp
duke@1 111
duke@1 112 ifneq ($(PRODUCT),)
duke@1 113 UNIQUE_LOCATION_STRING += /$(PRODUCT)
duke@1 114 endif
duke@1 115
duke@1 116 ifneq ($(PACKAGE),)
duke@1 117 UNIQUE_LOCATION_STRING += /$(PACKAGE)
duke@1 118 endif
duke@1 119
duke@1 120 ifneq ($(PROGRAM),)
duke@1 121 UNIQUE_LOCATION_STRING += /$(PROGRAM)
duke@1 122 endif
duke@1 123
duke@1 124 ifneq ($(LIBRARY),)
duke@1 125 ifneq ($(LIBRARY_OUTPUT),)
duke@1 126 UNIQUE_LOCATION_STRING += /$(LIBRARY_OUTPUT)
duke@1 127 else
duke@1 128 UNIQUE_LOCATION_STRING += /$(LIBRARY)
duke@1 129 endif
duke@1 130 endif
duke@1 131
duke@1 132 ifneq ($(THREADDIR),)
duke@1 133 UNIQUE_LOCATION_STRING += /$(THREADDIR)
duke@1 134 endif
duke@1 135
duke@1 136 # the use of += above makes a space separated list which we need to
duke@1 137 # remove for filespecs.
duke@1 138 #
duke@1 139 NULLSTRING :=
duke@1 140 ONESPACE := $(NULLSTRING) # space before this comment is required.
duke@1 141 UNIQUE_PATH = $(subst $(ONESPACE),,$(UNIQUE_LOCATION_STRING))
duke@1 142
duke@1 143 # TEMPDIR is a unique general purpose directory
duke@1 144 # need to use 'override' because GNU Make on Linux exports the wrong
duke@1 145 # value.
duke@1 146 override TEMPDIR = $(OUTPUTDIR)/$(UNIQUE_PATH)
duke@1 147 override ABS_TEMPDIR = $(ABS_OUTPUTDIR)/$(UNIQUE_PATH)
duke@1 148
duke@1 149 # This must be created right away for pattern rules in Sanity.gmk to work.
duke@1 150 dummy1:=$(shell $(MKDIR) -p $(TEMPDIR))
duke@1 151 dummy2:=$(shell $(MKDIR) -p $(TEMP_DISK))
duke@1 152
duke@1 153 #
duke@1 154 # CLASSDESTDIR can be used to specify the directory where generated classes
duke@1 155 # are to be placed. The default is CLASSBINDIR.
duke@1 156 #
duke@1 157 ifndef CLASSDESTDIR
duke@1 158 CLASSDESTDIR = $(CLASSBINDIR)
duke@1 159 endif
duke@1 160
duke@1 161 #
duke@1 162 # vpaths. These are the default locations searched for source files.
duke@1 163 # GNUmakefiles of individual areas often override the default settings.
duke@1 164 # There are no longer default vpath entries for C and assembler files
duke@1 165 # so we can ensure that libraries don't get their hands on JVM files.
duke@1 166 #
duke@1 167 # We define an intermediate variable for Java files because
duke@1 168 # we use its value later to help define $SOURCEPATH
duke@1 169
duke@1 170 VPATH0.java = $(GENSRCDIR)$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/classes
duke@1 171 VPATH.java = $(VPATH0.java)
duke@1 172 vpath %.java $(VPATH.java)
duke@1 173 vpath %.class $(CLASSBINDIR)
duke@1 174
duke@1 175 #
duke@1 176 # Classpath seen by javac (different from the one seen by the VM
duke@1 177 # running javac), and useful variables.
duke@1 178 #
duke@1 179 SOURCEPATH = $(VPATH.java)
duke@1 180 PKG = $(shell $(EXPR) $(PACKAGE) : '\([a-z]*\)')
duke@1 181 PKGDIR = $(subst .,/,$(PACKAGE))
duke@1 182
duke@1 183 #
duke@1 184 # The java/javac/jdk variables (JAVAC_CMD, JAVA_CMD, etc.)
duke@1 185 #
duke@1 186 include $(BUILDDIR)/common/shared/Defs-java.gmk
duke@1 187
duke@1 188 #
duke@1 189 # Set opt level to ALT_OPT if set otherwise _OPT
duke@1 190 #
duke@1 191 POPT = $(_OPT$(ALT_OPT))$(ALT_OPT)
duke@1 192
duke@1 193 #
duke@1 194 # Convenient macros
duke@1 195 #
duke@1 196
duke@1 197 # Prepare $@ target, remove old one and making sure directory exists
duke@1 198 define prep-target
duke@1 199 $(MKDIR) -p $(@D)
duke@1 200 $(RM) $@
duke@1 201 endef
duke@1 202
duke@1 203 # Simple install of $< file to $@
duke@1 204 define install-file
duke@1 205 $(prep-target)
duke@1 206 $(CP) $< $@
duke@1 207 endef
duke@1 208
duke@1 209 # Cleanup rule for after debug java run (hotspot.log file is left around)
duke@1 210 # (This could be an old leftover file in a read-only area, use the @- prefix)
duke@1 211 HOTSPOT_LOG_NAME = hotspot.log
duke@1 212 define java-vm-cleanup
duke@1 213 if [ -w $(HOTSPOT_LOG_NAME) ] ; then $(RM) $(HOTSPOT_LOG_NAME); fi
duke@1 214 endef
duke@1 215
duke@1 216 # Default make settings for processing SUBDIRS with clobber or clean names
duke@1 217 SUBDIRS_MAKEFLAGS-clobber = INCREMENTAL_BUILD=false
duke@1 218 SUBDIRS_MAKEFLAGS-clean = INCREMENTAL_BUILD=false
duke@1 219
duke@1 220 # Given a SUBDIRS list, cd into them and make them
duke@1 221 # SUBDIRS_MAKEFLAGS Make settings for a subdir make
duke@1 222 # SUBDIRS_MAKEFLAGS-$@ Make settings specific to this target
duke@1 223 define SUBDIRS-loop
duke@1 224 @for i in DUMMY $(SUBDIRS) ; do \
duke@1 225 if [ "$$i" != "DUMMY" ] ; then \
ohair@114 226 $(MAKE) -C $${i} $@ \
ohair@114 227 $(SUBDIRS_MAKEFLAGS) \
ohair@114 228 $(SUBDIRS_MAKEFLAGS-$@) \
ohair@114 229 FULL_VERSION=$(FULL_VERSION) \
ohair@114 230 RELEASE=$(RELEASE) || exit 1; \
duke@1 231 fi ; \
duke@1 232 done
duke@1 233 endef
duke@1 234
duke@1 235 # Given a OTHERSUBDIRS list, cd into them and make them (extra loop define)
duke@1 236 # OTHERSUBDIRS_MAKEFLAGS Make settings for a subdir make
duke@1 237 define OTHERSUBDIRS-loop
duke@1 238 @for i in DUMMY $(OTHERSUBDIRS) ; do \
duke@1 239 if [ "$$i" != "DUMMY" ] ; then \
ohair@114 240 $(MAKE) -C $${i} $@ \
ohair@114 241 $(OTHERSUBDIRS_MAKEFLAGS) \
ohair@114 242 FULL_VERSION=$(FULL_VERSION) \
ohair@114 243 RELEASE=$(RELEASE) || exit 1; \
duke@1 244 fi ; \
duke@1 245 done
duke@1 246 endef
duke@1 247
ohair@114 248 # Prevent the use of many default suffix rules we do not need
ohair@114 249 .SUFFIXES:
ohair@194 250 .SUFFIXES: .java .class
duke@1 251
ohair@114 252 # Make sure we are all insane
duke@1 253 ifdef INSANE
duke@1 254 export INSANE
duke@1 255 endif
duke@1 256
ohair@114 257 # Make sure we have the current year
ohair@114 258 ifndef COPYRIGHT_YEAR
ohair@114 259 ifdef ALT_COPYRIGHT_YEAR
ohair@114 260 COPYRIGHT_YEAR := $(ALT_COPYRIGHT_YEAR)
ohair@114 261 else
ohair@114 262 COPYRIGHT_YEAR := $(shell $(DATE) '+%Y')
ohair@114 263 endif
ohair@114 264 export COPYRIGHT_YEAR
duke@1 265 endif
duke@1 266
duke@1 267 # Install of imported file (JDK_IMPORT_PATH, or some other external location)
duke@1 268 define install-import-file
duke@1 269 @$(ECHO) "ASSEMBLY_IMPORT: $@"
duke@1 270 $(install-file)
duke@1 271 endef
duke@1 272
duke@1 273 .PHONY: all build clean clobber

mercurial