Mercurial > hg > graal-jvmci-8
annotate mx/mx_graal_makefile.py @ 21741:b6ee5d3f3255
Exclude distributions from exporting which are delivered with HotSpot (JBS:GRAAL-52)
author | Stefan Anzinger <stefan.anzinger@oracle.com> |
---|---|
date | Fri, 05 Jun 2015 13:04:40 +0200 |
parents | 6c3c21d9b5ef |
children | 6db6070d30b9 |
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) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
51 args = 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 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
53 if args.selectedDists == None or len(args.selectedDists) == 0: |
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
|
54 args.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() |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
56 if do_build_makefile(mf, args.selectedDists): |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
57 contents = mf.generate() |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
58 if args.output == None: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
59 print contents |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
60 else: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
61 with open(args.output, "w") as f: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
62 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
|
63 |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
64 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
65 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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
72 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
|
73 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
|
74 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
75 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
|
76 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
|
77 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
|
78 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
|
79 jarPath = path_dist_relative(dist.path) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
80 sourcesVariableName = dist.name + "_SRC" |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
81 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
|
82 sources = [] |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
83 resources = [] |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 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
|
88 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
89 annotationProcessorDeps = set() |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
90 distDeps = dist.get_dist_deps(includeSelf=False, transitive=True) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
91 distDepProjects = set() |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
92 for d in distDeps: |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
93 distDepProjects.update(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
|
94 |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
95 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
|
96 + [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
|
97 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
|
98 if p.definedAnnotationProcessors != None and p.definedAnnotationProcessorsDist != dist: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
99 annotationProcessorDeps.add(p) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
100 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
|
101 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
|
102 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
|
103 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
|
104 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
105 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
|
106 src = projectDir + os.path.sep + d |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
107 sources.append("$(shell find {} -type f -name *.java 2> /dev/null)".format(src)) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
108 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
|
109 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
|
110 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
|
111 |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
112 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
113 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
|
114 apPaths = [] |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
115 apDistNames = [] |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
116 apDistVariableNames = [] |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
117 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
|
118 apPaths.append(path_dist_relative(p.definedAnnotationProcessorsDist.path)) |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
119 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
|
120 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
|
121 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
|
122 shouldExport = dist.name in jdkDeployedDists |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
123 props = { |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
124 "name": dist.name, |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
125 "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
|
126 "depends": "", |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
127 "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
|
128 "depJarsVariable": depJarVariableName, |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
129 "sourceLines": sourceLines, |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
130 "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
|
131 "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
|
132 "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
|
133 "bootCp": ("-bootclasspath " + bootClassPath) if bootClassPath != None else "", |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
134 "cpDeps": ("-cp " + ":".join(classPath)) 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
|
135 "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
|
136 "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
|
137 "targetPathPrefix": targetPathPrefix, |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
138 "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
|
139 } |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
140 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
141 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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 \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
|
147 \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
|
148 \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
|
149 \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
|
150 \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
|
151 \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
|
152 \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
|
153 return |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
154 |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
155 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
156 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
157 def do_build_makefile(mf, selectedDists): |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
158 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
|
159 bootClassPath = java.bootclasspath() |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
160 bootClassPath = bootClassPath.replace(java.jdk, "$(JDK)") |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
161 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
|
162 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
163 mf.add_definition("""VERBOSE= |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
164 TARGET=. |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
165 JDK= |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
166 |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
167 WGET=wget |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
168 JAVAC=$(JDK)/bin/javac -g -target """ + str(java.javaCompliance) + """ |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
169 JAR=$(JDK)/bin/jar |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
170 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
171 EXPORT_DIR=export |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
172 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
|
173 HS_COMMON_SRC=. |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
174 # where all other stuff built by mx (graal.jar) resides |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
175 MX_TARGET=. |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
176 PROVIDERS_INF=/META-INF/providers/ |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
177 SERVICES_INF=/META-INF/services/ |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
178 OPTIONS_INF=/META-INF/options/ |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
179 |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
180 ifeq ($(JDK),) |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
181 $(error Variable JDK must be set to a JDK installation.) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
182 endif |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
183 ifneq ($(VERBOSE),) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
184 SHELL=sh -x |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
185 endif |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
186 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
187 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
|
188 $(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
|
189 $(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
|
190 $(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
|
191 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
|
192 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
|
193 |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
194 # We're building all projects together with one javac call; thus we cannot determine, from which project the generated file is thus we hardcode it for now |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
195 $(eval vmconfig=$(1)/hotspot/HotSpotVMConfig.inline.hpp) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
196 $(eval vmconfigDest=$(HS_COMMON_SRC)/../graal/com.oracle.jvmci.hotspot/src_gen/hotspot) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
197 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
|
198 endef |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
199 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
200 define extract = |
21739
73809f97c281
Provide a pattern for mktemp (Required on Mac)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21718
diff
changeset
|
201 $(eval TMP := $(shell mktemp -d $(1)_XXXXX)) |
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 mkdir -p $(2) |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
203 cd $(TMP) && $(JAR) xf $(abspath $(1)) && \ |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
204 ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) && (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2)))) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
205 rm -r $(TMP) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
206 cp $(1) $(2) |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
207 endef |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
208 |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
209 |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
210 all: default |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
211 |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
212 export: all |
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
213 \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
|
214 \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
|
215 .PHONY: export |
21488
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
216 |
6420ac0cbe3c
Add Makefile generator for building graal without mx
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
217 """) |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
218 s = mx.suite("graal") |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
219 dists = set() |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
220 ap = set() |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
221 projects = set() |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
222 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
|
223 if d.name in selectedDists: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
224 dists.update(d.get_dist_deps(True, True)) |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
225 projects.update(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
|
226 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
227 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
|
228 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
|
229 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
|
230 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
|
231 apd = d.definedAnnotationProcessorsDist |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
232 ap.add(apd) |
21718
b5bbf03bc17a
Improve makefile generator, exporting files into shared dir (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21717
diff
changeset
|
233 |
21717
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
234 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
|
235 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
|
236 bootClassPathVarAccess = "$(" + jdkBootClassPathVariableName + ")" |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
237 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
|
238 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
|
239 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
|
240 return True |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
241 else: |
a3315bce5192
Change makefile generator to produce human readable code (JBS:GRAAL-52)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
21504
diff
changeset
|
242 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
|
243 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
|
244 print "Distribution(s) '" + "', '".join(selectedDists) + "' does not exist." |