Mercurial > hg > graal-jvmci-8
annotate mx.jvmci/mx_jvmci_makefile.py @ 22394:528eeeca785e
Merge.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Wed, 29 Jul 2015 10:36:54 +0200 |
parents | f114acdecf70 |
children | 4f6caa445b92 |
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: |
22287
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22279
diff
changeset
|
56 opts.selectedDists = [d.dist() for d in mx_jvmci.jdkDeployedDists if isinstance(d, mx_jvmci.JarJDKDeployedDist) and d.partOfHotSpot] |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22279
diff
changeset
|
57 else: |
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22279
diff
changeset
|
58 opts.selectedDists = [mx.distribution(name) for name in opts.selectedDists] |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
59 mf = Makefile() |
22226
751a0882cb7e
mx makefile: Remove dead code
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22137
diff
changeset
|
60 if do_build_makefile(mf, opts.selectedDists): |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
61 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
|
62 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
|
63 print contents |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
64 else: |
21957
555f788b964b
show diff if jvmci.make generation modifies an existing file
Doug Simon <doug.simon@oracle.com>
parents:
21955
diff
changeset
|
65 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
|
66 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
|
67 return 0 |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
68 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
69 def get_jdk_deployed_dists(): |
22287
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22279
diff
changeset
|
70 return [d.dist() 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
|
71 |
21917
0df6a0cb4b5f
Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21916
diff
changeset
|
72 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
|
73 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
|
74 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
|
75 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
|
76 jarName = os.path.basename(dist.path) |
22176
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
77 sourcesVariableName = dist.name + "_SRC" |
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
78 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
|
79 sources = [] |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
80 resources = [] |
22176
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
81 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
|
82 targetPathPrefix = "$(TARGET)/" |
22289
26e2a05f8d95
fixed mx_jvmci_makefile to use mx.classpath_entries()
Doug Simon <doug.simon@oracle.com>
parents:
22287
diff
changeset
|
83 annotationProcessorDeps = set() |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
84 |
22289
26e2a05f8d95
fixed mx_jvmci_makefile to use mx.classpath_entries()
Doug Simon <doug.simon@oracle.com>
parents:
22287
diff
changeset
|
85 classPath = [targetPathPrefix + os.path.basename(e.path) for e in mx.classpath_entries(dist, includeSelf=False, preferProjects=False)] |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
86 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
|
87 projectDir = path_dist_relative(p.dir) |
22176
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
88 annotationProcessorDeps.update(p.declaredAnnotationProcessors) |
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
89 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
|
90 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
|
91 metaInf = src + "/META-INF" |
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
92 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
|
93 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
|
94 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
95 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
|
96 apDistNames = [] |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
97 apDistVariableNames = [] |
22325
f114acdecf70
Update jvmci.make
Roland Schatz <roland.schatz@oracle.com>
parents:
22289
diff
changeset
|
98 apDependencies = [] |
22176
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
99 for apd in sorted(annotationProcessorDeps): |
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
100 apDistNames.append(apd.name) |
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
101 apDistVariableNames.append("$(" + apd.name + "_JAR)") |
22325
f114acdecf70
Update jvmci.make
Roland Schatz <roland.schatz@oracle.com>
parents:
22289
diff
changeset
|
102 apDependencies.append("$(subst $(space),:,$(" + apd.name + "_DEP_JARS))") |
22287
5cce6c398d70
re-introduced partOfHotSpot to JarJDKDeployedDist to fix mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22279
diff
changeset
|
103 shouldExport = dist in jdkDeployedDists |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
104 props = { |
22176
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
105 "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
|
106 "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
|
107 "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
|
108 "depJarsVariable": depJarVariableName, |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
109 "sourceLines": sourceLines, |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
110 "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
|
111 "annotationProcessors": " ".join(apDistVariableNames), |
22325
f114acdecf70
Update jvmci.make
Roland Schatz <roland.schatz@oracle.com>
parents:
22289
diff
changeset
|
112 "cpAnnotationProcessors": ":".join(apDistVariableNames + apDependencies), |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
113 "jarDeps": " ".join(classPath), |
21917
0df6a0cb4b5f
Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21916
diff
changeset
|
114 "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
|
115 } |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
116 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 \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
|
123 """.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
|
124 return |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
125 |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
126 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
127 |
22226
751a0882cb7e
mx makefile: Remove dead code
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22137
diff
changeset
|
128 def do_build_makefile(mf, selectedDists): |
22279
c232a2ea1fd2
rename mx.JDKConfig.jdk to mx.JDKConfig.home
Doug Simon <doug.simon@oracle.com>
parents:
22278
diff
changeset
|
129 jdk = mx.get_jdk() |
c232a2ea1fd2
rename mx.JDKConfig.jdk to mx.JDKConfig.home
Doug Simon <doug.simon@oracle.com>
parents:
22278
diff
changeset
|
130 bootClassPath = jdk.bootclasspath() |
c232a2ea1fd2
rename mx.JDKConfig.jdk to mx.JDKConfig.home
Doug Simon <doug.simon@oracle.com>
parents:
22278
diff
changeset
|
131 bootClassPath = bootClassPath.replace(os.path.realpath(jdk.home), "$(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
|
132 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
|
133 |
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
|
134 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
|
135 |
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
|
136 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
|
137 # 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
|
138 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
|
139 |
22279
c232a2ea1fd2
rename mx.JDKConfig.jdk to mx.JDKConfig.home
Doug Simon <doug.simon@oracle.com>
parents:
22278
diff
changeset
|
140 JAVAC=$(ABS_BOOTDIR)/bin/javac -g -target """ + str(jdk.javaCompliance) + """ |
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
|
141 JAR=$(ABS_BOOTDIR)/bin/jar |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
142 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
143 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
|
144 |
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
|
145 # 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
|
146 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
|
147 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
|
148 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
|
149 |
21955
3ce35131bff2
Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21949
diff
changeset
|
150 JARS = $(foreach dist,$(DISTRIBUTIONS),$($(dist)_JAR)) |
3ce35131bff2
Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21949
diff
changeset
|
151 |
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
|
152 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
|
153 $(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
|
154 endif |
21911
899d7cadd0a1
Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21888
diff
changeset
|
155 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
|
156 QUIETLY=@ |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
157 endif |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
158 |
21919
62da3906ab7f
Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21917
diff
changeset
|
159 # 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
|
160 space := |
62da3906ab7f
Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21917
diff
changeset
|
161 space += |
62da3906ab7f
Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21917
diff
changeset
|
162 |
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
|
163 # 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
|
164 # 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
|
165 # Arguments: |
0df6a0cb4b5f
Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21916
diff
changeset
|
166 # 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
|
167 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
|
168 $(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
|
169 $(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
|
170 $(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
|
171 $(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
|
172 |
21911
899d7cadd0a1
Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21888
diff
changeset
|
173 @# 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
|
174 @# 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
|
175 $(eval vmconfig := $(1)/hotspot/HotSpotVMConfig.inline.hpp) |
22054 | 176 $(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
|
177 $(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
|
178 endef |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
179 |
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
|
180 # Reads the files in jvmci.options/ created by OptionProcessor (the processor for the @Option annotation) |
22054 | 181 # 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
|
182 # 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
|
183 # 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
|
184 # 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
|
185 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
|
186 $(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
|
187 $(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
|
188 $(QUIETLY) test -d $(services) || mkdir -p $(services) |
22054 | 189 $(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
|
190 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
|
191 |
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
|
192 # 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
|
193 # Arguments: |
0df6a0cb4b5f
Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21916
diff
changeset
|
194 # 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
|
195 # 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
|
196 define extract |
21912
1a6a520af3b5
jvmci.make put temp dirs into the target directory
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21911
diff
changeset
|
197 $(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
|
198 $(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
|
199 ((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
|
200 (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
|
201 $(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
|
202 $(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
|
203 endef |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
204 |
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 # 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
|
206 # Arguments: |
0df6a0cb4b5f
Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21916
diff
changeset
|
207 # 1: processorpath |
0df6a0cb4b5f
Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21916
diff
changeset
|
208 # 2: classpath |
0df6a0cb4b5f
Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21916
diff
changeset
|
209 # 3: resources to copy |
0df6a0cb4b5f
Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21916
diff
changeset
|
210 # 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
|
211 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
|
212 $(info Building $(4)) |
21912
1a6a520af3b5
jvmci.make put temp dirs into the target directory
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21911
diff
changeset
|
213 $(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
|
214 $(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
|
215 $(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
|
216 $(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
|
217 $(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
|
218 $(QUIETLY) mkdir -p $(shell dirname $(4)) |
21992
72129dd49bc0
jvmci.make do not compress jars
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21985
diff
changeset
|
219 $(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
|
220 $(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
|
221 endef |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
222 |
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
|
223 # 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
|
224 # 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
|
225 # 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
|
226 # 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
|
227 # 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
|
228 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
|
229 $(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
|
230 $(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
|
231 $(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
|
232 $(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
|
233 $(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
|
234 $(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
|
235 $(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
|
236 $(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
|
237 endef |
62da3906ab7f
Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21917
diff
changeset
|
238 |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
239 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
|
240 \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
|
241 \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
|
242 \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
|
243 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
244 export: all |
21978
f0a982a28944
relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents:
21971
diff
changeset
|
245 \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
|
246 \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
|
247 .PHONY: export |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
248 |
21955
3ce35131bff2
Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21949
diff
changeset
|
249 clean: |
3ce35131bff2
Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21949
diff
changeset
|
250 \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
|
251 \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
|
252 .PHONY: export clean |
3ce35131bff2
Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21949
diff
changeset
|
253 |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
254 """) |
22176
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
255 assert selectedDists |
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
256 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
|
257 dists = [] |
22176
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
258 |
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
259 def _visit(dep, edge): |
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
260 if dep.isDistribution(): |
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
261 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
|
262 |
22176
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
263 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
|
264 |
22176
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
265 mf.add_definition(jdkBootClassPathVariableName + " = " + bootClassPath) |
fb1a9390cdcf
fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents:
22169
diff
changeset
|
266 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
|
267 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
|
268 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
|
269 return True |