annotate mx.jvmci/mx_jvmci_makefile.py @ 22680:1179ab4c25fa

Disable instruction scheduling in cpCache.o on SPARC/Linux
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Tue, 13 Oct 2015 17:59:52 +0200
parents 1bbd4a7c274b
children a130b51efb07
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:
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
22426
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
72 def _get_dependency_check(p):
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
73 jarFinders = []
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
74 for dep in p.deps:
22427
9c55f608b79e Generate jvmci.make with all defined dependencies/bootclasspath regardless availability in the current enviornment
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22426
diff changeset
75 jar = None
9c55f608b79e Generate jvmci.make with all defined dependencies/bootclasspath regardless availability in the current enviornment
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22426
diff changeset
76 if dep.isJreLibrary() and dep.optional:
9c55f608b79e Generate jvmci.make with all defined dependencies/bootclasspath regardless availability in the current enviornment
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22426
diff changeset
77 jar = dep.jar
9c55f608b79e Generate jvmci.make with all defined dependencies/bootclasspath regardless availability in the current enviornment
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22426
diff changeset
78 if dep.isJdkLibrary() and dep.optional:
9c55f608b79e Generate jvmci.make with all defined dependencies/bootclasspath regardless availability in the current enviornment
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22426
diff changeset
79 jar = dep.path
9c55f608b79e Generate jvmci.make with all defined dependencies/bootclasspath regardless availability in the current enviornment
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22426
diff changeset
80 if jar:
22426
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
81 jarFinders.append("$(shell find $(ABS_BOOTDIR)/ -name '%s'; echo $$?)" % jar)
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
82 return "ifeq ({},'{}')".format("".join(jarFinders), "0" * len(jarFinders)) if len(jarFinders) > 0 else None
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
83
21917
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
84 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
85 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
86 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
87 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
88 jarName = os.path.basename(dist.path)
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
89 sourcesVariableName = dist.name + "_SRC"
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
90 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
91 sources = []
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
92 resources = []
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
93 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
94 targetPathPrefix = "$(TARGET)/"
22289
26e2a05f8d95 fixed mx_jvmci_makefile to use mx.classpath_entries()
Doug Simon <doug.simon@oracle.com>
parents: 22287
diff changeset
95 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
96
22289
26e2a05f8d95 fixed mx_jvmci_makefile to use mx.classpath_entries()
Doug Simon <doug.simon@oracle.com>
parents: 22287
diff changeset
97 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
98 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
99 projectDir = path_dist_relative(p.dir)
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
100 annotationProcessorDeps.update(p.declaredAnnotationProcessors)
22427
9c55f608b79e Generate jvmci.make with all defined dependencies/bootclasspath regardless availability in the current enviornment
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22426
diff changeset
101 depCheck = _get_dependency_check(p)
22426
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
102 if depCheck:
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
103 sources.append(depCheck)
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
104 for src in [projectDir + '/' + d for d in p.srcDirs]:
22426
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
105 sources.append(sourcesVariableName + " += $(shell find {} -type f 2> /dev/null)".format(src))
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
106 metaInf = src + "/META-INF"
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
107 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
108 resources.append(metaInf)
22426
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
109 if depCheck:
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
110 sources.append("endif")
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
111
22426
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
112 mf.add_definition("\n".join(sources))
f45c8b5add13 Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22398
diff changeset
113
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
114 apDistNames = []
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
115 apDistVariableNames = []
22325
f114acdecf70 Update jvmci.make
Roland Schatz <roland.schatz@oracle.com>
parents: 22289
diff changeset
116 apDependencies = []
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
117 for apd in sorted(annotationProcessorDeps):
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
118 apDistNames.append(apd.name)
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
119 apDistVariableNames.append("$(" + apd.name + "_JAR)")
22325
f114acdecf70 Update jvmci.make
Roland Schatz <roland.schatz@oracle.com>
parents: 22289
diff changeset
120 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
121 shouldExport = dist in jdkDeployedDists
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
122 props = {
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
123 "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
124 "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
125 "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
126 "depJarsVariable": depJarVariableName,
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
127 "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
128 "annotationProcessors": " ".join(apDistVariableNames),
22325
f114acdecf70 Update jvmci.make
Roland Schatz <roland.schatz@oracle.com>
parents: 22289
diff changeset
129 "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
130 "jarDeps": " ".join(classPath),
21917
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
131 "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
132 }
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
133
22082
4ce725f06a27 jvmci.make intermediate output is now flattened into build/jvmci.make
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
134 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
135 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
136 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
137 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
138 \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
139 """.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
140 return
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
141
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
22226
751a0882cb7e mx makefile: Remove dead code
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22137
diff changeset
144 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
145 jdk = mx.get_jdk()
22427
9c55f608b79e Generate jvmci.make with all defined dependencies/bootclasspath regardless availability in the current enviornment
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22426
diff changeset
146 bootClassPath = jdk.bootclasspath(filtered=False)
22279
c232a2ea1fd2 rename mx.JDKConfig.jdk to mx.JDKConfig.home
Doug Simon <doug.simon@oracle.com>
parents: 22278
diff changeset
147 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
148 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
149
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
150 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
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 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
153 # 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
154 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
155
22279
c232a2ea1fd2 rename mx.JDKConfig.jdk to mx.JDKConfig.home
Doug Simon <doug.simon@oracle.com>
parents: 22278
diff changeset
156 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
157 JAR=$(ABS_BOOTDIR)/bin/jar
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
158
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
159 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
160
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
161 # 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
162 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
163 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
164 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
165
21955
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
166 JARS = $(foreach dist,$(DISTRIBUTIONS),$($(dist)_JAR))
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
167
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
168 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
169 $(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
170 endif
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
171 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
172 QUIETLY=@
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
173 endif
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
174
21919
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
175 # 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
176 space :=
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
177 space +=
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
178
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
179 # 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
180 # 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
181 # Arguments:
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
182 # 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
183 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
184 $(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
185 $(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
186 $(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
187 $(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
188
21911
899d7cadd0a1 Make jvmci.make quiet and use recipe for build and jar
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21888
diff changeset
189 @# 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
190 @# 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
191 $(eval vmconfig := $(1)/hotspot/HotSpotVMConfig.inline.hpp)
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22618
diff changeset
192 $(eval vmconfigDest := $(HS_COMMON_SRC)/../mxbuild/jvmci/jdk.vm.ci.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
193 $(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
194 endef
a3315bce5192 Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21504
diff changeset
195
22512
1852abfbaca3 removed use of intermediate jvmci.options/ directory to create OptionDescriptors service files
Doug Simon <doug.simon@oracle.com>
parents: 22427
diff changeset
196 # Finds the *_OptionsDescriptors classes created by OptionProcessor (the processor for the @Option annotation)
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22618
diff changeset
197 # and appends their names to services/jdk.vm.ci.options.OptionDescriptors.
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
198 # 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
199 # 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
200 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
201 $(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
202 $(QUIETLY) test -d $(services) || mkdir -p $(services)
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22618
diff changeset
203 $(eval optionDescriptors := $(1)/META-INF/services/jdk.vm.ci.options.OptionDescriptors)
22512
1852abfbaca3 removed use of intermediate jvmci.options/ directory to create OptionDescriptors service files
Doug Simon <doug.simon@oracle.com>
parents: 22427
diff changeset
204 $(QUIETLY) cd $(1) && for i in $$(find . -name '*_OptionDescriptors.class' 2>/dev/null); do echo $${i} | sed 's:\\./\\(.*\\)\\.class:\\1:g' | tr '/' '.' >> $(abspath $(optionDescriptors)); 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
205 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
206
22398
4f6caa445b92 moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents: 22325
diff changeset
207 # Extracts META-INF/jvmci.services from 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
208 # Arguments:
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
209 # 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
210 # 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
211 define extract
21912
1a6a520af3b5 jvmci.make put temp dirs into the target directory
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21911
diff changeset
212 $(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
213 $(QUIETLY) cd $(TMP) && $(JAR) xf $(abspath $(1)) && \\
22398
4f6caa445b92 moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents: 22325
diff changeset
214 (test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_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
215 $(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
216 $(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
217 endef
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
218
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
219 # 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
220 # Arguments:
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
221 # 1: processorpath
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
222 # 2: classpath
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
223 # 3: resources to copy
0df6a0cb4b5f Cleanup code in mx_graal_makefile.py, add comments
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21916
diff changeset
224 # 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
225 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
226 $(info Building $(4))
21912
1a6a520af3b5 jvmci.make put temp dirs into the target directory
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21911
diff changeset
227 $(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
228 $(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
229 $(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
230 $(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
231 $(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
232 $(QUIETLY) mkdir -p $(shell dirname $(4))
21992
72129dd49bc0 jvmci.make do not compress jars
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21985
diff changeset
233 $(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
234 $(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
235 endef
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
236
22398
4f6caa445b92 moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents: 22325
diff changeset
237 # Verifies that make/defs.make contains an appropriate line for each JVMCI service
4f6caa445b92 moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents: 22325
diff changeset
238 # and that only existing JVMCI services are exported.
21947
e701664f4168 Add parameter description to jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21919
diff changeset
239 # Arguments:
22398
4f6caa445b92 moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents: 22325
diff changeset
240 # 1: list of service files
4f6caa445b92 moved JVMCI option parsing back into Java
Doug Simon <doug.simon@oracle.com>
parents: 22325
diff changeset
241 # 2: variable name for directory of service 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
242 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
243 $(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
244 $(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
245 $(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
246 $(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
247 $(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
248 $(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
249 $(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
250 $(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
251 endef
62da3906ab7f Do not make builds in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21917
diff changeset
252
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
253 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
254 \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
255 \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
256 \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
257
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
258 export: all
21978
f0a982a28944 relax verify_defs_make in jvmci.make for conditional exports
Doug Simon <doug.simon@oracle.com>
parents: 21971
diff changeset
259 \t$(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.services/*)),EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)
21718
b5bbf03bc17a Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21717
diff changeset
260 .PHONY: export
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
261
21955
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
262 clean:
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
263 \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
264 \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
265 .PHONY: export clean
3ce35131bff2 Introduce clean target in jvmci.make
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 21949
diff changeset
266
21488
6420ac0cbe3c Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff changeset
267 """)
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
268 assert selectedDists
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
269 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
270 dists = []
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
271
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
272 def _visit(dep, edge):
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
273 if dep.isDistribution():
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
274 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
275
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
276 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
277
22176
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
278 mf.add_definition(jdkBootClassPathVariableName + " = " + bootClassPath)
fb1a9390cdcf fixed mx_jvmci_makefile.py
Doug Simon <doug.simon@oracle.com>
parents: 22169
diff changeset
279 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
280 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
281 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
282 return True