Mercurial > hg > graal-jvmci-8
annotate mx/mx_graal_makefile.py @ 21888:878786299d2d
removed trailing slash from directory names in jvmci.make
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 09 Jun 2015 23:00:38 +0200 |
parents | 82d9b136fe5c |
children | 899d7cadd0a1 |
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 # |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
27 import mx, mx_graal, 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): |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
47 """Creates a Makefile which is able to build distributions without mx""" |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
48 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
|
49 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
|
50 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
|
51 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
|
52 |
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 if opts.selectedDists == None or len(opts.selectedDists) == 0: |
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
|
54 opts.selectedDists = [d.name for d in mx_graal._jdkDeployedDists if d.partOfHotSpot] |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
55 mf = Makefile() |
21790
6db6070d30b9
Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21740
diff
changeset
|
56 commandline = " ".join(["mx.sh", "makefile"] + args) |
6db6070d30b9
Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21740
diff
changeset
|
57 if do_build_makefile(mf, opts.selectedDists, commandline): |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
58 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
|
59 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
|
60 print contents |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
61 else: |
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 with open(opts.output, "w") as f: |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
63 f.write(contents) |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
64 |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
65 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
66 def filter_projects(deps, t): |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
67 def typeFilter(project): # filters |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
68 if isinstance(project, str): |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
69 project = mx.dependency(project, True) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
70 return isinstance(project, t) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
71 return [d for d in deps if typeFilter(d)] |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
72 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
73 def get_jdk_deployed_dists(): |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
74 return [d.name for d in mx_graal._jdkDeployedDists] |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
75 |
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
|
76 def update_list(li, elements): |
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
|
77 for e in elements: |
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
|
78 if e not in li: |
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
|
79 li.append(e) |
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
|
80 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
81 def make_dist_rule(dist, mf, bootClassPath=None): |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
82 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
|
83 return os.path.relpath(p, dist.suite.dir) |
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
|
84 def short_dist_name(name): |
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
|
85 return name.replace("COM_ORACLE_", "") |
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
|
86 shortName = short_dist_name(dist.name) |
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() |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
88 jarPath = path_dist_relative(dist.path) |
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
|
89 sourcesVariableName = shortName + "_SRC" |
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
|
90 depJarVariableName = shortName + "_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 = [] |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
93 sortedDeps = dist.sorted_deps(True, transitive=False, includeAnnotationProcessors=True) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
94 projects = filter_projects(sortedDeps, mx.Project) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
95 targetPathPrefix = "$(TARGET)" + os.path.sep |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
96 libraryDeps = [path_dist_relative(l.get_path(False)) for l in filter_projects(sortedDeps, mx.Library)] |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
97 |
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
|
98 annotationProcessorDeps = [] |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
99 distDeps = dist.get_dist_deps(includeSelf=False, transitive=True) |
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
|
100 distDepProjects = [] |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
101 for d in distDeps: |
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
|
102 update_list(distDepProjects, d.sorted_deps(includeLibs=False, transitive=True)) |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
103 |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
104 classPath = [targetPathPrefix + path_dist_relative(d.path) for d in distDeps] + libraryDeps \ |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
105 + [path_dist_relative(mx.dependency(name).path) for name in dist.excludedDependencies] |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
106 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
|
107 if p.definedAnnotationProcessors != None and p.definedAnnotationProcessorsDist != dist: |
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
|
108 update_list(annotationProcessorDeps, [p]) |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
109 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
|
110 projectDir = path_dist_relative(p.dir) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
111 if p not in distDepProjects and p not in annotationProcessorDeps: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
112 generatedSource = [path_dist_relative(p.source_gen_dir())] if len(annotationProcessorDeps) > 0 else [] |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
113 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
114 for d in p.srcDirs + generatedSource: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
115 src = projectDir + os.path.sep + d |
21802
82d9b136fe5c
Escape find filename pattern, as it would be expanded if there exists a *.java file in the working directory. (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21798
diff
changeset
|
116 sources.append("$(shell find {} -type f -name '*.java' 2> /dev/null)".format(src)) |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
117 metaInf = src + os.path.sep + "META-INF" |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
118 if os.path.exists(metaInf): |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
119 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
|
120 |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
121 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
122 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
|
123 apPaths = [] |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
124 apDistNames = [] |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
125 apDistVariableNames = [] |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
126 for p in annotationProcessorDeps: |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
127 apPaths.append(path_dist_relative(p.definedAnnotationProcessorsDist.path)) |
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
|
128 name = short_dist_name(p.definedAnnotationProcessorsDist.name) |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
129 apDistNames.append(name) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
130 apDistVariableNames.append("$(" + name + "_JAR)") |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
131 shouldExport = dist.name in jdkDeployedDists |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
132 props = { |
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
|
133 "name": shortName, |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
134 "jarPath": targetPathPrefix + jarPath, |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
135 "depends": "", |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
136 "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
|
137 "depJarsVariable": depJarVariableName, |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
138 "sourceLines": sourceLines, |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
139 "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
|
140 "annotationProcessors": " ".join(apDistVariableNames), |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
141 "cpAnnotationProcessors": "-processorpath " + ":".join(apDistVariableNames) if len(apDistVariableNames) > 0 else "", |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
142 "bootCp": ("-bootclasspath " + bootClassPath) if bootClassPath != None else "", |
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
|
143 "cpDeps": ("-cp $(shell echo $(" + depJarVariableName + ") | tr ' ' ':')") if len(classPath) > 0 else "", |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
144 "jarDeps": " ".join(classPath), |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
145 "copyResources": "cp -r {} $(TMP)".format(" ".join(resources)) if len(resources) > 0 else "", |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
146 "targetPathPrefix": targetPathPrefix, |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
147 "shouldExport": shouldExport, |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
148 } |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
149 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
150 mf.add_definition(sourceLines) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
151 mf.add_definition("{name}_JAR = {jarPath}".format(**props)) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
152 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
|
153 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
|
154 mf.add_rule("""$({name}_JAR): $({sourcesVariableName}) {annotationProcessors} {depJarsVariableAccess} |
21739
73809f97c281
Provide a pattern for mktemp (Required on Mac)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21718
diff
changeset
|
155 \t$(eval TMP := $(shell mktemp -d {name}_XXXXX)) |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
156 \t$(JAVAC) -d $(TMP) {cpAnnotationProcessors} {bootCp} {cpDeps} $({sourcesVariableName}) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
157 \t{copyResources} |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
158 \t$(call process_options,$(TMP),{shouldExport}) |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
159 \tmkdir -p $$(dirname $({name}_JAR)) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
160 \t$(JAR) cf $({name}_JAR) -C $(TMP) . |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
161 \trm -r $(TMP)""".format(**props)) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
162 return |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
163 |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
164 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
165 |
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
|
166 def do_build_makefile(mf, selectedDists, commandline): |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
167 java = mx.java() |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
168 bootClassPath = java.bootclasspath() |
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
|
169 bootClassPath = bootClassPath.replace(java.jdk, "$(ABS_BOOTDIR)") |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
170 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
|
171 |
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
|
172 mf.add_definition("""# This Makefile is generated automatically, do not edit |
21797
42452d2dfbec
removed MX_TARGET; replace VERBOSE with MAKE_VERBOSE
Doug Simon <doug.simon@oracle.com>
parents:
21793
diff
changeset
|
173 # This file was built with the command: """ + commandline + """ |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
174 |
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
|
175 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
|
176 # 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
|
177 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
|
178 |
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
|
179 JAVAC=$(ABS_BOOTDIR)/bin/javac -g -target """ + str(java.javaCompliance) + """ |
6db6070d30b9
Make jvmci.make stable; add header for building the jvmci.make; default to use the jvmci.make file when running mx.build
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21740
diff
changeset
|
180 JAR=$(ABS_BOOTDIR)/bin/jar |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
181 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
182 EXPORTED_FILES_ADDITIONAL=$(TARGET)/options $(TARGET)/services |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
183 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
|
184 |
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
|
185 # Directories, where the generated property-files reside within the JAR files |
21888
878786299d2d
removed trailing slash from directory names in jvmci.make
Doug Simon <doug.simon@oracle.com>
parents:
21802
diff
changeset
|
186 PROVIDERS_INF=/META-INF/providers |
878786299d2d
removed trailing slash from directory names in jvmci.make
Doug Simon <doug.simon@oracle.com>
parents:
21802
diff
changeset
|
187 SERVICES_INF=/META-INF/services |
878786299d2d
removed trailing slash from directory names in jvmci.make
Doug Simon <doug.simon@oracle.com>
parents:
21802
diff
changeset
|
188 OPTIONS_INF=/META-INF/options |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
189 |
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
|
190 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
|
191 $(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
|
192 endif |
21797
42452d2dfbec
removed MX_TARGET; replace VERBOSE with MAKE_VERBOSE
Doug Simon <doug.simon@oracle.com>
parents:
21793
diff
changeset
|
193 ifneq ($(MAKE_VERBOSE),) |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
194 SHELL=sh -x |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
195 endif |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
196 |
21793
44bad469bec2
Create DEST_SUBDIR when doing install_jvm (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21790
diff
changeset
|
197 define process_options |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
198 $(eval providers=$(1)/$(PROVIDERS_INF)) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
199 $(eval services=$(1)/$(SERVICES_INF)) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
200 $(eval options=$(1)/$(OPTIONS_INF)) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
201 test -d $(services) || mkdir -p $(services) |
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
|
202 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
|
203 |
21797
42452d2dfbec
removed MX_TARGET; replace VERBOSE with MAKE_VERBOSE
Doug Simon <doug.simon@oracle.com>
parents:
21793
diff
changeset
|
204 # Since all projects are built together with one javac call we cannot determine |
42452d2dfbec
removed MX_TARGET; replace VERBOSE with MAKE_VERBOSE
Doug Simon <doug.simon@oracle.com>
parents:
21793
diff
changeset
|
205 # which project contains HotSpotVMConfig.inline.hpp so we hardcode it. |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
206 $(eval vmconfig=$(1)/hotspot/HotSpotVMConfig.inline.hpp) |
21798
395ac43a8578
moved JVMCI sources from graal/ to jvmci/ directory
Doug Simon <doug.simon@oracle.com>
parents:
21797
diff
changeset
|
207 $(eval vmconfigDest=$(HS_COMMON_SRC)/../jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot) |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
208 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
|
209 endef |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
210 |
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 |
21739
73809f97c281
Provide a pattern for mktemp (Required on Mac)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21718
diff
changeset
|
212 $(eval TMP := $(shell mktemp -d $(1)_XXXXX)) |
21793
44bad469bec2
Create DEST_SUBDIR when doing install_jvm (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21790
diff
changeset
|
213 mkdir -p $(2); |
21888
878786299d2d
removed trailing slash from directory names in jvmci.make
Doug Simon <doug.simon@oracle.com>
parents:
21802
diff
changeset
|
214 cd $(TMP) && $(JAR) xf $(abspath $(1)) && \\ |
21793
44bad469bec2
Create DEST_SUBDIR when doing install_jvm (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21790
diff
changeset
|
215 ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) && (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2)))); |
44bad469bec2
Create DEST_SUBDIR when doing install_jvm (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21790
diff
changeset
|
216 rm -r $(TMP); |
44bad469bec2
Create DEST_SUBDIR when doing install_jvm (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21790
diff
changeset
|
217 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
|
218 endef |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
219 |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
220 |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
221 all: default |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
222 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
223 export: all |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
224 \tmkdir -p $(EXPORT_DIR) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
225 \t$(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(EXPORT_DIR))) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
226 .PHONY: export |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
227 |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
228 """) |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
229 s = mx.suite("graal") |
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
|
230 dists = [] |
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
|
231 ap = [] |
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
|
232 projects = [] |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
233 for d in s.dists: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
234 if d.name 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
|
235 update_list(dists, d.get_dist_deps(True, True)) |
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
|
236 update_list(projects, d.sorted_deps(includeLibs=False, transitive=True)) |
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
|
237 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
238 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
|
239 deps = p.all_deps([], False, includeSelf=True, includeJreLibs=False, includeAnnotationProcessors=True) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
240 for d in deps: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
241 if d.definedAnnotationProcessorsDist != None: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
242 apd = d.definedAnnotationProcessorsDist |
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
|
243 update_list(ap, [apd]) |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
244 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
245 if len(dists) > 0: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
246 mf.add_definition(jdkBootClassPathVariableName + " = " + bootClassPath) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
247 bootClassPathVarAccess = "$(" + jdkBootClassPathVariableName + ")" |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
248 for d in ap: make_dist_rule(d, mf, bootClassPathVarAccess) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
249 for d in dists: make_dist_rule(d, mf, bootClassPathVarAccess) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
250 mf.add_rule("default: $({}_JAR)\n.PHONY: default".format("_JAR) $(".join([d.name for d in dists]))) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
251 return True |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
252 else: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
253 for d in dists: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
254 selectedDists.remove(d.name) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
255 print "Distribution(s) '" + "', '".join(selectedDists) + "' does not exist." |