make/common/Defs.gmk

Sun, 21 Jun 2009 23:50:28 -0700

author
tbell
date
Sun, 21 Jun 2009 23:50:28 -0700
changeset 85
65b66117dbd7
parent 1
55540e827aef
child 114
1c130e7b7a2e
permissions
-rw-r--r--

Merge

duke@1 1 #
duke@1 2 # Copyright 1995-2007 Sun Microsystems, Inc. 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
duke@1 7 # published by the Free Software Foundation. Sun designates this
duke@1 8 # particular file as subject to the "Classpath" exception as provided
duke@1 9 # by Sun 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 #
duke@1 21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 # have any 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 #
duke@1 77 # All libraries except libjava and libjvm itself link against libjvm and
duke@1 78 # libjava, the latter for its exported common utilities. libjava only links
duke@1 79 # against libjvm. Programs' makefiles take their own responsibility for
duke@1 80 # adding other libs.
duke@1 81 #
duke@1 82 ifdef PACKAGE
duke@1 83 # put JAVALIB first, but do not lose any platform specific values....
duke@1 84 LDLIBS_COMMON = $(JAVALIB)
duke@1 85 endif # PACKAGE
duke@1 86
duke@1 87 #
duke@1 88 # Libraries that must appear ahead of libc.so on the link command line
duke@1 89 #
duke@1 90 ifdef PROGRAM
duke@1 91
duke@1 92 ifeq ($(PLATFORM), solaris)
duke@1 93 LDLIBS_COMMON = -lthread -ldl
duke@1 94 endif
duke@1 95
duke@1 96 ifeq ($(PLATFORM), linux)
duke@1 97 LDLIBS_COMMON = -ldl
duke@1 98 endif
duke@1 99
duke@1 100 endif # PROGRAM
duke@1 101
duke@1 102 LDLIBS_COMMON += $(EXTRA_LIBS)
duke@1 103
duke@1 104 #
duke@1 105 # Default is to build, not import native binaries
duke@1 106 #
duke@1 107 ifndef IMPORT_NATIVE_BINARIES
duke@1 108 IMPORT_NATIVE_BINARIES=false
duke@1 109 endif
duke@1 110 # If importing libraries in, no incremental builds
duke@1 111 ifeq ($(IMPORT_NATIVE_BINARIES),true)
duke@1 112 INCREMENTAL_BUILD=false
duke@1 113 endif
duke@1 114
duke@1 115 # for generated libraries
duke@1 116 LIBDIR = $(OUTPUTDIR)/lib
duke@1 117 ABS_LIBDIR = $(ABS_OUTPUTDIR)/lib
duke@1 118 # Optional place to save the windows .lib files
duke@1 119 LIBFILES_DIR = $(OUTPUTDIR)/libfiles
duke@1 120 # for ext jre files
duke@1 121 EXTDIR = $(LIBDIR)/ext
duke@1 122 # for generated include files
duke@1 123 INCLUDEDIR = $(OUTPUTDIR)/include
duke@1 124 # for generated class files
duke@1 125 CLASSBINDIR = $(OUTPUTDIR)/classes
duke@1 126 DEMOCLASSDIR = $(OUTPUTDIR)/democlasses
duke@1 127 # for generated tool class files
duke@1 128 BUILDTOOLCLASSDIR = $(OUTPUTDIR)/btclasses
duke@1 129 # for build tool jar files
duke@1 130 BUILDTOOLJARDIR = $(OUTPUTDIR)/btjars
duke@1 131 ABS_BUILDTOOLJARDIR = $(ABS_OUTPUTDIR)/btjars
duke@1 132 # for generated java source files
duke@1 133 GENSRCDIR = $(OUTPUTDIR)/gensrc
duke@1 134 # for generated C source files (not javah)
duke@1 135 GENNATIVESRCDIR = $(OUTPUTDIR)/gennativesrc
duke@1 136 # for imported source files
duke@1 137 IMPORTSRCDIR = $(OUTPUTDIR)/impsrc
duke@1 138 # for imported documents
duke@1 139 IMPORTDOCDIR = $(OUTPUTDIR)/impdoc
duke@1 140 # for generated demo
duke@1 141 DEMODIR = $(OUTPUTDIR)/demo
duke@1 142 # for sample code
duke@1 143 SAMPLEDIR = $(OUTPUTDIR)/sample
duke@1 144 # for generated documentation
duke@1 145 DOCSDIR = $(OUTPUTDIR)/docs$(DOCSDIRSUFFIX)
duke@1 146 DOCSDIRSUFFIX =
duke@1 147
duke@1 148 # An attempt is made to generate unique enough directories for the
duke@1 149 # generated files to not have name collisisons. Most build units
duke@1 150 # defines PRODUCT (except Release.gmk), but then they may or may
duke@1 151 # not define PACKAGE, THREADIR (only HPI uses this), PROGRAM, and
duke@1 152 # LIBRARY. This code chunk attempts to generate a unique
duke@1 153 # OBJDIR/CLASSHDRDIR for each build unit based on which of those
duke@1 154 # values are set within each build unit.
duke@1 155
duke@1 156 UNIQUE_LOCATION_STRING = tmp
duke@1 157
duke@1 158 ifneq ($(PRODUCT),)
duke@1 159 UNIQUE_LOCATION_STRING += /$(PRODUCT)
duke@1 160 endif
duke@1 161
duke@1 162 ifneq ($(PACKAGE),)
duke@1 163 UNIQUE_LOCATION_STRING += /$(PACKAGE)
duke@1 164 endif
duke@1 165
duke@1 166 ifneq ($(PROGRAM),)
duke@1 167 UNIQUE_LOCATION_STRING += /$(PROGRAM)
duke@1 168 endif
duke@1 169
duke@1 170 ifneq ($(LIBRARY),)
duke@1 171 ifneq ($(LIBRARY_OUTPUT),)
duke@1 172 UNIQUE_LOCATION_STRING += /$(LIBRARY_OUTPUT)
duke@1 173 else
duke@1 174 UNIQUE_LOCATION_STRING += /$(LIBRARY)
duke@1 175 endif
duke@1 176 endif
duke@1 177
duke@1 178 ifneq ($(THREADDIR),)
duke@1 179 UNIQUE_LOCATION_STRING += /$(THREADDIR)
duke@1 180 endif
duke@1 181
duke@1 182 # the use of += above makes a space separated list which we need to
duke@1 183 # remove for filespecs.
duke@1 184 #
duke@1 185 NULLSTRING :=
duke@1 186 ONESPACE := $(NULLSTRING) # space before this comment is required.
duke@1 187 UNIQUE_PATH = $(subst $(ONESPACE),,$(UNIQUE_LOCATION_STRING))
duke@1 188
duke@1 189 # TEMPDIR is a unique general purpose directory
duke@1 190 # need to use 'override' because GNU Make on Linux exports the wrong
duke@1 191 # value.
duke@1 192 override TEMPDIR = $(OUTPUTDIR)/$(UNIQUE_PATH)
duke@1 193 override ABS_TEMPDIR = $(ABS_OUTPUTDIR)/$(UNIQUE_PATH)
duke@1 194
duke@1 195 # This must be created right away for pattern rules in Sanity.gmk to work.
duke@1 196 dummy1:=$(shell $(MKDIR) -p $(TEMPDIR))
duke@1 197 dummy2:=$(shell $(MKDIR) -p $(TEMP_DISK))
duke@1 198
duke@1 199 # OBJDIRNAME is the name of the directory where the object code is to
duke@1 200 # be placed. It's name depends on whether the data model architecture
duke@1 201 # is 32-bit or not.
duke@1 202 ifneq ($(ARCH_DATA_MODEL), 32)
duke@1 203 OBJDIRNAME = obj$(ARCH_DATA_MODEL)$(OBJDIRNAME_SUFFIX)
duke@1 204 else
duke@1 205 OBJDIRNAME = obj$(OBJDIRNAME_SUFFIX)
duke@1 206 endif
duke@1 207 OBJDIR = $(TEMPDIR)/$(OBJDIRNAME)
duke@1 208
duke@1 209 # CLASSHDRDIR is where the generated C Class Header files go.
duke@1 210 CLASSHDRDIR = $(TEMPDIR)/CClassHeaders
duke@1 211
duke@1 212 #
duke@1 213 # CLASSDESTDIR can be used to specify the directory where generated classes
duke@1 214 # are to be placed. The default is CLASSBINDIR.
duke@1 215 #
duke@1 216 ifndef CLASSDESTDIR
duke@1 217 CLASSDESTDIR = $(CLASSBINDIR)
duke@1 218 endif
duke@1 219
duke@1 220 INCLUDES = -I. -I$(CLASSHDRDIR) \
duke@1 221 $(patsubst %,-I%,$(subst $(CLASSPATH_SEPARATOR), ,$(VPATH.h))) $(OTHER_INCLUDES)
duke@1 222 OTHER_CPPFLAGS = $(INCLUDES)
duke@1 223
duke@1 224
duke@1 225 #
duke@1 226 # vpaths. These are the default locations searched for source files.
duke@1 227 # GNUmakefiles of individual areas often override the default settings.
duke@1 228 # There are no longer default vpath entries for C and assembler files
duke@1 229 # so we can ensure that libraries don't get their hands on JVM files.
duke@1 230 #
duke@1 231 # We define an intermediate variable for Java files because
duke@1 232 # we use its value later to help define $SOURCEPATH
duke@1 233
duke@1 234 VPATH0.java = $(GENSRCDIR)$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/classes
duke@1 235 VPATH.java = $(VPATH0.java)
duke@1 236 vpath %.java $(VPATH.java)
duke@1 237 vpath %.class $(CLASSBINDIR)
duke@1 238 vpath %.$(OBJECT_SUFFIX) $(OBJDIR)
duke@1 239
duke@1 240 #
duke@1 241 # VPATH.h is used elsewhere to generate include flags. By default,
duke@1 242 # anyone has access to the include files that the JVM area exports,
duke@1 243 # namely jni.h, jvm.h, and jni_utils.h, plus their platform-specific
duke@1 244 # relatives.
duke@1 245 #
duke@1 246 ifeq ($(PLATFORM), windows)
duke@1 247 VPATH.h = $(BOOTDIR)/include;$(BOOTDIR)/include/$(PLATFORM_INCLUDE_NAME)
duke@1 248 else
duke@1 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
duke@1 250 endif
duke@1 251 vpath %.h $(VPATH.h)
duke@1 252
duke@1 253 #
duke@1 254 # Used in two ways: helps link against libjava.so. Also if overridden
duke@1 255 # determines where your shared library is installed.
duke@1 256 #
duke@1 257 ifndef LIB_LOCATION
duke@1 258 LIB_LOCATION = $(LIBDIR)/$(LIBARCH)
duke@1 259 endif
duke@1 260
duke@1 261 #
duke@1 262 # Java header and stub variables
duke@1 263 #
duke@1 264 CLASSHDRS = $(patsubst %,$(CLASSHDRDIR)/%.h,$(subst .,_,$(CLASSES.export)))
duke@1 265 CLASSSTUBOBJS = classstubs.$(OBJECT_SUFFIX)
duke@1 266 STUBPREAMBLE = $(INCLUDEDIR)/StubPreamble.h
duke@1 267
duke@1 268 #
duke@1 269 # Classpath seen by javac (different from the one seen by the VM
duke@1 270 # running javac), and useful variables.
duke@1 271 #
duke@1 272 SOURCEPATH = $(VPATH.java)
duke@1 273 PKG = $(shell $(EXPR) $(PACKAGE) : '\([a-z]*\)')
duke@1 274 PKGDIR = $(subst .,/,$(PACKAGE))
duke@1 275
duke@1 276 #
duke@1 277 # The java/javac/jdk variables (JAVAC_CMD, JAVA_CMD, etc.)
duke@1 278 #
duke@1 279 include $(BUILDDIR)/common/shared/Defs-java.gmk
duke@1 280
duke@1 281 #
duke@1 282 # Set opt level to ALT_OPT if set otherwise _OPT
duke@1 283 #
duke@1 284 POPT = $(_OPT$(ALT_OPT))$(ALT_OPT)
duke@1 285
duke@1 286 #
duke@1 287 # Convenient macros
duke@1 288 #
duke@1 289
duke@1 290 # Prepare $@ target, remove old one and making sure directory exists
duke@1 291 define prep-target
duke@1 292 $(MKDIR) -p $(@D)
duke@1 293 $(RM) $@
duke@1 294 endef
duke@1 295
duke@1 296 # Simple install of $< file to $@
duke@1 297 define install-file
duke@1 298 $(prep-target)
duke@1 299 $(CP) $< $@
duke@1 300 endef
duke@1 301
duke@1 302 # Cleanup rule for after debug java run (hotspot.log file is left around)
duke@1 303 # (This could be an old leftover file in a read-only area, use the @- prefix)
duke@1 304 HOTSPOT_LOG_NAME = hotspot.log
duke@1 305 define java-vm-cleanup
duke@1 306 if [ -w $(HOTSPOT_LOG_NAME) ] ; then $(RM) $(HOTSPOT_LOG_NAME); fi
duke@1 307 endef
duke@1 308
duke@1 309 # Default make settings for processing SUBDIRS with clobber or clean names
duke@1 310 SUBDIRS_MAKEFLAGS-clobber = INCREMENTAL_BUILD=false
duke@1 311 SUBDIRS_MAKEFLAGS-clean = INCREMENTAL_BUILD=false
duke@1 312
duke@1 313 # Current directory
duke@1 314 CURRENT_DIRECTORY := $(shell $(PWD))
duke@1 315
duke@1 316 # If no timing wanted, we need to define these as empty
duke@1 317 ifdef NO_TIMING
duke@1 318
duke@1 319 TIMING_ID:=NA
duke@1 320
duke@1 321 define TIMING_start
duke@1 322 t=0:0:0:0
duke@1 323 endef
duke@1 324
duke@1 325 define TIMING_end
duke@1 326 time_used=0
duke@1 327 endef
duke@1 328
duke@1 329 else # NO_TIMING
duke@1 330
duke@1 331 # Default timing id
duke@1 332 TIMING_ID:=$(shell $(BASENAME) $(CURRENT_DIRECTORY))
duke@1 333
duke@1 334 # Timing start (must be used in same shell, e.g. same command line)
duke@1 335 # Defines the shell variable $1 to have the start time.
duke@1 336 define TIMING_start
duke@1 337 $1=`$(DATE) +%j:%H:%M:%S`
duke@1 338 endef
duke@1 339
duke@1 340 # Timing end (must be used in same shell, e.g. same command line)
duke@1 341 # Expects shell variable $1 to have been defined as the start time.
duke@1 342 # Expects shell variable $2 to have timing id string
duke@1 343 # Sets total_seconds shell variable as the total seconds used.
duke@1 344 # Sets time_used shell variable to contain format "%dh%dm%ds"
duke@1 345 define TIMING_end
duke@1 346 begTime="$${$1}"; \
duke@1 347 timing_id="$${$2}"; \
duke@1 348 endTime=`$(DATE) +%j:%H:%M:%S`; \
duke@1 349 d1=`$(ECHO) $${begTime} | $(CUT) -d':' -f1 | $(SED) -e 's@^0*@@'`; \
duke@1 350 if [ "$${d1}" = "" ] ; then d1=0; fi; \
duke@1 351 h1=`$(ECHO) $${begTime} | $(CUT) -d':' -f2 | $(SED) -e 's@^0*@@'`; \
duke@1 352 if [ "$${h1}" = "" ] ; then h1=0; fi; \
duke@1 353 m1=`$(ECHO) $${begTime} | $(CUT) -d':' -f3 | $(SED) -e 's@^0*@@'`; \
duke@1 354 if [ "$${m1}" = "" ] ; then m1=0; fi; \
duke@1 355 s1=`$(ECHO) $${begTime} | $(CUT) -d':' -f4 | $(SED) -e 's@^0*@@'`; \
duke@1 356 if [ "$${s1}" = "" ] ; then s1=0; fi; \
duke@1 357 d2=`$(ECHO) $${endTime} | $(CUT) -d':' -f1 | $(SED) -e 's@^0*@@'`; \
duke@1 358 if [ "$${d2}" = "" ] ; then d2=0; fi; \
duke@1 359 h2=`$(ECHO) $${endTime} | $(CUT) -d':' -f2 | $(SED) -e 's@^0*@@'`; \
duke@1 360 if [ "$${h2}" = "" ] ; then h2=0; fi; \
duke@1 361 m2=`$(ECHO) $${endTime} | $(CUT) -d':' -f3 | $(SED) -e 's@^0*@@'`; \
duke@1 362 if [ "$${m2}" = "" ] ; then m2=0; fi; \
duke@1 363 s2=`$(ECHO) $${endTime} | $(CUT) -d':' -f4 | $(SED) -e 's@^0*@@'`; \
duke@1 364 if [ "$${s2}" = "" ] ; then s2=0; fi; \
duke@1 365 t1_secs=`$(EXPR) $${d1} '*' 60 '*' 60 '*' 24 '+' $${h1} '*' 60 '*' 60 \
duke@1 366 '+' $${m1} '*' 60 '+' $${s1}`; \
duke@1 367 t2_secs=`$(EXPR) $${d2} '*' 60 '*' 60 '*' 24 '+' $${h2} '*' 60 '*' 60 \
duke@1 368 '+' $${m2} '*' 60 '+' $${s2}`; \
duke@1 369 total_seconds=`$(EXPR) $${t2_secs} '-' $${t1_secs}`; \
duke@1 370 if [ "$${total_seconds}" -lt 0 ] ; then total_seconds=0; fi; \
duke@1 371 t_hour=`$(EXPR) $${total_seconds} '/' '(' 60 '*' 60 ')'`h; \
duke@1 372 t_min=`$(EXPR) '(' $${total_seconds} '%' '(' 60 '*' 60 ')' ')' '/' 60`m; \
duke@1 373 t_sec=`$(EXPR) $${total_seconds} '%' 60`s; \
duke@1 374 time_used=$${t_sec}; \
duke@1 375 if [ "$${t_hour}" != "0h" ] ; then \
duke@1 376 time_used=$${t_hour}$${t_min}$${t_sec}; \
duke@1 377 elif [ "$${t_min}" != "0m" ] ; then \
duke@1 378 time_used=$${t_min}$${t_sec}; \
duke@1 379 else \
duke@1 380 time_used=$${t_sec}; \
duke@1 381 fi; \
duke@1 382 $(PRINTF) " Timing: %05d seconds or %s for %s\n" \
duke@1 383 $${total_seconds} $${time_used} $${timing_id}
duke@1 384 endef
duke@1 385
duke@1 386 endif # NO_TIMING
duke@1 387
duke@1 388 # Given a SUBDIRS list, cd into them and make them
duke@1 389 # SUBDIRS_MAKEFLAGS Make settings for a subdir make
duke@1 390 # SUBDIRS_MAKEFLAGS-$@ Make settings specific to this target
duke@1 391 define SUBDIRS-loop
duke@1 392 @$(ECHO) "Begin Processing SUBDIRS: $(SUBDIRS)"
duke@1 393 @for i in DUMMY $(SUBDIRS) ; do \
duke@1 394 if [ "$$i" != "DUMMY" ] ; then \
duke@1 395 $(ECHO) ">>>Recursively making "$$i" "$@" @ `$(DATE)` ..."; \
duke@1 396 timing_id="$(TIMING_ID)-`$(BASENAME) $${i}`"; \
duke@1 397 $(call TIMING_start,startTime); \
duke@1 398 curDir=$(CURRENT_DIRECTORY); \
duke@1 399 $(CD) $$i; $(MAKE) $@ TIMING_ID=$${timing_id} \
duke@1 400 $(SUBDIRS_MAKEFLAGS) \
duke@1 401 $(SUBDIRS_MAKEFLAGS-$@) \
duke@1 402 FULL_VERSION=$(FULL_VERSION) \
duke@1 403 RELEASE=$(RELEASE) || exit 1; \
duke@1 404 $(CD) $${curDir}; \
duke@1 405 $(call TIMING_end,startTime,timing_id); \
duke@1 406 $(ECHO) "<<<Finished Recursively making "$$i" "$@" @ `$(DATE)`." ; \
duke@1 407 fi ; \
duke@1 408 done
duke@1 409 @$(ECHO) "Done Processing SUBDIRS: $(SUBDIRS)"
duke@1 410 endef
duke@1 411
duke@1 412 # Given a OTHERSUBDIRS list, cd into them and make them (extra loop define)
duke@1 413 # OTHERSUBDIRS_MAKEFLAGS Make settings for a subdir make
duke@1 414 define OTHERSUBDIRS-loop
duke@1 415 @$(ECHO) "Begin Processing OTHERSUBDIRS: $(OTHERSUBDIRS)"
duke@1 416 @for i in DUMMY $(OTHERSUBDIRS) ; do \
duke@1 417 if [ "$$i" != "DUMMY" ] ; then \
duke@1 418 $(ECHO) ">>>Recursively making "$$i" "$@" @ `$(DATE)` ..."; \
duke@1 419 timing_id="$(TIMING_ID)-`$(BASENAME) $${i}`"; \
duke@1 420 $(call TIMING_start,startTime); \
duke@1 421 curDir=$(CURRENT_DIRECTORY); \
duke@1 422 $(CD) $$i; $(MAKE) $@ TIMING_ID=$${timing_id} \
duke@1 423 $(OTHERSUBDIRS_MAKEFLAGS) \
duke@1 424 FULL_VERSION=$(FULL_VERSION) \
duke@1 425 RELEASE=$(RELEASE) || exit 1; \
duke@1 426 $(CD) $${curDir}; \
duke@1 427 $(call TIMING_end,startTime,timing_id); \
duke@1 428 $(ECHO) "<<<Finished Recursively making "$$i" "$@" @ `$(DATE)`." ; \
duke@1 429 fi ; \
duke@1 430 done
duke@1 431 @$(ECHO) "Done Processing OTHERSUBDIRS: $(OTHERSUBDIRS)"
duke@1 432 endef
duke@1 433
duke@1 434 #
duke@1 435 # Create BYFILE OPT and DBG settings, if CFLAGS_OPT/foobar.o is set then it is
duke@1 436 # used for this file, otherwise the default settings are used.
duke@1 437 #
duke@1 438 CFLAGS_$(VARIANT)/BYFILE = $(CFLAGS_$(VARIANT)/$(@F)) \
duke@1 439 $(CFLAGS_$(VARIANT)$(CFLAGS_$(VARIANT)/$(@F)))
duke@1 440 CXXFLAGS_$(VARIANT)/BYFILE = $(CXXFLAGS_$(VARIANT)/$(@F)) \
duke@1 441 $(CXXFLAGS_$(VARIANT)$(CXXFLAGS_$(VARIANT)/$(@F)))
duke@1 442
duke@1 443 #
duke@1 444 # Tool flags
duke@1 445 #
duke@1 446 ASFLAGS = $(ASFLAGS_$(VARIANT)) $(ASFLAGS_COMMON) $(OTHER_ASFLAGS)
duke@1 447 CFLAGS = $(CFLAGS_$(VARIANT)/BYFILE) $(CFLAGS_COMMON) $(OTHER_CFLAGS)
duke@1 448 CXXFLAGS = $(CXXFLAGS_$(VARIANT)/BYFILE) $(CXXFLAGS_COMMON) $(OTHER_CXXFLAGS)
duke@1 449 CPPFLAGS = $(CPPFLAGS_$(VARIANT)) $(CPPFLAGS_COMMON) $(OTHER_CPPFLAGS) \
duke@1 450 $(DEFINES) $(OPTIONS:%=-D%)
duke@1 451 LDFLAGS = $(LDFLAGS_$(VARIANT)) $(LDFLAGS_COMMON) $(OTHER_LDFLAGS)
duke@1 452 LDLIBS = $(OTHER_LDLIBS) $(LDLIBS_$(VARIANT)) $(LDLIBS_COMMON)
duke@1 453 LINTFLAGS = $(LINTFLAGS_$(VARIANT)) $(LINTFLAGS_COMMON) \
duke@1 454 $(OTHER_LINTFLAGS)
duke@1 455
duke@1 456 # this should be moved into Defs-<platform>.gmk.....
duke@1 457 ifeq ($(PLATFORM), windows)
duke@1 458 VERSION_DEFINES = -DRELEASE="\"$(RELEASE)\""
duke@1 459 else
duke@1 460 VERSION_DEFINES = -DRELEASE='"$(RELEASE)"'
duke@1 461 endif
duke@1 462
duke@1 463 # Note: As a rule, GNU Make rules should not appear in any of the
duke@1 464 # Defs*.gmk files. These were added for Kestrel-Solaris and do address
duke@1 465 # a TeamWare bug. They should be moved elsewhere for Merlin.
duke@1 466 #
duke@1 467 # Override gnumake built-in rules which do sccs get operations badly.
duke@1 468 # (They put the checked out code in the current directory, not in the
duke@1 469 # directory of the original file.)
duke@1 470 # Since this is a symptom of a teamware failure, complain and die on the spot.
duke@1 471
duke@1 472 # This message immediately goes to stdout and the build terminates.
duke@1 473 define SCCS-trouble
duke@1 474 $(error \
duke@1 475 "ERROR: File $@ referenced while building in $(CURRENT_DIRECTORY) \
duke@1 476 is out of date with respect to its SCCS file $<. \
duke@1 477 This can happen from an unresolved Teamware conflict, a file movement, or \
duke@1 478 a failure in which SCCS files are updated but the 'sccs get' was not done. \
duke@1 479 You should double check for other out of date files in your workspace. \
duke@1 480 Or run: cd $(TOPDIR) && $(MAKE) sccs_get")
duke@1 481 endef
duke@1 482
duke@1 483 %:: s.%
duke@1 484 @$(SCCS-trouble)
duke@1 485 %:: SCCS/s.%
duke@1 486 @$(SCCS-trouble)
duke@1 487 @$(ECHO) " is out of date with respect to its SCCS file." >> $(WARNING_FILE)
duke@1 488 @$(ECHO) " This file may be from an unresolved Teamware conflict." >> $(WARNING_FILE)
duke@1 489 @$(ECHO) " This is also a symptom of a Teamware bringover/putback failure" >> $(WARNING_FILE)
duke@1 490 @$(ECHO) " in which SCCS files are updated but not checked out." >> $(WARNING_FILE)
duke@1 491 @$(ECHO) " Check for other out of date files in your workspace." >> $(WARNING_FILE)
duke@1 492 @$(ECHO) "" >> $(WARNING_FILE)
duke@1 493 @#exit 666
duke@1 494
duke@1 495 ifdef INSANE
duke@1 496 export INSANE
duke@1 497 endif
duke@1 498
duke@1 499 ifdef ALT_COPYRIGHT_YEAR
duke@1 500 COPYRIGHT_YEAR = $(ALT_COPYRIGHT_YEAR)
duke@1 501 else
duke@1 502 COPYRIGHT_YEAR = $(shell $(DATE) '+%Y')
duke@1 503 endif
duke@1 504
duke@1 505 # Install of imported file (JDK_IMPORT_PATH, or some other external location)
duke@1 506 define install-import-file
duke@1 507 @$(ECHO) "ASSEMBLY_IMPORT: $@"
duke@1 508 $(install-file)
duke@1 509 endef
duke@1 510
duke@1 511 .PHONY: all build clean clobber

mercurial