/
makefile
755 lines (628 loc) · 19.9 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
MAKEFLAGS = -s
name = avian
version = 0.3
build-arch := $(shell uname -m | sed 's/^i.86$$/i386/' | sed 's/^arm.*$$/arm/')
ifeq (Power,$(filter Power,$(build-arch)))
build-arch = powerpc
endif
build-platform := \
$(shell uname -s | tr [:upper:] [:lower:] \
| sed 's/^mingw32.*$$/mingw32/' \
| sed 's/^cygwin.*$$/cygwin/')
arch = $(build-arch)
bootimage-platform = \
$(subst cygwin,windows,$(subst mingw32,windows,$(build-platform)))
platform = $(bootimage-platform)
mode = fast
process = compile
ifneq ($(process),compile)
options := -$(process)
endif
ifneq ($(mode),fast)
options := $(options)-$(mode)
endif
ifeq ($(bootimage),true)
options := $(options)-bootimage
endif
ifeq ($(heapdump),true)
options := $(options)-heapdump
endif
ifeq ($(tails),true)
options := $(options)-tails
endif
ifeq ($(continuations),true)
options := $(options)-continuations
endif
classpath = avian
test-library-path = .
test-executable = $(executable)
ifdef gnu
classpath = gnu
options := $(options)-gnu
classapth-jar = $(gnu)/share/classpath/glibj.zip
classpath-libraries = \
$(gnu)/lib/classpath/libjavaio.a \
$(gnu)/lib/classpath/libjavalang.a \
$(gnu)/lib/classpath/libjavalangreflect.a \
$(gnu)/lib/classpath/libjavamath.a \
$(gnu)/lib/classpath/libjavanet.a \
$(gnu)/lib/classpath/libjavanio.a \
$(gnu)/lib/classpath/libjavautil.a
classpath-cflags = -DBOOT_BUILTINS=\"javaio,javalang,javalangreflect,javamath,javanet,javanio,javautil\" -DAVIAN_GNU
classpath-lflags = -lgmp
endif
ifdef openjdk
classpath = openjdk
options := $(options)-openjdk
ifeq ($(arch),x86_64)
openjdk-lib-dir = $(openjdk)/jre/lib/amd64
else
openjdk-lib-dir = $(openjdk)/jre/lib
endif
classpath-jar = $(openjdk)/jre/lib/rt.jar
test-library-path = $(openjdk-lib-dir):$(native-build)
test-executable = $(executable-dynamic)
endif
root := $(shell (cd .. && pwd))
build = build
native-build = $(build)/$(platform)-$(arch)$(options)
classpath-build = $(build)/classpath
test-build = $(build)/test
src = src
classpath-src = classpath
test = test
ifneq ($(classpath),avian)
classpath-object-dep = $(build)/classpath-object.dep
classpath-objects = $(shell find $(build)/classpath-objects -name "*.o")
else
jni-sources := $(shell find $(classpath-src) -name '*.cpp')
jni-objects = \
$(call cpp-objects,$(jni-sources),$(classpath-src),$(native-build))
endif
input = List
build-cxx = g++
build-cc = gcc
mflag =
ifneq ($(platform),darwin)
ifeq ($(arch),i386)
mflag = -m32
endif
ifeq ($(arch),x86_64)
mflag = -m64
endif
endif
cxx = $(build-cxx) $(mflag)
cc = $(build-cc) $(mflag)
ar = ar
ranlib = ranlib
dlltool = dlltool
vg = nice valgrind --num-callers=32 --db-attach=yes --freelist-vol=100000000
vg += --leak-check=full --suppressions=valgrind.supp
db = gdb --args
javac = "$(JAVA_HOME)/bin/javac"
jar = "$(JAVA_HOME)/bin/jar"
strip = strip
strip-all = --strip-all
rdynamic = -rdynamic
# note that we suppress the non-virtual-dtor warning because we never
# use the delete operator, which means we don't need virtual
# destructors:
warnings = -Wall -Wextra -Werror -Wunused-parameter -Winit-self \
-Wno-non-virtual-dtor
common-cflags = $(warnings) -fno-rtti -fno-exceptions -fno-omit-frame-pointer \
"-I$(JAVA_HOME)/include" -idirafter $(src) -I$(native-build) \
-D__STDC_LIMIT_MACROS -D_JNI_IMPLEMENTATION_ -DAVIAN_VERSION=\"$(version)\" \
-DUSE_ATOMIC_OPERATIONS $(classpath-cflags)
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
"-I$(JAVA_HOME)/include/linux" -I$(src) -pthread
cflags = $(build-cflags)
common-lflags = -lm -lz $(classpath-lflags)
build-lflags =
lflags = $(common-lflags) -lpthread -ldl
system = posix
asm = x86
pointer-size = 8
so-prefix = lib
so-suffix = .so
shared = -shared
native-path = echo
ifeq ($(arch),i386)
pointer-size = 4
endif
ifeq ($(arch),powerpc)
asm = powerpc
pointer-size = 4
endif
ifeq ($(arch),arm)
asm = arm
pointer-size = 4
endif
ifeq ($(platform),darwin)
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden -I$(src)
lflags = $(common-lflags) -ldl -framework CoreFoundation -framework CoreServices
ifeq ($(bootimage),true)
bootimage-lflags = -Wl,-segprot,__RWX,rwx,rwx
endif
rdynamic =
strip-all = -S -x
so-suffix = .jnilib
shared = -dynamiclib
ifeq ($(arch),powerpc)
cflags += -arch ppc
asmflags += -arch ppc
lflags += -arch ppc
endif
ifeq ($(arch),i386)
cflags += -arch i386
asmflags += -arch i386
lflags += -arch i386
endif
ifeq ($(arch),x86_64)
cflags += -arch x86_64
asmflags += -arch x86_64
lflags += -arch x86_64
endif
endif
ifeq ($(platform),windows)
inc = "$(root)/win32/include"
lib = "$(root)/win32/lib"
system = windows
so-prefix =
so-suffix = .dll
exe-suffix = .exe
lflags = -L$(lib) $(common-lflags) -lws2_32 -mwindows -mconsole
cflags = -I$(inc) $(common-cflags)
ifeq (,$(filter mingw32 cygwin,$(build-platform)))
cxx = i586-mingw32msvc-g++
cc = i586-mingw32msvc-gcc
dlltool = i586-mingw32msvc-dlltool
ar = i586-mingw32msvc-ar
ranlib = i586-mingw32msvc-ranlib
strip = i586-mingw32msvc-strip
else
common-cflags += "-I$(JAVA_HOME)/include/win32"
build-cflags = $(common-cflags) -I$(src) -mthreads
ifeq ($(build-platform),cygwin)
build-lflags += -mno-cygwin
build-cflags += -mno-cygwin
lflags += -mno-cygwin
cflags += -mno-cygwin
native-path = cygpath -m
endif
endif
ifeq ($(arch),x86_64)
cxx = x86_64-w64-mingw32-g++ $(mflag)
cc = x86_64-w64-mingw32-gcc $(mflag)
dlltool = x86_64-w64-mingw32-dlltool
ar = x86_64-w64-mingw32-ar
ranlib = x86_64-w64-mingw32-ranlib
strip = x86_64-w64-mingw32-strip
inc = "$(root)/win64/include"
lib = "$(root)/win64/lib"
endif
endif
ifeq ($(mode),debug)
cflags += -O0 -g3
strip = :
endif
ifeq ($(mode),debug-fast)
cflags += -O0 -g3 -DNDEBUG
strip = :
endif
ifeq ($(mode),stress)
cflags += -O0 -g3 -DVM_STRESS
strip = :
endif
ifeq ($(mode),stress-major)
cflags += -O0 -g3 -DVM_STRESS -DVM_STRESS_MAJOR
strip = :
endif
ifeq ($(mode),fast)
cflags += -O3 -g3 -DNDEBUG
endif
ifeq ($(mode),small)
cflags += -Os -g3 -DNDEBUG
endif
ifneq ($(platform),darwin)
ifeq ($(arch),i386)
# this is necessary to support __sync_bool_compare_and_swap:
cflags += -march=i486
endif
endif
output = -o $(1)
as := $(cc)
ld := $(cc)
build-ld := $(build-cc)
ifdef msvc
windows-java-home := $(shell cygpath -m "$(JAVA_HOME)")
zlib := $(shell cygpath -m "$(root)/win32/msvc")
cxx = "$(msvc)/BIN/cl.exe"
cc = $(cxx)
ld = "$(msvc)/BIN/link.exe"
mt = "mt.exe"
cflags = -nologo -DAVIAN_VERSION=\"$(version)\" -D_JNI_IMPLEMENTATION_ \
-DUSE_ATOMIC_OPERATIONS \
-Fd$(native-build)/$(name).pdb -I"$(zlib)/include" -I$(src) \
-I"$(native-build)" -I"$(windows-java-home)/include" \
-I"$(windows-java-home)/include/win32"
shared = -dll
lflags = -nologo -LIBPATH:"$(zlib)/lib" -DEFAULTLIB:ws2_32 \
-DEFAULTLIB:zlib -MANIFEST -debug
output = -Fo$(1)
ifeq ($(mode),debug)
cflags += -Od -Zi -MDd
endif
ifeq ($(mode),debug-fast)
cflags += -Od -Zi -DNDEBUG
endif
ifeq ($(mode),fast)
cflags += -O2 -GL -Zi -DNDEBUG
lflags += -LTCG
endif
ifeq ($(mode),small)
cflags += -O1s -Zi -GL -DNDEBUG
lflags += -LTCG
endif
strip = :
endif
cpp-objects = $(foreach x,$(1),$(patsubst $(2)/%.cpp,$(3)/%.o,$(x)))
asm-objects = $(foreach x,$(1),$(patsubst $(2)/%.S,$(3)/%-asm.o,$(x)))
java-classes = $(foreach x,$(1),$(patsubst $(2)/%.java,$(3)/%.class,$(x)))
generated-code = \
$(native-build)/type-enums.cpp \
$(native-build)/type-declarations.cpp \
$(native-build)/type-constructors.cpp \
$(native-build)/type-initializations.cpp \
$(native-build)/type-java-initializations.cpp
vm-depends := $(generated-code) $(wildcard $(src)/*.h)
vm-sources = \
$(src)/$(system).cpp \
$(src)/finder.cpp \
$(src)/machine.cpp \
$(src)/util.cpp \
$(src)/heap.cpp \
$(src)/$(process).cpp \
$(src)/classpath-$(classpath).cpp \
$(src)/builtin.cpp \
$(src)/jnienv.cpp \
$(src)/process.cpp
vm-asm-sources = $(src)/$(asm).S
ifeq ($(process),compile)
vm-depends += \
$(src)/compiler.h \
$(src)/vector.h
vm-sources += \
$(src)/compiler.cpp \
$(src)/$(asm).cpp
vm-asm-sources += $(src)/compile-$(asm).S
endif
vm-cpp-objects = $(call cpp-objects,$(vm-sources),$(src),$(native-build))
vm-asm-objects = $(call asm-objects,$(vm-asm-sources),$(src),$(native-build))
vm-objects = $(vm-cpp-objects) $(vm-asm-objects)
heapwalk-sources = $(src)/heapwalk.cpp
heapwalk-objects = \
$(call cpp-objects,$(heapwalk-sources),$(src),$(native-build))
ifeq ($(heapdump),true)
vm-sources += $(src)/heapdump.cpp
vm-heapwalk-objects = $(heapwalk-objects)
cflags += -DAVIAN_HEAPDUMP
endif
ifeq ($(tails),true)
cflags += -DAVIAN_TAILS
endif
ifeq ($(continuations),true)
cflags += -DAVIAN_CONTINUATIONS
asmflags += -DAVIAN_CONTINUATIONS
endif
bootimage-generator-sources = $(src)/bootimage.cpp
bootimage-generator-objects = \
$(call cpp-objects,$(bootimage-generator-sources),$(src),$(native-build))
bootimage-generator = \
$(build)/$(bootimage-platform)-$(build-arch)$(options)/bootimage-generator
bootimage-bin = $(native-build)/bootimage.bin
bootimage-object = $(native-build)/bootimage-bin.o
ifeq ($(bootimage),true)
ifneq ($(build-arch),$(arch))
$(error "bootimage cross-builds not yet supported")
endif
ifeq ($(arch),x86_64)
ifneq ($(build-platform),$(platform))
$(error "bootimage cross-builds not yet supported")
endif
endif
vm-classpath-object = $(bootimage-object)
cflags += -DBOOT_IMAGE=\"bootimageBin\"
else
vm-classpath-object = $(classpath-object)
cflags += -DBOOT_CLASSPATH=\"[classpathJar]\"
endif
driver-source = $(src)/main.cpp
driver-object = $(native-build)/main.o
driver-dynamic-object = $(native-build)/main-dynamic.o
boot-source = $(src)/boot.cpp
boot-object = $(native-build)/boot.o
generator-headers = $(src)/constants.h
generator-sources = $(src)/type-generator.cpp
generator-objects = \
$(call cpp-objects,$(generator-sources),$(src),$(native-build))
generator = $(native-build)/generator
converter-objects = \
$(native-build)/binaryToObject-main.o \
$(native-build)/binaryToObject-elf64.o \
$(native-build)/binaryToObject-elf32.o \
$(native-build)/binaryToObject-mach-o64.o \
$(native-build)/binaryToObject-mach-o32.o \
$(native-build)/binaryToObject-pe.o
converter = $(native-build)/binaryToObject
static-library = $(native-build)/lib$(name).a
executable = $(native-build)/$(name)${exe-suffix}
dynamic-library = $(native-build)/$(so-prefix)jvm$(so-suffix)
executable-dynamic = $(native-build)/$(name)-dynamic${exe-suffix}
ifneq ($(classpath),avian)
classpath-sources := \
$(classpath-src)/avian/Continuations.java \
$(classpath-src)/avian/Callback.java \
$(classpath-src)/avian/CallbackReceiver.java \
$(classpath-src)/avian/IncompatibleContinuationException.java \
$(classpath-src)/avian/SystemClassLoader.java \
$(classpath-src)/avian/Machine.java \
$(classpath-src)/avian/Addendum.java \
$(classpath-src)/avian/ClassAddendum.java \
$(classpath-src)/avian/MethodAddendum.java \
$(classpath-src)/avian/FieldAddendum.java \
$(classpath-src)/avian/VMClass.java \
$(classpath-src)/avian/VMField.java \
$(classpath-src)/avian/VMMethod.java \
$(classpath-src)/avian/resource/Handler.java
ifdef openjdk
classpath-sources := $(classpath-sources) \
$(classpath-src)/avian/OpenJDK.java
endif
else
classpath-sources := $(shell find $(classpath-src) -name '*.java')
endif
classpath-classes = \
$(call java-classes,$(classpath-sources),$(classpath-src),$(classpath-build))
classpath-object = $(native-build)/classpath-jar.o
classpath-dep = $(classpath-build).dep
vm-classes = \
avian/*.class \
avian/resource/*.class
test-sources = $(wildcard $(test)/*.java)
test-classes = $(call java-classes,$(test-sources),$(test),$(test-build))
test-dep = $(test-build).dep
test-extra-sources = $(wildcard $(test)/extra/*.java)
test-extra-classes = \
$(call java-classes,$(test-extra-sources),$(test),$(test-build))
test-extra-dep = $(test-build)-extra.dep
class-name = $(patsubst $(1)/%.class,%,$(2))
class-names = $(foreach x,$(2),$(call class-name,$(1),$(x)))
flags = -cp $(test-build)
args = $(flags) $(input)
.PHONY: build
build: $(static-library) $(executable) $(dynamic-library) \
$(executable-dynamic) $(classpath-dep) $(test-dep) $(test-extra-dep)
$(test-dep): $(classpath-dep)
$(test-extra-dep): $(classpath-dep)
.PHONY: run
run: build
$(executable) $(args)
.PHONY: debug
debug: build
gdb --args $(executable) $(args)
.PHONY: vg
vg: build
$(vg) $(executable) $(args)
.PHONY: test
test: build
/bin/sh $(test)/test.sh 2>/dev/null \
$(test-library-path) $(test-executable) $(mode) "$(flags)" \
$(call class-names,$(test-build),$(test-classes))
.PHONY: tarball
tarball:
@echo "creating build/avian-$(version).tar.bz2"
@mkdir -p build
(cd .. && tar --exclude=build --exclude='.*' --exclude='*~' -cjf \
avian/build/avian-$(version).tar.bz2 avian)
.PHONY: javadoc
javadoc:
javadoc -sourcepath classpath -d build/javadoc -subpackages avian:java \
-windowtitle "Avian v$(version) Class Library API" \
-doctitle "Avian v$(version) Class Library API" \
-header "Avian v$(version)" \
-bottom "<a href=\"http://oss.readytalk.com/avian/\">http://oss.readytalk.com/avian</a>"
.PHONY: clean
clean:
@echo "removing build"
rm -rf build
.PHONY: clean-native
clean-native:
@echo "removing $(native-build)"
rm -rf $(native-build)
$(native-build)/compile-x86-asm.o: $(src)/continuations-x86.S
gen-arg = $(shell echo $(1) | sed -e 's:$(native-build)/type-\(.*\)\.cpp:\1:')
$(generated-code): %.cpp: $(src)/types.def $(generator) $(classpath-dep)
@echo "generating $(@)"
@mkdir -p $(dir $(@))
$(generator) $(classpath-build) $(call gen-arg,$(@)) < $(<) > $(@)
$(native-build)/type-generator.o: \
$(generator-headers)
$(classpath-build)/%.class: $(classpath-src)/%.java
@echo $(<)
$(classpath-dep): $(classpath-sources) $(classpath-jar)
@echo "compiling classpath classes"
@mkdir -p $(classpath-build)
ifneq ($(classpath),avian)
(wd=$$(pwd) && \
cd $(classpath-build) && \
$(jar) xf $(classpath-jar))
endif
$(javac) -d $(classpath-build) \
-bootclasspath $(classpath-build) \
$(shell $(MAKE) -s --no-print-directory $(classpath-classes))
@touch $(@)
$(test-build)/%.class: $(test)/%.java
@echo $(<)
$(test-dep): $(test-sources)
@echo "compiling test classes"
@mkdir -p $(test-build)
files="$(shell $(MAKE) -s --no-print-directory $(test-classes))"; \
if test -n "$${files}"; then \
$(javac) -d $(test-build) -bootclasspath $(classpath-build) $${files}; \
fi
$(javac) -source 1.2 -target 1.1 -XDjsrlimit=0 -d $(test-build) \
test/Subroutine.java
@touch $(@)
$(test-extra-dep): $(test-extra-sources)
@echo "compiling extra test classes"
@mkdir -p $(test-build)
files="$(shell $(MAKE) -s --no-print-directory $(test-extra-classes))"; \
if test -n "$${files}"; then \
$(javac) -d $(test-build) -bootclasspath $(classpath-build) $${files}; \
fi
@touch $(@)
define compile-object
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
$(cxx) $(cflags) -c $(<) $(call output,$(@))
endef
define compile-asm-object
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
$(as) -I$(src) $(asmflags) -c $(<) -o $(@)
endef
$(vm-cpp-objects): $(native-build)/%.o: $(src)/%.cpp $(vm-depends)
$(compile-object)
$(vm-asm-objects): $(native-build)/%-asm.o: $(src)/%.S
$(compile-asm-object)
$(bootimage-generator-objects): $(native-build)/%.o: $(src)/%.cpp $(vm-depends)
$(compile-object)
$(heapwalk-objects): $(native-build)/%.o: $(src)/%.cpp $(vm-depends)
$(compile-object)
$(driver-object): $(driver-source)
$(compile-object)
$(driver-dynamic-object): $(driver-source)
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
$(cxx) $(cflags) -DBOOT_LIBRARY=\"$(so-prefix)jvm$(so-suffix)\" \
-c $(<) $(call output,$(@))
$(boot-object): $(boot-source)
$(compile-object)
$(build)/classpath.jar: $(classpath-dep)
(wd=$$(pwd) && \
cd $(classpath-build) && \
$(jar) c0f "$$($(native-path) "$${wd}/$(@)")" .)
$(native-build)/binaryToObject-main.o: $(src)/binaryToObject/main.cpp
$(build-cxx) -c $(^) -o $(@)
$(native-build)/binaryToObject-elf64.o: $(src)/binaryToObject/elf.cpp
$(build-cxx) -DBITS_PER_WORD=64 -c $(^) -o $(@)
$(native-build)/binaryToObject-elf32.o: $(src)/binaryToObject/elf.cpp
$(build-cxx) -DBITS_PER_WORD=32 -c $(^) -o $(@)
$(native-build)/binaryToObject-mach-o64.o: $(src)/binaryToObject/mach-o.cpp
$(build-cxx) -DBITS_PER_WORD=64 -c $(^) -o $(@)
$(native-build)/binaryToObject-mach-o32.o: $(src)/binaryToObject/mach-o.cpp
$(build-cxx) -DBITS_PER_WORD=32 -c $(^) -o $(@)
$(native-build)/binaryToObject-pe.o: $(src)/binaryToObject/pe.cpp
$(build-cxx) -c $(^) -o $(@)
$(converter): $(converter-objects)
$(build-cxx) $(^) -o $(@)
$(classpath-object): $(build)/classpath.jar $(converter)
@echo "creating $(@)"
$(converter) $(<) $(@) _binary_classpath_jar_start \
_binary_classpath_jar_end $(platform) $(arch)
$(generator-objects): $(native-build)/%.o: $(src)/%.cpp
@echo "compiling $(@)"
@mkdir -p $(dir $(@))
$(build-cxx) -DPOINTER_SIZE=$(pointer-size) -O0 -g3 $(build-cflags) \
-c $(<) -o $(@)
$(jni-objects): $(native-build)/%.o: $(classpath-src)/%.cpp
$(compile-object)
$(static-library): $(classpath-object-dep)
$(static-library): $(vm-objects) $(jni-objects) $(vm-heapwalk-objects)
@echo "creating $(@)"
rm -rf $(@)
$(ar) cru $(@) $(^) $(call classpath-objects)
$(ranlib) $(@)
$(bootimage-bin): $(bootimage-generator)
$(<) $(classpath-build) $(@)
$(bootimage-object): $(bootimage-bin) $(converter)
@echo "creating $(@)"
$(converter) $(<) $(@) _binary_bootimage_bin_start \
_binary_bootimage_bin_end $(platform) $(arch) $(pointer-size) \
writable executable
$(classpath-object-dep): $(classpath-libraries)
@mkdir -p $(build)/classpath-objects
(cd $(build)/classpath-objects && \
for x in $(classpath-libraries); do ar x $${x}; done)
@touch $(@)
$(executable): $(classpath-object-dep)
$(executable): \
$(vm-objects) $(jni-objects) $(driver-object) $(vm-heapwalk-objects) \
$(boot-object) $(vm-classpath-object)
@echo "linking $(@)"
ifeq ($(platform),windows)
ifdef msvc
$(ld) $(lflags) $(^) -out:$(@) -PDB:$(@).pdb -IMPLIB:$(@).lib \
-MANIFESTFILE:$(@).manifest
$(mt) -manifest $(@).manifest -outputresource:"$(@);1"
else
$(dlltool) -z $(@).def $(^) $(call classpath-objects)
$(dlltool) -d $(@).def -e $(@).exp
$(ld) $(@).exp $(^) $(call classpath-objects) $(lflags) -o $(@)
endif
else
$(ld) $(^) $(call classpath-objects) $(rdynamic) $(lflags) \
$(bootimage-lflags) -o $(@)
endif
$(strip) $(strip-all) $(@)
$(bootimage-generator):
$(MAKE) mode=$(mode) \
arch=$(build-arch) \
platform=$(bootimage-platform) \
bootimage-generator= \
build-bootimage-generator=$(bootimage-generator) \
$(bootimage-generator)
$(build-bootimage-generator): \
$(vm-objects) $(classpath-object) $(jni-objects) $(heapwalk-objects) \
$(bootimage-generator-objects)
@echo "linking $(@)"
ifeq ($(platform),windows)
ifdef msvc
$(ld) $(lflags) $(^) -out:$(@) -PDB:$(@).pdb -IMPLIB:$(@).lib \
-MANIFESTFILE:$(@).manifest
$(mt) -manifest $(@).manifest -outputresource:"$(@);1"
else
$(dlltool) -z $(@).def $(^)
$(dlltool) -d $(@).def -e $(@).exp
$(ld) $(@).exp $(^) $(lflags) -o $(@)
endif
else
$(ld) $(^) $(rdynamic) $(lflags) -o $(@)
endif
$(dynamic-library): $(classpath-object-dep)
$(dynamic-library): \
$(vm-objects) $(dynamic-object) $(jni-objects) $(vm-heapwalk-objects) \
$(boot-object) $(vm-classpath-object) $(classpath-libraries)
@echo "linking $(@)"
ifdef msvc
$(ld) $(shared) $(lflags) $(^) -out:$(@) -PDB:$(@).pdb \
-IMPLIB:$(native-build)/$(name).lib -MANIFESTFILE:$(@).manifest
$(mt) -manifest $(@).manifest -outputresource:"$(@);2"
else
$(ld) $(^) -Wl,--version-script=openjdk.ld \
$(call classpath-objects) $(shared) $(lflags) $(bootimage-lflags) -o $(@)
endif
$(strip) $(strip-all) $(@)
$(executable-dynamic): $(driver-dynamic-object) $(dynamic-library)
@echo "linking $(@)"
ifdef msvc
$(ld) $(lflags) -LIBPATH:$(native-build) -DEFAULTLIB:$(name) \
-PDB:$(@).pdb -IMPLIB:$(@).lib $(<) -out:$(@) -MANIFESTFILE:$(@).manifest
$(mt) -manifest $(@).manifest -outputresource:"$(@);1"
else
$(ld) $(<) -L$(native-build) -ljvm $(lflags) -o $(@)
endif
$(strip) $(strip-all) $(@)
$(generator): $(generator-objects)
@echo "linking $(@)"
$(build-ld) $(^) $(build-lflags) -o $(@)