1 | #
|
---|
2 | # Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
|
---|
3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
---|
4 | #
|
---|
5 | # This code is free software; you can redistribute it and/or modify it
|
---|
6 | # under the terms of the GNU General Public License version 2 only, as
|
---|
7 | # published by the Free Software Foundation. Oracle designates this
|
---|
8 | # particular file as subject to the "Classpath" exception as provided
|
---|
9 | # by Oracle in the LICENSE file that accompanied this code.
|
---|
10 | #
|
---|
11 | # This code is distributed in the hope that it will be useful, but WITHOUT
|
---|
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
---|
13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
---|
14 | # version 2 for more details (a copy is included in the LICENSE file that
|
---|
15 | # accompanied this code).
|
---|
16 | #
|
---|
17 | # You should have received a copy of the GNU General Public License version
|
---|
18 | # 2 along with this work; if not, write to the Free Software Foundation,
|
---|
19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
---|
20 | #
|
---|
21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
---|
22 | # or visit www.oracle.com if you need additional information or have any
|
---|
23 | # questions.
|
---|
24 | #
|
---|
25 |
|
---|
26 | #
|
---|
27 | # Common variables used by all the Java makefiles. This file should
|
---|
28 | # not contain rules.
|
---|
29 | #
|
---|
30 |
|
---|
31 | # WARNING: This file is shared with other workspaces.
|
---|
32 | # So when it includes other files, it must use JDK_TOPDIR.
|
---|
33 | #
|
---|
34 |
|
---|
35 | #
|
---|
36 | # On Solaris, the 'make' utility from Sun will not work with these makefiles.
|
---|
37 | # This little rule is only understood by Sun's make, and is harmless
|
---|
38 | # when seen by the GNU make tool. If using Sun's make, this causes the
|
---|
39 | # make command to fail.
|
---|
40 | #
|
---|
41 | SUN_MAKE_TEST:sh = echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
|
---|
42 |
|
---|
43 | ifndef JDK_TOPDIR
|
---|
44 | ifdef BUILDDIR
|
---|
45 | JDK_TOPDIR=$(BUILDDIR)/..
|
---|
46 | else
|
---|
47 | JDK_TOPDIR:=$(error "ERROR: Cannot define top of jdk repository")
|
---|
48 | endif
|
---|
49 | endif
|
---|
50 | ifndef BUILDDIR
|
---|
51 | # Hack, due to deploy repository using this file.
|
---|
52 | BUILDDIR=$(JDK_TOPDIR)/make
|
---|
53 | endif
|
---|
54 | ifndef JDK_MAKE_SHARED_DIR
|
---|
55 | JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared
|
---|
56 | endif
|
---|
57 |
|
---|
58 | include $(JDK_MAKE_SHARED_DIR)/Platform.gmk
|
---|
59 |
|
---|
60 | TOPDIR=$(BUILDDIR)/..
|
---|
61 |
|
---|
62 | include $(JDK_TOPDIR)/make/common/CancelImplicits.gmk
|
---|
63 |
|
---|
64 | # Historically PLATFORM_SRC used to be src/$(PLATFORM), but we switched it to
|
---|
65 | # src/solaris so if you want to build on Linux you didn't need a src/linux
|
---|
66 | # directory. In an ideal world it would be called src/genunix but we are not
|
---|
67 | # there yet.
|
---|
68 | #
|
---|
69 | ifndef SHARE_SRC
|
---|
70 | SHARE_SRC = $(BUILDDIR)/../src/share
|
---|
71 | endif
|
---|
72 |
|
---|
73 | # Files that cannot be included in the OpenJDK distribution are
|
---|
74 | # collected under a parent directory which contains just those files.
|
---|
75 | ifndef CLOSED_SRC
|
---|
76 | CLOSED_SRC = $(BUILDDIR)/../src/closed
|
---|
77 | endif
|
---|
78 |
|
---|
79 | # If we have no closed directory, force it to an openjdk build
|
---|
80 | CLOSED_SRC_DIR_EXISTS := $(shell \
|
---|
81 | if [ -d $(CLOSED_SRC) ] ; then \
|
---|
82 | echo true; \
|
---|
83 | else \
|
---|
84 | echo false; \
|
---|
85 | fi)
|
---|
86 | ifeq ($(CLOSED_SRC_DIR_EXISTS), false)
|
---|
87 | OPENJDK = true
|
---|
88 | endif
|
---|
89 |
|
---|
90 | # Check for strange explicit settings (change to empty or true)
|
---|
91 | ifdef OPENJDK
|
---|
92 | ifeq ($(OPENJDK),false)
|
---|
93 | # Silently treat as not defined
|
---|
94 | OPENJDK =
|
---|
95 | else
|
---|
96 | ifneq ($(OPENJDK),true)
|
---|
97 | dummy := $(warning "WARNING: OPENKJDK=$(OPENJDK) being treated as true")
|
---|
98 | OPENJDK = true
|
---|
99 | endif
|
---|
100 | endif
|
---|
101 | endif
|
---|
102 |
|
---|
103 | # Define where closed directories are
|
---|
104 | ifdef OPENJDK
|
---|
105 | CLOSED_SRC =
|
---|
106 | CLOSED_SHARE_SRC =
|
---|
107 | else
|
---|
108 | ifndef CLOSED_SHARE_SRC
|
---|
109 | CLOSED_SHARE_SRC = $(CLOSED_SRC)/share
|
---|
110 | endif
|
---|
111 | endif
|
---|
112 |
|
---|
113 | # Default output directory
|
---|
114 | ifdef OPENJDK
|
---|
115 | _OUTPUTDIR=$(JDK_TOPDIR)/build/$(PLATFORM)-$(ARCH)$(OPENJDK_SUFFIX)
|
---|
116 | else
|
---|
117 | _OUTPUTDIR=$(JDK_TOPDIR)/build/$(PLATFORM)-$(ARCH)
|
---|
118 | endif
|
---|
119 |
|
---|
120 | #
|
---|
121 | # Get platform definitions
|
---|
122 | #
|
---|
123 |
|
---|
124 | include $(JDK_TOPDIR)/make/common/Defs-$(PLATFORM).gmk
|
---|
125 |
|
---|
126 | #
|
---|
127 | # Freetype logic is applicable to OpenJDK only
|
---|
128 | #
|
---|
129 | ifdef OPENJDK
|
---|
130 |
|
---|
131 | #if we use system lib we do not need to copy it to build tree
|
---|
132 | USING_SYSTEM_FT_LIB=false
|
---|
133 |
|
---|
134 | ifeq ($(PLATFORM), windows)
|
---|
135 | DEVTOOLS_FT_DIR=$(JDK_DEVTOOLS_DIR)/win32/freetype-$(ARCH)
|
---|
136 | endif
|
---|
137 | ifeq ($(PLATFORM), linux)
|
---|
138 | DEVTOOLS_FT_DIR=$(JDK_DEVTOOLS_DIR)/$(PLATFORM)/freetype-$(ARCH)
|
---|
139 | endif
|
---|
140 | ifeq ($(PLATFORM), solaris)
|
---|
141 | # historically for Solaris we have slightly different devtools
|
---|
142 | # naming conventions
|
---|
143 | DEVTOOLS_FT_DIR=$(JDK_DEVTOOLS_DIR)/$(ARCH_FAMILY)/freetype-$(ARCH)
|
---|
144 | endif
|
---|
145 |
|
---|
146 | DEVTOOLS_FT_DIR_EXISTS = $(shell \
|
---|
147 | if [ -f $(DEVTOOLS_FT_DIR)/include/ft2build.h ] ; then \
|
---|
148 | echo true; \
|
---|
149 | else \
|
---|
150 | echo false; \
|
---|
151 | fi)
|
---|
152 |
|
---|
153 | ifdef ALT_FREETYPE_LIB_PATH
|
---|
154 | FREETYPE_LIB_PATH = $(ALT_FREETYPE_LIB_PATH)
|
---|
155 | else
|
---|
156 | ifeq ($(DEVTOOLS_FT_DIR_EXISTS), true)
|
---|
157 | FREETYPE_LIB_PATH = $(DEVTOOLS_FT_DIR)/lib
|
---|
158 | else
|
---|
159 | FREETYPE_LIB_PATH = /usr/lib
|
---|
160 | USING_SYSTEM_FT_LIB=true
|
---|
161 | endif
|
---|
162 | endif
|
---|
163 |
|
---|
164 | ifeq ($(filter-out windows os2,$(PLATFORM)),)
|
---|
165 | FREETYPE_LIB = $(FREETYPE_LIB_PATH)/freetype.lib
|
---|
166 | else
|
---|
167 | FREETYPE_LIB = -L$(FREETYPE_LIB_PATH) -lfreetype
|
---|
168 | endif
|
---|
169 |
|
---|
170 | ifdef ALT_FREETYPE_HEADERS_PATH
|
---|
171 | FREETYPE_HEADERS_PATH = $(ALT_FREETYPE_HEADERS_PATH)
|
---|
172 | else
|
---|
173 | ifeq ($(DEVTOOLS_FT_DIR_EXISTS), true)
|
---|
174 | FREETYPE_HEADERS_PATH = $(DEVTOOLS_FT_DIR)/include
|
---|
175 | else
|
---|
176 | FREETYPE_HEADERS_PATH = /usr/include
|
---|
177 | endif
|
---|
178 | endif
|
---|
179 | endif
|
---|
180 |
|
---|
181 | #
|
---|
182 | # Localizations for the different parts of the product beyond English
|
---|
183 | #
|
---|
184 |
|
---|
185 | JRE_LOCALES = de es fr it ja ko sv zh_CN zh_TW zh_HK
|
---|
186 | PLUGIN_LOCALES = de es fr it ja ko sv zh_CN zh_TW zh_HK
|
---|
187 | JDK_LOCALES = ja zh_CN
|
---|
188 |
|
---|
189 | #
|
---|
190 | # A list of locales we support but don't have resource files.
|
---|
191 | # This is defined to optimize the search of resource bundles.
|
---|
192 | #
|
---|
193 | JRE_NONEXIST_LOCALES = en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh
|
---|
194 |
|
---|
195 | #
|
---|
196 | # All libraries except libjava and libjvm itself link against libjvm and
|
---|
197 | # libjava, the latter for its exported common utilities. libjava only links
|
---|
198 | # against libjvm. Programs' makefiles take their own responsibility for
|
---|
199 | # adding other libs.
|
---|
200 | #
|
---|
201 | ifdef PACKAGE
|
---|
202 | # put JAVALIB first, but do not lose any platform specific values....
|
---|
203 | LDLIBS_COMMON = $(JAVALIB)
|
---|
204 | endif # PACKAGE
|
---|
205 |
|
---|
206 | #
|
---|
207 | # Libraries that must appear ahead of libc.so on the link command line
|
---|
208 | #
|
---|
209 | ifdef PROGRAM
|
---|
210 |
|
---|
211 | ifeq ($(PLATFORM), solaris)
|
---|
212 | LDLIBS_COMMON = -lthread -ldl
|
---|
213 | endif
|
---|
214 |
|
---|
215 | ifeq ($(PLATFORM), linux)
|
---|
216 | LDLIBS_COMMON = -ldl
|
---|
217 | endif
|
---|
218 |
|
---|
219 | endif # PROGRAM
|
---|
220 |
|
---|
221 | LDLIBS_COMMON += $(EXTRA_LIBS)
|
---|
222 |
|
---|
223 | # for generated libraries
|
---|
224 | LIBDIR = $(OUTPUTDIR)/lib
|
---|
225 | ABS_LIBDIR = $(ABS_OUTPUTDIR)/lib
|
---|
226 | # Optional place to save the windows .lib files
|
---|
227 | LIBFILES_DIR = $(OUTPUTDIR)/libfiles
|
---|
228 | # for ext jre files
|
---|
229 | EXTDIR = $(LIBDIR)/ext
|
---|
230 | # for generated include files
|
---|
231 | INCLUDEDIR = $(OUTPUTDIR)/include
|
---|
232 | # for generated class files
|
---|
233 | CLASSBINDIR = $(OUTPUTDIR)/classes
|
---|
234 | DEMOCLASSDIR = $(OUTPUTDIR)/democlasses
|
---|
235 | # for generated tool class files
|
---|
236 | BUILDTOOLCLASSDIR = $(OUTPUTDIR)/btclasses
|
---|
237 | # for build tool jar files
|
---|
238 | BUILDTOOLJARDIR = $(OUTPUTDIR)/btjars
|
---|
239 | ABS_BUILDTOOLJARDIR = $(ABS_OUTPUTDIR)/btjars
|
---|
240 | # for generated java source files
|
---|
241 | GENSRCDIR = $(OUTPUTDIR)/gensrc
|
---|
242 | # for generated C source files (not javah)
|
---|
243 | GENNATIVESRCDIR = $(OUTPUTDIR)/gennativesrc
|
---|
244 | # for imported source files
|
---|
245 | IMPORTSRCDIR = $(OUTPUTDIR)/impsrc
|
---|
246 | # for imported documents
|
---|
247 | IMPORTDOCDIR = $(OUTPUTDIR)/impdoc
|
---|
248 | # for generated demo
|
---|
249 | DEMODIR = $(OUTPUTDIR)/demo
|
---|
250 | # for sample code
|
---|
251 | SAMPLEDIR = $(OUTPUTDIR)/sample
|
---|
252 | # for generated documentation
|
---|
253 | DOCSDIR = $(OUTPUTDIR)/docs$(DOCSDIRSUFFIX)
|
---|
254 | DOCSDIRSUFFIX =
|
---|
255 |
|
---|
256 | # The MESSAGE, WARNING and ERROR files are used to store sanityck and
|
---|
257 | # SCCS check messages, warnings and errors.
|
---|
258 | ifndef ERROR_FILE
|
---|
259 | ERROR_FILE = $(OUTPUTDIR)/sanityCheckErrors.txt
|
---|
260 | endif
|
---|
261 | ifndef WARNING_FILE
|
---|
262 | WARNING_FILE = $(OUTPUTDIR)/sanityCheckWarnings.txt
|
---|
263 | endif
|
---|
264 | ifndef MESSAGE_FILE
|
---|
265 | MESSAGE_FILE = $(OUTPUTDIR)/sanityCheckMessages.txt
|
---|
266 | endif
|
---|
267 |
|
---|
268 | JDK_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2sdk-image
|
---|
269 | JRE_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-image
|
---|
270 |
|
---|
271 | #where the demo source can be found
|
---|
272 | DEMOSRCDIR = $(SHARE_SRC)/demo
|
---|
273 |
|
---|
274 | # An attempt is made to generate unique enough directories for the
|
---|
275 | # generated files to not have name collisisons. Most build units
|
---|
276 | # defines PRODUCT (except Release.gmk), but then they may or may
|
---|
277 | # not define PACKAGE, THREADIR (only HPI uses this), PROGRAM, and
|
---|
278 | # LIBRARY. This code chunk attempts to generate a unique
|
---|
279 | # OBJDIR/CLASSHDRDIR for each build unit based on which of those
|
---|
280 | # values are set within each build unit.
|
---|
281 |
|
---|
282 | UNIQUE_LOCATION_STRING = tmp
|
---|
283 |
|
---|
284 | ifneq ($(PRODUCT),)
|
---|
285 | UNIQUE_LOCATION_STRING += /$(PRODUCT)
|
---|
286 | endif
|
---|
287 |
|
---|
288 | ifneq ($(PACKAGE),)
|
---|
289 | UNIQUE_LOCATION_STRING += /$(PACKAGE)
|
---|
290 | endif
|
---|
291 |
|
---|
292 | ifneq ($(PROGRAM),)
|
---|
293 | UNIQUE_LOCATION_STRING += /$(PROGRAM)
|
---|
294 | endif
|
---|
295 |
|
---|
296 | ifneq ($(LIBRARY),)
|
---|
297 | ifneq ($(LIBRARY_OUTPUT),)
|
---|
298 | UNIQUE_LOCATION_STRING += /$(LIBRARY_OUTPUT)
|
---|
299 | else
|
---|
300 | UNIQUE_LOCATION_STRING += /$(LIBRARY)
|
---|
301 | endif
|
---|
302 | endif
|
---|
303 |
|
---|
304 | ifneq ($(THREADDIR),)
|
---|
305 | UNIQUE_LOCATION_STRING += /$(THREADDIR)
|
---|
306 | endif
|
---|
307 |
|
---|
308 | # the use of += above makes a space separated list which we need to
|
---|
309 | # remove for filespecs.
|
---|
310 | #
|
---|
311 | NULLSTRING :=
|
---|
312 | ONESPACE := $(NULLSTRING) # space before this comment is required.
|
---|
313 | UNIQUE_PATH = $(subst $(ONESPACE),,$(UNIQUE_LOCATION_STRING))
|
---|
314 |
|
---|
315 | # TEMPDIR is a unique general purpose directory
|
---|
316 | # need to use 'override' because GNU Make on Linux exports the wrong
|
---|
317 | # value.
|
---|
318 | override TEMPDIR = $(OUTPUTDIR)/$(UNIQUE_PATH)
|
---|
319 | override ABS_TEMPDIR = $(ABS_OUTPUTDIR)/$(UNIQUE_PATH)
|
---|
320 |
|
---|
321 | # This must be created right away for pattern rules in Sanity.gmk to work.
|
---|
322 | dummy1:=$(shell $(MKDIR) -p $(TEMPDIR))
|
---|
323 | dummy2:=$(shell $(MKDIR) -p $(TEMP_DISK))
|
---|
324 |
|
---|
325 | # OBJDIRNAME is the name of the directory where the object code is to
|
---|
326 | # be placed. It's name depends on whether the data model architecture
|
---|
327 | # is 32-bit or not.
|
---|
328 | ifneq ($(ARCH_DATA_MODEL), 32)
|
---|
329 | OBJDIRNAME = obj$(ARCH_DATA_MODEL)$(OBJDIRNAME_SUFFIX)
|
---|
330 | else
|
---|
331 | OBJDIRNAME = obj$(OBJDIRNAME_SUFFIX)
|
---|
332 | endif
|
---|
333 | OBJDIR = $(TEMPDIR)/$(OBJDIRNAME)
|
---|
334 |
|
---|
335 | # CLASSHDRDIR is where the generated C Class Header files go.
|
---|
336 | CLASSHDRDIR = $(TEMPDIR)/CClassHeaders
|
---|
337 |
|
---|
338 | #
|
---|
339 | # CLASSDESTDIR can be used to specify the directory where generated classes
|
---|
340 | # are to be placed. The default is CLASSBINDIR.
|
---|
341 | #
|
---|
342 | ifndef CLASSDESTDIR
|
---|
343 | CLASSDESTDIR = $(CLASSBINDIR)
|
---|
344 | endif
|
---|
345 |
|
---|
346 | INCLUDES = -I. -I$(CLASSHDRDIR) \
|
---|
347 | $(patsubst %,-I%,$(subst $(CLASSPATH_SEPARATOR), ,$(VPATH.h))) $(OTHER_INCLUDES)
|
---|
348 | ifneq ($(PLATFORM), os2)
|
---|
349 | OTHER_CPPFLAGS = $(INCLUDES)
|
---|
350 | endif
|
---|
351 |
|
---|
352 | #
|
---|
353 | # vpaths. These are the default locations searched for source files.
|
---|
354 | # GNUmakefiles of individual areas often override the default settings.
|
---|
355 | # There are no longer default vpath entries for C and assembler files
|
---|
356 | # so we can ensure that libraries don't get their hands on JVM files.
|
---|
357 | #
|
---|
358 | # We define an intermediate variable for Java files because
|
---|
359 | # we use its value later to help define $SOURCEPATH
|
---|
360 |
|
---|
361 | VPATH0.java = $(GENSRCDIR)$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/classes
|
---|
362 | ifdef OPENJDK
|
---|
363 | VPATH.java = $(VPATH0.java)
|
---|
364 | else
|
---|
365 | #
|
---|
366 | # If filenames are duplicated between open/closed workspaces, prefer
|
---|
367 | # the closed files.
|
---|
368 | #
|
---|
369 | # Source ordering is important: some targets depend on closed files
|
---|
370 | # replacing open ones, and thus the closed file sources must be found
|
---|
371 | # before the open ones.
|
---|
372 | #
|
---|
373 | # Don't reorder without consulting the teams that depend on this behavior.
|
---|
374 | #
|
---|
375 | VPATH.java = $(CLOSED_PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(CLOSED_SHARE_SRC)/classes$(CLASSPATH_SEPARATOR)$(VPATH0.java)
|
---|
376 | endif
|
---|
377 | vpath %.java $(VPATH.java)
|
---|
378 | vpath %.class $(CLASSBINDIR)
|
---|
379 | vpath %.$(OBJECT_SUFFIX) $(OBJDIR)
|
---|
380 |
|
---|
381 | #
|
---|
382 | # VPATH.h is used elsewhere to generate include flags. By default,
|
---|
383 | # anyone has access to the include files that the JVM area exports,
|
---|
384 | # namely jni.h, jvm.h, and jni_utils.h, plus their platform-specific
|
---|
385 | # relatives.
|
---|
386 | #
|
---|
387 | VPATH.h = $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/include$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/javavm/include
|
---|
388 | vpath %.h $(VPATH.h)
|
---|
389 |
|
---|
390 | #
|
---|
391 | # Used in two ways: helps link against libjava.so. Also if overridden
|
---|
392 | # determines where your shared library is installed.
|
---|
393 | #
|
---|
394 | ifndef LIB_LOCATION
|
---|
395 | LIB_LOCATION = $(LIBDIR)/$(LIBARCH)
|
---|
396 | endif
|
---|
397 |
|
---|
398 | #
|
---|
399 | # Java header and stub variables
|
---|
400 | #
|
---|
401 | CLASSHDRS = $(patsubst %,$(CLASSHDRDIR)/%.h,$(subst .,_,$(CLASSES.export)))
|
---|
402 | CLASSSTUBOBJS = classstubs.$(OBJECT_SUFFIX)
|
---|
403 | STUBPREAMBLE = $(INCLUDEDIR)/StubPreamble.h
|
---|
404 |
|
---|
405 | #
|
---|
406 | # Classpath seen by javac (different from the one seen by the VM
|
---|
407 | # running javac), and useful variables.
|
---|
408 | #
|
---|
409 | SOURCEPATH = $(VPATH.java)
|
---|
410 | PKG = $(shell $(EXPR) $(PACKAGE) : '\([a-z]*\)')
|
---|
411 | PKGDIR = $(subst .,/,$(PACKAGE))
|
---|
412 |
|
---|
413 | #
|
---|
414 | # The java/javac/jdk variables (JAVAC_CMD, JAVA_CMD, etc.)
|
---|
415 | #
|
---|
416 | include $(JDK_MAKE_SHARED_DIR)/Defs-java.gmk
|
---|
417 |
|
---|
418 | #
|
---|
419 | # Set opt level to ALT_OPT if set otherwise _OPT
|
---|
420 | #
|
---|
421 | POPT = $(_OPT$(ALT_OPT))$(ALT_OPT)
|
---|
422 |
|
---|
423 | #
|
---|
424 | # Convenient macros
|
---|
425 | #
|
---|
426 |
|
---|
427 | # Prepare $@ target file, remove old one and making sure directory exists
|
---|
428 | define prep-target
|
---|
429 | $(MKDIR) -p $(@D)
|
---|
430 | $(RM) $@
|
---|
431 | endef
|
---|
432 |
|
---|
433 | # Prepare $@ target directory, remove old one and making sure parent exists
|
---|
434 | define prep-dir-target
|
---|
435 | $(MKDIR) -p $(@D)
|
---|
436 | $(RM) -r $@
|
---|
437 | endef
|
---|
438 |
|
---|
439 | # Simple install of $< file to $@
|
---|
440 | define install-file
|
---|
441 | $(prep-target)
|
---|
442 | $(CP) $< $@
|
---|
443 | endef
|
---|
444 |
|
---|
445 | # Cleanup rule for after debug java run (hotspot.log file is left around)
|
---|
446 | # (This could be an old leftover file in a read-only area, use the @- prefix)
|
---|
447 | HOTSPOT_LOG_NAME = hotspot.log
|
---|
448 | define java-vm-cleanup
|
---|
449 | if [ -w $(HOTSPOT_LOG_NAME) ] ; then $(RM) $(HOTSPOT_LOG_NAME); fi
|
---|
450 | endef
|
---|
451 |
|
---|
452 | # Default make settings for processing SUBDIRS with clobber or clean names
|
---|
453 | SUBDIRS_MAKEFLAGS-clobber = INCREMENTAL_BUILD=false
|
---|
454 | SUBDIRS_MAKEFLAGS-clean = INCREMENTAL_BUILD=false
|
---|
455 |
|
---|
456 | # Current directory
|
---|
457 | CURRENT_DIRECTORY := $(shell $(PWD))
|
---|
458 |
|
---|
459 | # If no timing wanted, we need to define these as empty
|
---|
460 | ifdef NO_TIMING
|
---|
461 |
|
---|
462 | TIMING_ID:=NA
|
---|
463 |
|
---|
464 | define TIMING_start
|
---|
465 | t=0:0:0:0
|
---|
466 | endef
|
---|
467 |
|
---|
468 | define TIMING_end
|
---|
469 | time_used=0
|
---|
470 | endef
|
---|
471 |
|
---|
472 | else # NO_TIMING
|
---|
473 |
|
---|
474 | # Default timing id
|
---|
475 | TIMING_ID:=$(shell $(BASENAME) $(CURRENT_DIRECTORY))
|
---|
476 |
|
---|
477 | # Timing start (must be used in same shell, e.g. same command line)
|
---|
478 | # Defines the shell variable $1 to have the start time.
|
---|
479 | define TIMING_start
|
---|
480 | $1=`$(DATE) +%j:%H:%M:%S`
|
---|
481 | endef
|
---|
482 |
|
---|
483 | # Timing end (must be used in same shell, e.g. same command line)
|
---|
484 | # Expects shell variable $1 to have been defined as the start time.
|
---|
485 | # Expects shell variable $2 to have timing id string
|
---|
486 | # Sets total_seconds shell variable as the total seconds used.
|
---|
487 | # Sets time_used shell variable to contain format "%dh%dm%ds"
|
---|
488 | define TIMING_end
|
---|
489 | begTime="$${$1}"; \
|
---|
490 | timing_id="$${$2}"; \
|
---|
491 | endTime=`$(DATE) +%j:%H:%M:%S`; \
|
---|
492 | d1=`$(ECHO) $${begTime} | $(CUT) -d':' -f1 | $(SED) -e 's@^0*@@'`; \
|
---|
493 | if [ "$${d1}" = "" ] ; then d1=0; fi; \
|
---|
494 | h1=`$(ECHO) $${begTime} | $(CUT) -d':' -f2 | $(SED) -e 's@^0*@@'`; \
|
---|
495 | if [ "$${h1}" = "" ] ; then h1=0; fi; \
|
---|
496 | m1=`$(ECHO) $${begTime} | $(CUT) -d':' -f3 | $(SED) -e 's@^0*@@'`; \
|
---|
497 | if [ "$${m1}" = "" ] ; then m1=0; fi; \
|
---|
498 | s1=`$(ECHO) $${begTime} | $(CUT) -d':' -f4 | $(SED) -e 's@^0*@@'`; \
|
---|
499 | if [ "$${s1}" = "" ] ; then s1=0; fi; \
|
---|
500 | d2=`$(ECHO) $${endTime} | $(CUT) -d':' -f1 | $(SED) -e 's@^0*@@'`; \
|
---|
501 | if [ "$${d2}" = "" ] ; then d2=0; fi; \
|
---|
502 | h2=`$(ECHO) $${endTime} | $(CUT) -d':' -f2 | $(SED) -e 's@^0*@@'`; \
|
---|
503 | if [ "$${h2}" = "" ] ; then h2=0; fi; \
|
---|
504 | m2=`$(ECHO) $${endTime} | $(CUT) -d':' -f3 | $(SED) -e 's@^0*@@'`; \
|
---|
505 | if [ "$${m2}" = "" ] ; then m2=0; fi; \
|
---|
506 | s2=`$(ECHO) $${endTime} | $(CUT) -d':' -f4 | $(SED) -e 's@^0*@@'`; \
|
---|
507 | if [ "$${s2}" = "" ] ; then s2=0; fi; \
|
---|
508 | t1_secs=`$(EXPR) $${d1} '*' 60 '*' 60 '*' 24 '+' $${h1} '*' 60 '*' 60 \
|
---|
509 | '+' $${m1} '*' 60 '+' $${s1}`; \
|
---|
510 | t2_secs=`$(EXPR) $${d2} '*' 60 '*' 60 '*' 24 '+' $${h2} '*' 60 '*' 60 \
|
---|
511 | '+' $${m2} '*' 60 '+' $${s2}`; \
|
---|
512 | total_seconds=`$(EXPR) $${t2_secs} '-' $${t1_secs}`; \
|
---|
513 | if [ "$${total_seconds}" -lt 0 ] ; then total_seconds=0; fi; \
|
---|
514 | t_hour=`$(EXPR) $${total_seconds} '/' '(' 60 '*' 60 ')'`h; \
|
---|
515 | t_min=`$(EXPR) '(' $${total_seconds} '%' '(' 60 '*' 60 ')' ')' '/' 60`m; \
|
---|
516 | t_sec=`$(EXPR) $${total_seconds} '%' 60`s; \
|
---|
517 | time_used=$${t_sec}; \
|
---|
518 | if [ "$${t_hour}" != "0h" ] ; then \
|
---|
519 | time_used=$${t_hour}$${t_min}$${t_sec}; \
|
---|
520 | elif [ "$${t_min}" != "0m" ] ; then \
|
---|
521 | time_used=$${t_min}$${t_sec}; \
|
---|
522 | else \
|
---|
523 | time_used=$${t_sec}; \
|
---|
524 | fi; \
|
---|
525 | $(PRINTF) " Timing: %05d seconds or %s for %s\n" \
|
---|
526 | $${total_seconds} $${time_used} $${timing_id}
|
---|
527 | endef
|
---|
528 |
|
---|
529 | endif # NO_TIMING
|
---|
530 |
|
---|
531 | # Given a SUBDIRS list, cd into them and make them
|
---|
532 | # SUBDIRS_MAKEFLAGS Make settings for a subdir make
|
---|
533 | # SUBDIRS_MAKEFLAGS-$@ Make settings specific to this target
|
---|
534 | define SUBDIRS-loop
|
---|
535 | @$(ECHO) "Begin Processing SUBDIRS: $(SUBDIRS)"
|
---|
536 | @for i in DUMMY $(SUBDIRS) ; do \
|
---|
537 | if [ "$$i" != "DUMMY" ] ; then \
|
---|
538 | $(ECHO) ">>>Recursively making "$$i" "$@" @ `$(DATE)` ..."; \
|
---|
539 | timing_id="$(TIMING_ID)-`$(BASENAME) $${i}`"; \
|
---|
540 | $(call TIMING_start,startTime); \
|
---|
541 | curDir=$(CURRENT_DIRECTORY); \
|
---|
542 | $(CD) $$i; $(MAKE) $@ TIMING_ID=$${timing_id} \
|
---|
543 | $(SUBDIRS_MAKEFLAGS) \
|
---|
544 | $(SUBDIRS_MAKEFLAGS-$@) \
|
---|
545 | FULL_VERSION=$(FULL_VERSION) \
|
---|
546 | RELEASE=$(RELEASE) || exit 1; \
|
---|
547 | $(CD) $${curDir}; \
|
---|
548 | $(call TIMING_end,startTime,timing_id); \
|
---|
549 | $(ECHO) "<<<Finished Recursively making "$$i" "$@" @ `$(DATE)`." ; \
|
---|
550 | fi ; \
|
---|
551 | done
|
---|
552 | @$(ECHO) "Done Processing SUBDIRS: $(SUBDIRS)"
|
---|
553 | endef
|
---|
554 |
|
---|
555 | # Given a OTHERSUBDIRS list, cd into them and make them (extra loop define)
|
---|
556 | # OTHERSUBDIRS_MAKEFLAGS Make settings for a subdir make
|
---|
557 | define OTHERSUBDIRS-loop
|
---|
558 | @$(ECHO) "Begin Processing OTHERSUBDIRS: $(OTHERSUBDIRS)"
|
---|
559 | @for i in DUMMY $(OTHERSUBDIRS) ; do \
|
---|
560 | if [ "$$i" != "DUMMY" ] ; then \
|
---|
561 | $(ECHO) ">>>Recursively making "$$i" "$@" @ `$(DATE)` ..."; \
|
---|
562 | timing_id="$(TIMING_ID)-`$(BASENAME) $${i}`"; \
|
---|
563 | $(call TIMING_start,startTime); \
|
---|
564 | curDir=$(CURRENT_DIRECTORY); \
|
---|
565 | $(CD) $$i; $(MAKE) $@ TIMING_ID=$${timing_id} \
|
---|
566 | $(OTHERSUBDIRS_MAKEFLAGS) \
|
---|
567 | FULL_VERSION=$(FULL_VERSION) \
|
---|
568 | RELEASE=$(RELEASE) || exit 1; \
|
---|
569 | $(CD) $${curDir}; \
|
---|
570 | $(call TIMING_end,startTime,timing_id); \
|
---|
571 | $(ECHO) "<<<Finished Recursively making "$$i" "$@" @ `$(DATE)`." ; \
|
---|
572 | fi ; \
|
---|
573 | done
|
---|
574 | @$(ECHO) "Done Processing OTHERSUBDIRS: $(OTHERSUBDIRS)"
|
---|
575 | endef
|
---|
576 |
|
---|
577 | #
|
---|
578 | # Create BYFILE OPT and DBG settings, if CFLAGS_OPT/foobar.o is set then it is
|
---|
579 | # used for this file, otherwise the default settings are used.
|
---|
580 | #
|
---|
581 | CFLAGS_$(VARIANT)/BYFILE = $(CFLAGS_$(VARIANT)/$(@F)) \
|
---|
582 | $(CFLAGS_$(VARIANT)$(CFLAGS_$(VARIANT)/$(@F)))
|
---|
583 | CXXFLAGS_$(VARIANT)/BYFILE = $(CXXFLAGS_$(VARIANT)/$(@F)) \
|
---|
584 | $(CXXFLAGS_$(VARIANT)$(CXXFLAGS_$(VARIANT)/$(@F)))
|
---|
585 |
|
---|
586 | #
|
---|
587 | # Tool flags
|
---|
588 | #
|
---|
589 | ASFLAGS = $(ASFLAGS_$(VARIANT)) $(ASFLAGS_COMMON) $(OTHER_ASFLAGS)
|
---|
590 | CFLAGS = $(CFLAGS_$(VARIANT)/BYFILE) $(CFLAGS_COMMON) $(OTHER_CFLAGS)
|
---|
591 | CXXFLAGS = $(CXXFLAGS_$(VARIANT)/BYFILE) $(CXXFLAGS_COMMON) $(OTHER_CXXFLAGS)
|
---|
592 | ifeq ($(PLATFORM), os2)
|
---|
593 | CPPFLAGS = $(INCLUDES) $(CPPFLAGS_$(VARIANT)) $(CPPFLAGS_COMMON) $(OTHER_CPPFLAGS) \
|
---|
594 | $(DEFINES) $(OPTIONS:%=-D%)
|
---|
595 | else
|
---|
596 | CPPFLAGS = $(CPPFLAGS_$(VARIANT)) $(CPPFLAGS_COMMON) $(OTHER_CPPFLAGS) \
|
---|
597 | $(DEFINES) $(OPTIONS:%=-D%)
|
---|
598 | endif
|
---|
599 | LDFLAGS = $(LDFLAGS_$(VARIANT)) $(LDFLAGS_COMMON) $(OTHER_LDFLAGS)
|
---|
600 | LDLIBS = $(OTHER_LDLIBS) $(LDLIBS_$(VARIANT)) $(LDLIBS_COMMON)
|
---|
601 | LINTFLAGS = $(LINTFLAGS_$(VARIANT)) $(LINTFLAGS_COMMON) \
|
---|
602 | $(OTHER_LINTFLAGS)
|
---|
603 |
|
---|
604 | VERSION_DEFINES = -DRELEASE='"$(RELEASE)"'
|
---|
605 |
|
---|
606 | # Note: As a rule, GNU Make rules should not appear in any of the
|
---|
607 | # Defs*.gmk files. These were added for Kestrel-Solaris and do address
|
---|
608 | # a TeamWare bug. They should be moved elsewhere for Merlin.
|
---|
609 | #
|
---|
610 | # Override gnumake built-in rules which do sccs get operations badly.
|
---|
611 | # (They put the checked out code in the current directory, not in the
|
---|
612 | # directory of the original file.)
|
---|
613 | # Since this is a symptom of a teamware failure, complain and die on the spot.
|
---|
614 |
|
---|
615 | # This message immediately goes to stdout and the build terminates.
|
---|
616 | define SCCS-trouble
|
---|
617 | $(error \
|
---|
618 | "ERROR: File $@ referenced while building in $(CURRENT_DIRECTORY) \
|
---|
619 | is out of date with respect to its SCCS file $<. \
|
---|
620 | This can happen from an unresolved Teamware conflict, a file movement, or \
|
---|
621 | a failure in which SCCS files are updated but the 'sccs get' was not done. \
|
---|
622 | You should double check for other out of date files in your workspace. \
|
---|
623 | Or run: cd $(TOPDIR) && $(MAKE) sccs_get")
|
---|
624 | endef
|
---|
625 |
|
---|
626 | %:: s.%
|
---|
627 | @$(SCCS-trouble)
|
---|
628 | %:: SCCS/s.%
|
---|
629 | @$(SCCS-trouble)
|
---|
630 | @$(ECHO) " is out of date with respect to its SCCS file." >> $(WARNING_FILE)
|
---|
631 | @$(ECHO) " This file may be from an unresolved Teamware conflict." >> $(WARNING_FILE)
|
---|
632 | @$(ECHO) " This is also a symptom of a Teamware bringover/putback failure" >> $(WARNING_FILE)
|
---|
633 | @$(ECHO) " in which SCCS files are updated but not checked out." >> $(WARNING_FILE)
|
---|
634 | @$(ECHO) " Check for other out of date files in your workspace." >> $(WARNING_FILE)
|
---|
635 | @$(ECHO) "" >> $(WARNING_FILE)
|
---|
636 | @#exit 666
|
---|
637 |
|
---|
638 | ifdef INSANE
|
---|
639 | export INSANE
|
---|
640 | endif
|
---|
641 |
|
---|
642 | ifdef ALT_COPYRIGHT_YEAR
|
---|
643 | COPYRIGHT_YEAR = $(ALT_COPYRIGHT_YEAR)
|
---|
644 | else
|
---|
645 | COPYRIGHT_YEAR := $(shell $(DATE) '+%Y')
|
---|
646 | endif
|
---|
647 |
|
---|
648 | # Install of imported file (JDK_IMPORT_PATH, or some other external location)
|
---|
649 | define install-import-file
|
---|
650 | @$(ECHO) "ASSEMBLY_IMPORT: $@"
|
---|
651 | $(install-file)
|
---|
652 | endef
|
---|
653 |
|
---|
654 | .PHONY: all build clean clobber
|
---|