annotate mx.jvmci/mx_jvmci_makefile.py @ 22176:fb1a9390cdcf

fixed mx_jvmci_makefile.py
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Jul 2015 01:53:46 +0200
parents f9ddf6b6dd6b
children 706aa848a8d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
1 #
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
2 # ----------------------------------------------------------------------------------------------------
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
3 #
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
4 # Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
6 #
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
7 # This code is free software; you can redistribute it and/or modify it
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
8 # under the terms of the GNU General Public License version 2 only, as
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
9 # published by the Free Software Foundation.
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
10 #
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
11 # This code is distributed in the hope that it will be useful, but WITHOUT
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
14 # version 2 for more details (a copy is included in the LICENSE file that
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
15 # accompanied this code).
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
16 #
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
17 # You should have received a copy of the GNU General Public License version
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
18 # 2 along with this work; if not, write to the Free Software Foundation,
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
20 #
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
22 # or visit www.oracle.com if you need additional information or have any
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
23 # questions.
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
24 #
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
25 # ----------------------------------------------------------------------------------------------------
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
26 #
22139
ed35cb998428 Initial split off from monolithic basic-graal repo
Doug Simon <doug.simon@oracle.com>
parents: 22137
diff changeset
27 import mx, mx_jvmci, os
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
28 from argparse import ArgumentParser, REMAINDER
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
29
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
30
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
31 class Makefile:
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
32 def __init__(self):
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
33 self.rules = []
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
34 self.definitions = []
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
35
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
36 def add_rule(self, s):
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
37 self.rules.append(s)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
38
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
39 def add_definition(self, s):
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
40 self.definitions.append(s)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
41
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
42 def generate(self):
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
43 return "\n\n".join(self.definitions + self.rules)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
44
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
45
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
46 def build_makefile(args):
21936
11f241f26c61 mx: add check to gate the jvmci.make and suite.py are in sync
Doug Simon <doug.simon@oracle.com>
parents: 21919
diff changeset
47 """Creates a Makefile which is able to build distributions without mx
11f241f26c61 mx: add check to gate the jvmci.make and suite.py are in sync
Doug Simon <doug.simon@oracle.com>
parents: 21919
diff changeset
48
11f241f26c61 mx: add check to gate the jvmci.make and suite.py are in sync
Doug Simon <doug.simon@oracle.com>
parents: 21919
diff changeset
49 The return value indicates how many files were modified"""
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
50 parser = ArgumentParser(prog='mx makefile')
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
51 parser.add_argument('-o', action='store', dest='output', help='Write contents to this file.')
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
52 parser.add_argument('selectedDists', help="Selected distribution names which are going to be built with make.", nargs=REMAINDER)
21790
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
53 opts = parser.parse_args(args)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
54
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
55 if not opts.selectedDists:
22169
f9ddf6b6dd6b minor fixes related to mx2 transition
Doug Simon <doug.simon@oracle.com>
parents: 22139
diff changeset
56 opts.selectedDists = [d.name for d in mx_jvmci.jdkDeployedDists if d.partOfHotSpot]
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
57 mf = Makefile()
21790
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
58 commandline = " ".join(["mx.sh", "makefile"] + args)
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
59 if do_build_makefile(mf, opts.selectedDists, commandline):
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
60 contents = mf.generate()
21790
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
61 if opts.output == None:
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
62 print contents
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
63 else:
21957
555f788b964b show diff if jvmci.make generation modifies an existing file
Doug Simon <doug.simon@oracle.com>
parents: 21955
diff changeset
64 if mx.update_file(opts.output, contents, showDiff=True):
21936
11f241f26c61 mx: add check to gate the jvmci.make and suite.py are in sync
Doug Simon <doug.simon@oracle.com>
parents: 21919
diff changeset
65 return 1
11f241f26c61 mx: add check to gate the jvmci.make and suite.py are in sync
Doug Simon <doug.simon@oracle.com>
parents: 21919
diff changeset
66 return 0
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
67
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
68 def get_jdk_deployed_dists():
22169
f9ddf6b6dd6b minor fixes related to mx2 transition
Doug Simon <doug.simon@oracle.com>
parents: 22139
diff changeset
69 return [d.name for d in mx_jvmci.jdkDeployedDists]
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
70
21917
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
71 def make_dist_rule(dist, mf):
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
72 def path_dist_relative(p):
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
73 return os.path.relpath(p, dist.suite.dir)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
74 jdkDeployedDists = get_jdk_deployed_dists()
22082
4ce725f06a27 jvmci.make intermediate output is now flattened into build/jvmci.make
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
75 jarName = os.path.basename(dist.path)
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
76 sourcesVariableName = dist.name + "_SRC"
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
77 depJarVariableName = dist.name + "_DEP_JARS"
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
78 sources = []
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
79 resources = []
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
80 projects = [p for p in dist.archived_deps() if p.isJavaProject()]
22082
4ce725f06a27 jvmci.make intermediate output is now flattened into build/jvmci.make
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
81 targetPathPrefix = "$(TARGET)/"
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
82 libraryDeps = [path_dist_relative(l.get_path(False)) for l in [l for l in dist.archived_deps() if l.isLibrary()]]
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
83
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
84 annotationProcessorDeps = set()
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
85 distDeps = [dep for dep in dist.deps if dep.isDistribution()]
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
86
22082
4ce725f06a27 jvmci.make intermediate output is now flattened into build/jvmci.make
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
87 classPath = [targetPathPrefix + os.path.basename(d.path) for d in distDeps] + libraryDeps \
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
88 + [path_dist_relative(exclLib.path) for exclLib in dist.excludedLibs]
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
89 for p in projects:
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
90 projectDir = path_dist_relative(p.dir)
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
91 annotationProcessorDeps.update(p.declaredAnnotationProcessors)
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
92 for src in [projectDir + '/' + d for d in p.srcDirs]:
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
93 sources.append("$(shell find {} -type f 2> /dev/null)".format(src))
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
94 metaInf = src + "/META-INF"
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
95 if os.path.exists(os.path.join(dist.suite.dir, metaInf)):
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
96 resources.append(metaInf)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
97
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
98 sourceLines = sourcesVariableName + " = " + ("\n" + sourcesVariableName + " += ").join(sources)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
99 apPaths = []
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
100 apDistNames = []
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
101 apDistVariableNames = []
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
102 for apd in sorted(annotationProcessorDeps):
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
103 apPaths.append(path_dist_relative(apd.path))
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
104 apDistNames.append(apd.name)
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
105 apDistVariableNames.append("$(" + apd.name + "_JAR)")
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
106 shouldExport = dist.name in jdkDeployedDists
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
107 props = {
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
108 "name": dist.name,
22082
4ce725f06a27 jvmci.make intermediate output is now flattened into build/jvmci.make
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
109 "jarName": targetPathPrefix + jarName,
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
110 "depJarsVariableAccess": "$(" + depJarVariableName + ")" if len(classPath) > 0 else "",
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
111 "depJarsVariable": depJarVariableName,
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
112 "sourceLines": sourceLines,
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
113 "sourcesVariableName": sourcesVariableName,
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
114 "annotationProcessors": " ".join(apDistVariableNames),
21917
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
115 "cpAnnotationProcessors": ":".join(apDistVariableNames),
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
116 "jarDeps": " ".join(classPath),
21917
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
117 "copyResources": " ".join(resources)
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
118 }
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
119
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
120 mf.add_definition(sourceLines)
22082
4ce725f06a27 jvmci.make intermediate output is now flattened into build/jvmci.make
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
121 mf.add_definition("{name}_JAR = {jarName}".format(**props))
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
122 if len(classPath) > 0: mf.add_definition("{depJarsVariable} = {jarDeps}".format(**props))
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
123 if shouldExport: mf.add_definition("EXPORTED_FILES += $({name}_JAR)".format(**props))
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
124 mf.add_rule("""$({name}_JAR): $({sourcesVariableName}) {annotationProcessors} {depJarsVariableAccess}
21919
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
125 \t$(call build_and_jar,{cpAnnotationProcessors},$(subst $(space),:,{depJarsVariableAccess}),{copyResources},$({name}_JAR))
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
126 """.format(**props))
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
127 return
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
128
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
129
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
130
21790
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
131 def do_build_makefile(mf, selectedDists, commandline):
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
132 java = mx.java()
21971
28debbb6496d Don't apply os.path.realpath to the boot classpath
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21969
diff changeset
133 bootClassPath = java.bootclasspath()
21969
eef888fdb8b1 Use real path (canonicalized) when create relative paths for bootclasspath
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21957
diff changeset
134 bootClassPath = bootClassPath.replace(os.path.realpath(java.jdk), "$(ABS_BOOTDIR)")
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
135 jdkBootClassPathVariableName = "JDK_BOOTCLASSPATH"
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
136
21790
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
137 mf.add_definition("""# This Makefile is generated automatically, do not edit
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
138
21790
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
139 TARGET=.
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
140 # Bootstrap JDK to be used (for javac and jar)
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
141 ABS_BOOTDIR=
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
142
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
143 JAVAC=$(ABS_BOOTDIR)/bin/javac -g -target """ + str(java.javaCompliance) + """
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
144 JAR=$(ABS_BOOTDIR)/bin/jar
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
145
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
146 HS_COMMON_SRC=.
21790
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
147
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
148 # Directories, where the generated property-files reside within the JAR files
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
149 PROVIDERS_INF=/META-INF/jvmci.providers
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
150 SERVICES_INF=/META-INF/jvmci.services
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
151 OPTIONS_INF=/META-INF/jvmci.options
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
152
21955
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
153 JARS = $(foreach dist,$(DISTRIBUTIONS),$($(dist)_JAR))
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
154
21790
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
155 ifeq ($(ABS_BOOTDIR),)
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
156 $(error Variable ABS_BOOTDIR must be set to a JDK installation.)
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
157 endif
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
158 ifeq ($(MAKE_VERBOSE),)
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
159 QUIETLY=@
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
160 endif
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
161
21919
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
162 # Required to construct a whitespace for use with subst
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
163 space :=
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
164 space +=
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
165
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
166 # Takes the provider files created by ServiceProviderProcessor (the processor
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
167 # for the @ServiceProvider annotation) and merges them into a single file.
21917
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
168 # Arguments:
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
169 # 1: directory with contents of the JAR file
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
170 define process_providers
21943
31be1c8f4905 switched to use of simple makefile assignment in jvmci.make and removed unnecessary semicolons
Doug Simon <doug.simon@oracle.com>
parents: 21939
diff changeset
171 $(eval providers := $(1)/$(PROVIDERS_INF))
31be1c8f4905 switched to use of simple makefile assignment in jvmci.make and removed unnecessary semicolons
Doug Simon <doug.simon@oracle.com>
parents: 21939
diff changeset
172 $(eval services := $(1)/$(SERVICES_INF))
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
173 $(QUIETLY) test -d $(services) || mkdir -p $(services)
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
174 $(QUIETLY) test ! -d $(providers) || (cd $(providers) && for i in $$(ls); do c=$$(cat $$i); echo $$i >> $(abspath $(services))/$$c; rm $$i; done)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
175
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
176 @# Since all projects are built together with one javac call we cannot determine
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
177 @# which project contains HotSpotVMConfig.inline.hpp so we hardcode it.
21943
31be1c8f4905 switched to use of simple makefile assignment in jvmci.make and removed unnecessary semicolons
Doug Simon <doug.simon@oracle.com>
parents: 21939
diff changeset
178 $(eval vmconfig := $(1)/hotspot/HotSpotVMConfig.inline.hpp)
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22017
diff changeset
179 $(eval vmconfigDest := $(HS_COMMON_SRC)/../jvmci/jdk.internal.jvmci.hotspot/src_gen/hotspot)
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
180 $(QUIETLY) test ! -f $(vmconfig) || (mkdir -p $(vmconfigDest) && cp $(vmconfig) $(vmconfigDest))
21717
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
181 endef
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
182
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
183 # Reads the files in jvmci.options/ created by OptionProcessor (the processor for the @Option annotation)
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22017
diff changeset
184 # and appends to services/jdk.internal.jvmci.options.Options entries for the providers
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
185 # also created by the same processor.
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
186 # Arguments:
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
187 # 1: directory with contents of the JAR file
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
188 define process_options
21943
31be1c8f4905 switched to use of simple makefile assignment in jvmci.make and removed unnecessary semicolons
Doug Simon <doug.simon@oracle.com>
parents: 21939
diff changeset
189 $(eval options := $(1)/$(OPTIONS_INF))
31be1c8f4905 switched to use of simple makefile assignment in jvmci.make and removed unnecessary semicolons
Doug Simon <doug.simon@oracle.com>
parents: 21939
diff changeset
190 $(eval services := $(1)/META-INF/services)
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
191 $(QUIETLY) test -d $(services) || mkdir -p $(services)
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 22017
diff changeset
192 $(QUIETLY) test ! -d $(options) || (cd $(options) && for i in $$(ls); do echo $${i}_Options >> $(abspath $(services))/jdk.internal.jvmci.options.Options; done)
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
193 endef
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
194
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
195 # Extracts META-INF/jvmci.services and META-INF/jvmci.options of a JAR file into a given directory
21917
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
196 # Arguments:
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
197 # 1: JAR file to extract
21943
31be1c8f4905 switched to use of simple makefile assignment in jvmci.make and removed unnecessary semicolons
Doug Simon <doug.simon@oracle.com>
parents: 21939
diff changeset
198 # 2: target directory (which already exists)
21793
44bad469bec2 Create DEST_SUBDIR when doing install_jvm (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21790
diff changeset
199 define extract
21912
1a6a520af3b5 jvmci.make put temp dirs into the target directory
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21911
diff changeset
200 $(eval TMP := $(shell mktemp -d $(TARGET)/tmp_XXXXX))
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
201 $(QUIETLY) cd $(TMP) && $(JAR) xf $(abspath $(1)) && \\
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
202 ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) && \\
21943
31be1c8f4905 switched to use of simple makefile assignment in jvmci.make and removed unnecessary semicolons
Doug Simon <doug.simon@oracle.com>
parents: 21939
diff changeset
203 (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2))));
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
204 $(QUIETLY) rm -r $(TMP);
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
205 $(QUIETLY) cp $(1) $(2)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
206 endef
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
207
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
208 # Calls $(JAVAC) with the boot class path $(JDK_BOOTCLASSPATH) and sources taken from the automatic variable $^
21917
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
209 # Arguments:
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
210 # 1: processorpath
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
211 # 2: classpath
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
212 # 3: resources to copy
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
213 # 4: target JAR file
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
214 define build_and_jar
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
215 $(info Building $(4))
21912
1a6a520af3b5 jvmci.make put temp dirs into the target directory
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21911
diff changeset
216 $(eval TMP := $(shell mkdir -p $(TARGET) && mktemp -d $(TARGET)/tmp_XXXXX))
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
217 $(QUIETLY) $(JAVAC) -d $(TMP) -processorpath :$(1) -bootclasspath $(JDK_BOOTCLASSPATH) -cp :$(2) $(filter %.java,$^)
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
218 $(QUIETLY) test "$(3)" = "" || cp -r $(3) $(TMP)
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
219 $(QUIETLY) $(call process_options,$(TMP))
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
220 $(QUIETLY) $(call process_providers,$(TMP))
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
221 $(QUIETLY) mkdir -p $(shell dirname $(4))
21992
72129dd49bc0 jvmci.make do not compress jars
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21985
diff changeset
222 $(QUIETLY) $(JAR) -0cf $(4) -C $(TMP) .
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
223 $(QUIETLY) rm -r $(TMP)
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
224 endef
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
225
21939
eac31af360db verify that only existing JVMCI services and options are exported in make/defs.make
Doug Simon <doug.simon@oracle.com>
parents: 21938
diff changeset
226 # Verifies that make/defs.make contains an appropriate line for each JVMCI service or option
eac31af360db verify that only existing JVMCI services and options are exported in make/defs.make
Doug Simon <doug.simon@oracle.com>
parents: 21938
diff changeset
227 # and that only existing JVMCI services and options are exported.
21947
e701664f4168 Add parameter description to jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21919
diff changeset
228 # Arguments:
21939
eac31af360db verify that only existing JVMCI services and options are exported in make/defs.make
Doug Simon <doug.simon@oracle.com>
parents: 21938
diff changeset
229 # 1: list of service or option files
21978
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
230 # 2: variable name for directory of service or option files
21937
3a292e8b9e51 replaced Service marker interface with non-standard META-INF directory names to differentiate JVMCI providers from standard service providers
Doug Simon <doug.simon@oracle.com>
parents: 21936
diff changeset
231 define verify_defs_make
21943
31be1c8f4905 switched to use of simple makefile assignment in jvmci.make and removed unnecessary semicolons
Doug Simon <doug.simon@oracle.com>
parents: 21939
diff changeset
232 $(eval defs := make/defs.make)
21978
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
233 $(eval uncondPattern := EXPORT_LIST += $$$$($(2))/)
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
234 $(eval condPattern := CONDITIONAL_EXPORT_LIST += $$$$($(2))/)
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
235 $(eval unconditionalExports := $(shell grep '^EXPORT_LIST += $$($2)' make/defs.make | sed 's:.*($(2))/::g'))
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
236 $(eval conditionalExports := $(shell grep '^CONDITIONAL_EXPORT_LIST += $$($2)' make/defs.make | sed 's:.*($(2))/::g'))
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
237 $(eval allExports := $(unconditionalExports) $(conditionalExports))
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
238 $(foreach file,$(1),$(if $(findstring $(file),$(allExports)), ,$(error "Line matching '$(uncondPattern)$(file)' or '$(condPattern)$(file)' not found in $(defs)")))
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
239 $(foreach export,$(unconditionalExports),$(if $(findstring $(export),$(1)), ,$(error "The line '$(uncondPattern)$(export)' should not be in $(defs)")))
21919
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
240 endef
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
241
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
242 all: default
21944
b121c00d3c4c fixed subtle makefile evaluation order issue in the verification that only existing JVMCI services and options are exported in make/defs.make
Doug Simon <doug.simon@oracle.com>
parents: 21943
diff changeset
243 \t$(info Put $(EXPORTED_FILES) into SHARED_DIR $(SHARED_DIR))
21985
ba769b2ee8fa jvmci.make $(shell ...) is always quiet
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21978
diff changeset
244 \t$(shell mkdir -p $(SHARED_DIR))
21944
b121c00d3c4c fixed subtle makefile evaluation order issue in the verification that only existing JVMCI services and options are exported in make/defs.make
Doug Simon <doug.simon@oracle.com>
parents: 21943
diff changeset
245 \t$(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(SHARED_DIR)))
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
246
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
247 export: all
21978
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
248 \t$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.services/*)),EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
249 \t$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.options/*)),EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
250 .PHONY: export
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
251
21955
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
252 clean:
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
253 \t$(QUIETLY) rm $(JARS) 2> /dev/null || true
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
254 \t$(QUIETLY) rmdir -p $(dir $(JARS)) 2> /dev/null || true
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
255 .PHONY: export clean
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
256
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
257 """)
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
258 assert selectedDists
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
259 selectedDists = [mx.dependency(s) for s in selectedDists]
21790
6db6070d30b9 Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21740
diff changeset
260 dists = []
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
261
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
262 def _visit(dep, edge):
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
263 if dep.isDistribution():
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
264 dists.append(dep)
21740
6c3c21d9b5ef Add -m switch to mx build, which builds/exports JVMCI with the make/jvmci.make file
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21739
diff changeset
265
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
266 mx.walk_deps(roots=selectedDists, visit=_visit, ignoredEdges=[mx.DEP_EXCLUDED])
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
267
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
268 mf.add_definition(jdkBootClassPathVariableName + " = " + bootClassPath)
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
269 for dist in dists: make_dist_rule(dist, mf)
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
270 mf.add_definition("DISTRIBUTIONS = " + ' '.join([dist.name for dist in dists]))
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
271 mf.add_rule("default: $({}_JAR)\n.PHONY: default\n".format("_JAR) $(".join([d.name for d in selectedDists])))
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
272 return True