-
Notifications
You must be signed in to change notification settings - Fork 198
/
Makefile
1391 lines (1202 loc) · 74.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
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
$?SRCROOT=$(PWD)
$?SDK=$(PWD)/sdk
$?UNAME=$(shell uname -s)
$?EMITSWF=
$?SWFDIR=
$?SWFEXT=
# This section is for Host platform options
ifneq (,$(findstring CYGWIN,$(UNAME)))
$?PLATFORM="cygwin"
$?RAWPLAT=cygwin
$?THREADS=3
$?nativepath=$(shell cygpath -at mixed $(1))
$?BUILD_TRIPLE=i686-pc-cygwin
$?CC=gcc-4
$?CXX=g++-4
$?NATIVE_AR=ar
$?PLAYER=$(SRCROOT)/qa/runtimes/player/Debug/FlashPlayerDebugger.exe
$?FPCMP=$(BUILDROOT)/extra/fpcmp.exe
$?NOPIE=
else
$?PLATFORM="darwin"
$?RAWPLAT=darwin
$?THREADS=$(shell sysctl -n hw.ncpu)
$?nativepath=$(1)
$?BUILD_TRIPLE=x86_64-apple-darwin10
$?CC=gcc
$?CXX=g++
$?NATIVE_AR=ar
$?PLAYER=$(SRCROOT)/qa/runtimes/player/Debug/Flash Player.app
$?FPCMP=$(BUILDROOT)/extra/fpcmp
$?NOPIE=-no_pie
endif
export CC:=$(CC)
export CXX:=$(CXX)
$?DBGOPTS=
$?BUILDROOT=$(PWD)/build
$?WIN_BUILD=$(BUILDROOT)/win
$?MAC_BUILD=$(BUILDROOT)/mac
$?CYGWINMAC=$(SRCROOT)/cygwinmac/sdk/usr/bin
$?ABCLIBOPTS=-config CONFIG::asdocs=false -config CONFIG::actual=true
$?LIBHELPEROPTFLAGS=-O3
# This section is for Target platform options
ifneq (,$(findstring cygwin,$(PLATFORM)))
$?EXEEXT=.exe
$?SOEXT=.dll
$?SDLFLAGS=
$?TAMARIN_CONFIG_FLAGS=--target=i686-linux
$?TAMARINLDFLAGS=" -Wl,--stack,16000000"
$?SDKEXT=.zip
$?BUILD=$(WIN_BUILD)
$?PLATFORM_NAME=win
$?HOST_TRIPLE=i686-pc-cygwin
else
$?EXEEXT=
$?SOEXT=.dylib
$?SDLFLAGS=--build=i686-apple-darwin9
$?TAMARIN_CONFIG_FLAGS=
$?TAMARINLDFLAGS=" -m32 -arch=i686"
$?SDKEXT=.dmg
$?BUILD=$(MAC_BUILD)
$?PLATFORM_NAME=mac
$?HOST_TRIPLE=x86_64-apple-darwin10
export PATH:=$(BUILD)/ccachebin:$(PATH)
endif
ESCAPED_SRCROOT=$(shell echo $(SRCROOT) | sed -e 's/[\/&]/\\&/g')
$?BUILD_FOLDER="builds"
$?FTP_HOST=
$?JAVA=$(call nativepath,$(shell which java))
$?JAVAFLAGS=
$?TAMARINCONFIG=CFLAGS=" -m32 -I$(SRCROOT)/avm2_env/misc -DVMCFG_ALCHEMY_SDK_BUILD " CXXFLAGS=" -m32 -I$(SRCROOT)/avm2_env/misc -Wno-deprecated-declarations -DVMCFG_ALCHEMY_SDK_BUILD " LDFLAGS=$(TAMARINLDFLAGS) $(SRCROOT)/avmplus/configure.py --enable-shell --enable-alchemy-posix $(TAMARIN_CONFIG_FLAGS)
$?LN=ln -sfn
$?COPY_DOCS=false
$?ASSERTIONS=OFF
$?LLVMCMAKEOPTS=
$?LLVMLDFLAGS=
$?LLVMINSTALLPREFIX=$(BUILD)
$?LLVM_ONLYLLC=false
$?FLEX=$(SRCROOT)/tools/flex/
$?RSYNC=rsync -az --no-p --no-g --chmod=ugo=rwX
$?ASDOC=$(SRCROOT)/tools/flex/bin/asdoc
$?ASC=$(call nativepath,$(SRCROOT)/avmplus/utils/asc.jar)
$?SCOMP=java $(JAVAFLAGS) -classpath $(ASC) macromedia.asc.embedding.ScriptCompiler -abcfuture -AS3 -import $(call nativepath,$(SRCROOT)/avmplus/generated/builtin.abc) -import $(call nativepath,$(SRCROOT)/avmplus/generated/shell_toplevel.abc)
$?SCOMPFALCON=java $(JAVAFLAGS) -jar $(call nativepath,$(SRCROOT)/tools/lib/asc2.jar) -merge -md -abcfuture -AS3 -import $(call nativepath,$(SRCROOT)/avmplus/generated/builtin.abc) -import $(call nativepath,$(SRCROOT)/avmplus/generated/shell_toplevel.abc)
$?BUILDTYPE=MinSizeRel
$?CLANG=ON
?BUILD_LLVM_TESTS=ON
$?CYGTRIPLE=i686-pc-cygwin
$?MINGWTRIPLE=i686-mingw32
$?TRIPLE=avm2-unknown-freebsd8
$?AVMSHELL=$(SDK)/usr/bin/avmshell$(EXEEXT)
$?AR=$(SDK)/usr/bin/ar scru -v
$?FLASCC_VERSION_MAJOR:=1
$?FLASCC_VERSION_MINOR:=0
$?FLASCC_VERSION_PATCH:=1
$?FLASCC_VERSION_BUILD:=devbuild
$?SDKNAME=Crossbridge_$(FLASCC_VERSION_MAJOR).$(FLASCC_VERSION_MINOR).$(FLASCC_VERSION_PATCH).$(FLASCC_VERSION_BUILD)
BUILD_VER_DEFS"-DFLASCC_VERSION_MAJOR=$(FLASCC_VERSION_MAJOR) -DFLASCC_VERSION_MINOR=$(FLASCC_VERSION_MINOR) -DFLASCC_VERSION_PATCH=$(FLASCC_VERSION_PATCH) -DFLASCC_VERSION_BUILD=$(FLASCC_VERSION_BUILD)"
ifneq (,$(PRINT_LOGS_ON_ERROR))
$?PRINT_LOGS_CMD=tail +1
else
$?PRINT_LOGS_CMD=true
endif
export CCACHE_DIR=$(SRCROOT)/ccache
#TODO are we done sweeping for asm?
#$?BMAKE=AR='/usr/bin/true ||' GENCAT=/usr/bin/true RANLIB=/usr/bin/true CC="$(SDK)/usr/bin/gcc -emit-llvm"' -DSTRIP_FBSDID -D__asm__\(X...\)="\error" -D__asm\(X...\)="\error"' MAKEFLAGS="" MFLAGS="" $(BUILD)/bmake/bmake -m $(BUILD)/lib/share/mk
$?BMAKE=AR='/usr/bin/true ||' GENCAT=/usr/bin/true RANLIB=/usr/bin/true CC="$(SDK)/usr/bin/gcc -emit-llvm -DSTRIP_FBSDID" MAKEFLAGS="" MFLAGS="" $(BUILD)/bmake/bmake -m $(BUILD)/lib/share/mk
BUILDORDER=cmake abclibs basictools llvm binutils plugins gcc bmake \
stdlibs gcclibs as3wig abcstdlibs sdkcleanup tr trd extralibs \
extratools finalcleanup submittests
all:
@echo "~~~ Crossbridge ~~~"
@mkdir -p $(BUILD)/logs
@echo "- base"
@$(MAKE) base &> $(BUILD)/logs/base.txt
@echo "- make"
@$(MAKE) make &> $(BUILD)/logs/make.txt
@$(SDK)/usr/bin/make -s all_with_local_make
all_with_local_make:
@for target in $(BUILDORDER) ; do \
echo "- $$target" ; \
$(MAKE) $$target &> $(BUILD)/logs/$$target.txt ; \
mret=$$? ; \
logs="$$logs $(BUILD)/logs/$$target.txt" ; \
grep -q "Resource temporarily unavailable" $(BUILD)/logs/$$target.txt ; \
gret=$$? ; \
rcount=1 ; \
while [ $$gret == 0 ] && [ $$rcount -lt 6 ] ; do \
echo "- $$target (retry $$rcount)" ; \
$(MAKE) $$target &> $(BUILD)/logs/$$target.txt ; \
mret=$$? ; \
grep -q "Resource temporarily unavailable" $(BUILD)/logs/$$target.txt ; \
gret=$$? ; \
let rcount=rcount+1 ; \
done ; \
if [ $$mret -ne 0 ] ; then \
echo "Failed to build: $$target" ;\
$(PRINT_LOGS_CMD) $$logs ;\
exit 1 ; \
fi ; \
done
clean:
rm -rf $(BUILDROOT)
rm -rf $(SDK)
rm -rf $(SRCROOT)/.redo
cd samples && $(MAKE) clean
docs:
$(MAKE) base
$(MAKE) abclibs_asdocs
abclibs:
$(MAKE) -j$(THREADS) abclibs_compile abclibs_asdocs
ifeq ($(COPY_DOCS), true)
$(MAKE) copy_docs
endif
abclibs_asdocs:
mkdir -p $(BUILDROOT)
mkdir -p $(BUILD)/logs
cd $(BUILDROOT) && $(ASDOC) \
-load-config= \
-external-library-path=$(SRCROOT)/tools/flex/frameworks/libs/player/11.1/playerglobal.swc \
-strict=false -define+=CONFIG::player,1 -define+=CONFIG::asdocs,true -define+=CONFIG::actual,false \
-doc-sources+=$(SRCROOT)/posix/vfs \
-doc-sources+=$(SRCROOT)/posix \
-keep-xml=true \
-exclude-sources+=$(SRCROOT)/posix/startHack.as \
-exclude-sources+=$(SRCROOT)/posix/IKernel.as \
-exclude-sources+=$(SRCROOT)/posix/vfs/nochump \
-package-description-file=$(SRCROOT)/test/aspackages.xml \
-main-title "Crossbridge API Reference" \
-window-title "Crossbridge API Reference" \
-output apidocs &> $(BUILD)/logs/asdoc.txt
mv $(BUILDROOT)/apidocs/tempdita $(BUILDROOT)/
CROSS=PATH="$(BUILD)/ccachebin:$(CYGWINMAC):$(PATH):$(SDK)/usr/bin" $(MAKE) SDK=$(WIN_BUILD)/sdkoverlay PLATFORM=cygwin LLVMINSTALLPREFIX=$(WIN_BUILD) NATIVE_AR=$(CYGTRIPLE)-ar CC=$(CYGTRIPLE)-gcc CXX=$(CYGTRIPLE)-g++ RANLIB=$(CYGTRIPLE)-ranlib
win:
@if [ -d $(CYGWINMAC) ] ; then true ; \
else echo "Couldn't locate cygwin mac directory, please invoke $(MAKE) with \"$(MAKE) CYGWINMAC=/path/to/cygwinmac/sdk/usr/bin ...\"" ; exit 1; \
fi
@mkdir -p $(WIN_BUILD)/logs
@echo "- base (win)"
@$(CROSS) base &> $(WIN_BUILD)/logs/base_win.txt
@echo "- make (win)"
@$(CROSS) make &> $(WIN_BUILD)/logs/make_win.txt
@echo "- uname (win)"
@$(CROSS) uname &> $(WIN_BUILD)/logs/uname_win.txt
@echo "- noenv (win)"
@$(CROSS) noenv &> $(WIN_BUILD)/logs/noenv_win.txt
@echo "- avm2-as (win)"
@$(CROSS) avm2-as &> $(WIN_BUILD)/logs/avm2-as_win.txt
@echo "- pkgconfig (win)"
@$(CROSS) GLIB_CFLAGS="-I$(CYGWINMAC)/../include/glib-2.0/ -I$(CYGWINMAC)/../lib/glib-2.0/include/" GLIB_LIBS="$(CYGWINMAC)/../lib/libglib-2.0.a -lintl -liconv" pkgconfig -j1 &> $(WIN_BUILD)/logs/pkgconfig_win.txt
@echo "- llvm (win/cygwin)"
@$(MAKE) cross_llvm_cygwin &> $(WIN_BUILD)/logs/llvm_win_cygwin.txt
@echo "- binutils (win)"
@$(CROSS) binutils &> $(WIN_BUILD)/logs/binutils_win.txt
@echo "- plugins (win)"
@$(CROSS) plugins &> $(WIN_BUILD)/logs/plugins_win.txt
@echo "- gcc (win)"
@$(CROSS) gcc &> $(WIN_BUILD)/logs/gcc_win.txt
@echo "- swig (win)"
@$(CROSS) swig &> $(WIN_BUILD)/logs/swig_win.txt
@echo "- llvm (win/mingw)"
@$(MAKE) cross_llvm_mingw &> $(WIN_BUILD)/logs/llvm_win_mingw.txt
@echo "- tr (win)"
@$(CROSS) tr &> $(WIN_BUILD)/logs/tr_win.txt
@echo "- trd (win)"
@$(CROSS) trd &> $(WIN_BUILD)/logs/trd_win.txt
@echo "- gdb (win)"
@$(CROSS) gdb &> $(WIN_BUILD)/logs/gdb_win.txt
@echo "- genfs (win)"
@$(CROSS) genfs &> $(WIN_BUILD)/logs/genfs_win.txt
cross_llvm_mingw:
echo "# Cmake Toolchain file:" > $(BUILD)/llvmcross.toolchain
echo "set(CMAKE_SYSTEM_NAME Windows)" >> $(BUILD)/llvmcross.toolchain
echo "set(CMAKE_RC_COMPILER $(MINGWTRIPLE)-gcc)" >> $(BUILD)/llvmcross.toolchain
PATH="$(BUILD)/ccachebin:$(SRCROOT)/mingwmac/sdk/usr/bin:$(PATH)" $(MAKE) \
SDK=$(WIN_BUILD)/sdkoverlay PLATFORM=cygwin NATIVE_AR=$(MINGWTRIPLE)-ar LLVMINSTALLPREFIX=$(WIN_BUILD) \
CC=$(MINGWTRIPLE)-gcc CXX=$(MINGWTRIPLE)-g++ \
LLVMCFLAGS="-march=pentium4 -mfpmath=sse -D_GLIBCXX_HAVE_FENV_H=1" \
LLVMCXXFLAGS="-march=pentium4 -mfpmath=sse -D_GLIBCXX_HAVE_FENV_H=1" LLVMLDFLAGS="-lrpcrt4 -Wl,--stack,16000000" \
LLVMCMAKEOPTS="-DCMAKE_TOOLCHAIN_FILE=$(BUILD)/llvmcross.toolchain -DLLVM_TABLEGEN=$(MAC_BUILD)/llvm-install/bin/tblgen" \
llvm BUILD_LLVM_TESTS=OFF LLVM_ONLYLLC=true CLANG=OFF
cross_llvm_cygwin:
echo "# Cmake Toolchain file:" > $(BUILD)/llvmcross.toolchain
echo "set(CMAKE_SYSTEM_NAME Windows)" >> $(BUILD)/llvmcross.toolchain
echo "set(CMAKE_RC_COMPILER $(CC))" >> $(BUILD)/llvmcross.toolchain
PATH="$(BUILD)/ccachebin:$(CYGWINMAC)/../altbin:$(CYGWINMAC):$(PATH)" $(MAKE) \
SDK=$(WIN_BUILD)/sdkoverlay PLATFORM=cygwin NATIVE_AR=$(CYGTRIPLE)-ar LLVMINSTALLPREFIX=$(WIN_BUILD) \
CC=$(CYGTRIPLE)-gcc CXX=$(CYGTRIPLE)-g++ LLVMLDFLAGS="-Wl,--stack,16000000" \
LLVMCMAKEOPTS="-DCMAKE_TOOLCHAIN_FILE=$(BUILD)/llvmcross.toolchain -DLLVM_TABLEGEN=$(MAC_BUILD)/llvm-install/bin/tblgen" \
llvm BUILD_LLVM_TESTS=OFF
continuous:
$(MAKE) all COPY_DOCS=true
$(MAKE) examples neverball
cd samples && $(MAKE) clean
nightly:
rm -rf $(CCACHE_DIR)
$(MAKE) all
$(MAKE) libsdl_configure
$(MAKE) ieeetests_conversion
$(MAKE) ieeetests_basicops
$(MAKE) swigtests
#$(MAKE)checkasm
weekly:
$(MAKE) nightly
$(MAKE) gcctests
.PHONY: bmake posix binutils docs gcc samples
deliverables:
$(MAKE) staging
$(MAKE) flattensymlinks
ifneq (,$(findstring cygwin,$(PLATFORM)))
$(MAKE) zip
else
$(MAKE) dmg
$(MAKE) staging
$(MAKE) winstaging
$(MAKE) flattensymlinks
$(MAKE) zip
# $(MAKE) diffdeliverables
endif
diffdeliverables:
cat $(BUILDROOT)/zipcontents.txt | grep -v staging/cygwin | grep -v "run.bat" | sed -e 's/\.exe//g' -e 's/\.dll/\.~SO~/g' -e 's/\/cygwin/\/~PLAT~/g' | sort > $(BUILDROOT)/zipcontents_munge.txt
cat $(BUILDROOT)/dmgcontents.txt | grep -v "share/cmake" | grep -v "bin/cmake" | grep -v "bin/ctest" | grep -v "bin/cpack" | grep -v "bin/ccmake" | sed -e 's/\.exe//g' -e 's/\.dylib/\.~SO~/g' -e 's/\/darwin/\/~PLAT~/g' | sort > $(BUILDROOT)/dmgcontents_munge.txt
diff $(BUILDROOT)/dmgcontents_munge.txt $(BUILDROOT)/zipcontents_munge.txt
flattensymlinks:
find $(BUILDROOT)/staging/sdk -type l | xargs rm
$(RSYNC) $(BUILDROOT)/staging/sdk/usr/platform/*/ $(BUILDROOT)/staging/sdk/usr
rm -rf $(BUILDROOT)/staging/sdk/usr/platform
staging:
rm -rf $(BUILDROOT)/staging
mkdir -p $(BUILDROOT)/staging
$(RSYNC) $(SDK) $(BUILDROOT)/staging/
$(RSYNC) --exclude '*.PAK' --exclude '*.pak' --exclude 13_ObjectiveC --exclude Example_Sound --exclude 13_Example_Neverball --exclude demobaseq2 --exclude 15_Example_Quake3 --exclude 14_Example_Quake2 $(SRCROOT)/samples $(BUILDROOT)/staging/
$(RSYNC) $(SRCROOT)/README.html $(BUILDROOT)/staging/
$(RSYNC) $(SRCROOT)/docs $(BUILDROOT)/staging/
$(RSYNC) $(BUILDROOT)/apidocs $(BUILDROOT)/staging/docs/
rm -f $(BUILDROOT)/staging/sdk/usr/bin/gccbug*
find $(BUILDROOT)/staging/ | grep "\.DS_Store$$" | xargs rm -f
echo $(FLASCC_VERSION_BUILD) > $(BUILDROOT)/staging/sdk/ver.txt
dmg:
rm -f $(BUILDROOT)/$(SDKNAME).dmg $(BUILDROOT)/$(SDKNAME).dmg.tmp
cp -f $(SRCROOT)/tools/Base.dmg $(BUILDROOT)/$(SDKNAME).dmg.tmp
chmod u+rw $(BUILDROOT)/$(SDKNAME).dmg.tmp
hdiutil resize -size 2G $(BUILDROOT)/$(SDKNAME).dmg.tmp
hdiutil attach $(BUILDROOT)/$(SDKNAME).dmg.tmp -readwrite -mountpoint $(BUILDROOT)/dmgmount
rm -f $(BUILDROOT)/staging/.DS_Store
$(RSYNC) $(BUILDROOT)/staging/ $(BUILDROOT)/dmgmount/
mv $(BUILDROOT)/dmgmount/.fseventsd $(BUILDROOT)/
hdiutil detach $(BUILDROOT)/dmgmount
hdiutil convert $(BUILDROOT)/$(SDKNAME).dmg.tmp -format UDZO -imagekey zlib-level=9 -o $(BUILDROOT)/$(SDKNAME).dmg
rm -f $(BUILDROOT)/$(SDKNAME).dmg.tmp
find $(BUILDROOT)/staging > $(BUILDROOT)/dmgcontents.txt
zip:
cd $(BUILDROOT)/staging/ && zip -qr $(BUILDROOT)/$(SDKNAME).zip *
find $(BUILDROOT)/staging > $(BUILDROOT)/zipcontents.txt
winstaging:
$(LN) cygwin $(BUILDROOT)/staging/sdk/usr/platform/current
# temporarily $(MAKE) sdk cygwin-ish
$(LN) cygwin $(SDK)/usr/platform/current
mkdir -p $(SDK)/usr/platform/cygwin/bin
$(MAKE) libsdl-install
# copy some parts of the mac bin dir which are actually xplatform
cp -f $(BUILDROOT)/staging/sdk/usr/platform/darwin/bin/libtool* $(SDK)/usr/platform/cygwin/bin/
cp -f $(BUILDROOT)/staging/sdk/usr/platform/darwin/bin/libpng* $(SDK)/usr/platform/cygwin/bin/
$(MAKE) sdkcleanup
$(MAKE) finalcleanup
@rm -rf $(SDK)/usr/platform/darwin/share
$(RSYNC) $(SRCROOT)/tools/run.bat $(BUILDROOT)/staging/
$(RSYNC) $(SRCROOT)/cygwin $(BUILDROOT)/staging/
$(RSYNC) $(SDK) $(BUILDROOT)/staging/
rm -rf $(BUILDROOT)/staging/sdk/usr/libexec
rm -rf $(BUILDROOT)/staging/sdk/usr/share/cmake-2.8
$(RSYNC) $(WIN_BUILD)/sdkoverlay/usr/platform/cygwin $(BUILDROOT)/staging/sdk/usr/platform/
$(RSYNC) $(WIN_BUILD)/sdkoverlay/usr/lib/*.dll $(BUILDROOT)/staging/sdk/usr/lib/
$(RSYNC) $(WIN_BUILD)/sdkoverlay/usr/lib/bfd-plugins/*.dll $(BUILDROOT)/staging/sdk/usr/lib/bfd-plugins/
rm -rf $(BUILDROOT)/staging/sdk/usr/platform/darwin
rm -f $(BUILDROOT)/staging/sdk/usr/lib/*.dylib
rm -f $(BUILDROOT)/staging/sdk/usr/lib/*.la
rm -f $(BUILDROOT)/staging/sdk/usr/lib/bfd-plugins/*.dylib
$(LN) darwin $(SDK)/usr/platform/current
# nuke cygwin from sdk
rm -rf $(SDK)/usr/platform/cygwin
find $(BUILDROOT)/staging/ | grep "\.DS_Store$$" | xargs rm -f
sdkcleanup:
mv $(SDK)/usr/share/cmake-2.8 $(SDK)/usr/share_cmake
rm -rf $(SDK)/usr/share $(SDK)/usr/info $(SDK)/usr/man $(SDK)/usr/lib/x86_64 $(SDK)/usr/cmake_junk $(SDK)/usr/make_junk
mkdir -p $(SDK)/usr/share
mv $(SDK)/usr/share_cmake $(SDK)/usr/share/cmake-2.8
rm -f $(SDK)/usr/lib/*.la
rm -f $(SDK)/usr/lib/crt1.o $(SDK)/usr/lib/crtbegin.o $(SDK)/usr/lib/crtbeginS.o $(SDK)/usr/lib/crtbeginT.o $(SDK)/usr/lib/crtend.o $(SDK)/usr/lib/crtendS.o $(SDK)/usr/lib/crti.o $(SDK)/usr/lib/crtn.o
finalcleanup:
rm -f $(SDK)/usr/lib/*.la
rm -rf $(SDK)/usr/share/aclocal $(SDK)/usr/share/doc $(SDK)/usr/share/man $(SDK)/usr/share/info
@$(LN) ../../share $(SDK)/usr/platform/darwin/share
$(RSYNC) $(SRCROOT)/tools/swf-info.py $(SDK)/usr/bin/
$(RSYNC) $(SRCROOT)/tools/projector-dis.py $(SDK)/usr/bin/
$(RSYNC) $(SRCROOT)/tools/swfdink.py $(SDK)/usr/bin/
$(RSYNC) $(SRCROOT)/posix/avm2_tramp.cpp $(SDK)/usr/share/
$(RSYNC) $(SRCROOT)/posix/vgl.c $(SDK)/usr/share/
$(RSYNC) $(SRCROOT)/posix/Console.as $(SDK)/usr/share/
$(RSYNC) $(SRCROOT)/posix/DefaultPreloader.as $(SDK)/usr/share/
$(RSYNC) $(SRCROOT)/posix/vfs/HTTPBackingStore.as $(SDK)/usr/share/
$(RSYNC) $(SRCROOT)/posix/vfs/DefaultVFS.as $(SDK)/usr/share/
$(RSYNC) $(SRCROOT)/posix/vfs/ISpecialFile.as $(SDK)/usr/share/
$(RSYNC) $(SRCROOT)/posix/vfs/IBackingStore.as $(SDK)/usr/share/
$(RSYNC) $(SRCROOT)/posix/vfs/IVFS.as $(SDK)/usr/share/
$(RSYNC) $(SRCROOT)/posix/vfs/InMemoryBackingStore.as $(SDK)/usr/share/
$(RSYNC) $(SRCROOT)/posix/vfs/LSOBackingStore.as $(SDK)/usr/share/
$(RSYNC) --exclude "*.xslt" --exclude "*.html" --exclude ASDoc_Config.xml --exclude overviews.xml $(BUILDROOT)/tempdita/ $(SDK)/usr/share/asdocs
gdb:
rm -rf $(BUILD)/gdb-7.3
mkdir -p $(BUILD)/gdb-7.3
cd $(BUILD)/gdb-7.3 && CFLAGS="-I$(SRCROOT)/avm2_env/misc" $(SRCROOT)/gdb-7.3/configure --build=$(BUILD_TRIPLE) --host=$(HOST_TRIPLE) --target=avm2-elf && $(MAKE) -j$(THREADS)
cp -f $(BUILD)/gdb-7.3/gdb/gdb$(EXEEXT) $(SDK)/usr/bin/
cp -f $(SRCROOT)/tools/flascc.gdb $(SDK)/usr/share/
cp -f $(SRCROOT)/tools/flascc-run.gdb $(SDK)/usr/share/
cp -f $(SRCROOT)/tools/flascc-init.gdb $(SDK)/usr/share/
llvm:
rm -rf $(BUILD)/llvm-debug
mkdir -p $(BUILD)/llvm-debug
cd $(BUILD)/llvm-debug && LDFLAGS="$(LLVMLDFLAGS)" CFLAGS="$(LLVMCFLAGS)" CXXFLAGS="$(LLVMCXXFLAGS)" $(SRCROOT)/sdk/usr/bin/cmake -G "Unix Makefiles" \
$(LLVMCMAKEOPTS) -DCMAKE_INSTALL_PREFIX=$(LLVMINSTALLPREFIX)/llvm-install -DCMAKE_BUILD_TYPE=$(BUILDTYPE) -DLLVM_BUILD_CLANG=$(CLANG) \
-DLLVM_ENABLE_ASSERTIONS=$(ASSERTIONS) -DLLVM_BUILD_GOLDPLUGIN=ON -DBINUTILS_INCDIR=$(SRCROOT)/binutils/include \
-DLLVM_TARGETS_TO_BUILD="AVM2;AVM2Shim;X86;CBackend" -DLLVM_NATIVE_ARCH="avm2" -DLLVM_INCLUDE_TESTS=$(BUILD_LLVM_TESTS) -DLLVM_INCLUDE_EXAMPLES=OFF \
$(SRCROOT)/llvm-2.9 && $(MAKE) -j$(THREADS) && $(MAKE) install
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llc$(EXEEXT) $(SDK)/usr/bin/llc$(EXEEXT)
ifeq ($(LLVM_ONLYLLC), false)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-ar$(EXEEXT) $(SDK)/usr/bin/llvm-ar$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-as$(EXEEXT) $(SDK)/usr/bin/llvm-as$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-diff$(EXEEXT) $(SDK)/usr/bin/llvm-diff$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-dis$(EXEEXT) $(SDK)/usr/bin/llvm-dis$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-extract$(EXEEXT) $(SDK)/usr/bin/llvm-extract$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-ld$(EXEEXT) $(SDK)/usr/bin/llvm-ld$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-link$(EXEEXT) $(SDK)/usr/bin/llvm-link$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-nm$(EXEEXT) $(SDK)/usr/bin/llvm-nm$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/llvm-ranlib$(EXEEXT) $(SDK)/usr/bin/llvm-ranlib$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/bin/opt$(EXEEXT) $(SDK)/usr/bin/opt$(EXEEXT)
cp $(LLVMINSTALLPREFIX)/llvm-install/lib/LLVMgold.* $(SDK)/usr/lib/LLVMgold$(SOEXT)
cp -f $(BUILD)/llvm-debug/bin/fpcmp$(EXEEXT) $(BUILDROOT)/extra/fpcmp$(EXEEXT)
endif
llvmtests:
rm -rf $(BUILD)/llvm-tests
mkdir -p $(BUILD)/llvm-tests
cp -f $(SDK)/usr/bin/avmshell-release-debugger $(SDK)/usr/bin/avmshell
cd $(BUILD)/llvm-tests && $(SRCROOT)/llvm-2.9/configure --with-llvmgcc=$(SDK)/usr/bin/gcc --with-llvmgxx=$(SDK)/usr/bin/g++ --without-f2c --without-f95 --disable-clang --enable-jit=no --target=$(TRIPLE) --prefix=$(BUILD)/llvm-install
cd $(BUILD)/llvm-tests && $(LN) $(SDK)/usr Release
cd $(BUILD)/llvm-tests/projects/test-suite/MultiSource && (LANG=C && $(MAKE) TEST=nightly TARGET_LLCFLAGS=-jvm="$(JAVA)" -j$(THREADS) FPCMP=$(FPCMP) DISABLE_CBE=1)
cd $(BUILD)/llvm-tests/projects/test-suite/SingleSource && (LANG=C && $(MAKE) TEST=nightly TARGET_LLCFLAGS=-jvm="$(JAVA)" -j$(THREADS) FPCMP=$(FPCMP) DISABLE_CBE=1)
python $(SRCROOT)/tools/llvmtestcheck.py --srcdir $(SRCROOT)/llvm-2.9/projects/test-suite/ --builddir $(BUILD)/llvm-tests/projects/test-suite/ --fpcmp $(FPCMP)> $(BUILD)/llvm-tests/passfail.txt
cp $(BUILD)/llvm-tests/passfail.txt $(BUILD)/passfail_llvm.txt
llvmtests-speccpu2006: # works only on mac!
rm -rf $(BUILD)/llvm-tests
rm -rf $(BUILD)/llvm-spec-tests
mkdir -p $(BUILD)/llvm-tests
cp -f $(SDK)/usr/bin/avmshell-release-debugger $(SDK)/usr/bin/avmshell
mkdir -p $(BUILD)/llvm-externals && cd $(BUILD)/llvm-externals && curl http://alchemy.corp.adobe.com/speccpu2006.tar.bz2 | tar xvjf -
#mkdir -p $(BUILD)/llvm-externals && cd $(BUILD)/llvm-externals && cat $(SRCROOT)/speccpu2006.tar.bz2 | tar xvjf -
cd $(BUILD)/llvm-tests && $(SRCROOT)/llvm-2.9/configure --without-f2c --without-f95 --with-llvmgcc=$(SDK)/usr/bin/gcc --with-llvmgxx=$(SDK)/usr/bin/g++ --with-externals=$(BUILD)/llvm-externals --disable-clang --enable-jit=no --target=$(TRIPLE) --prefix=$(BUILD)/llvm-install
cd $(BUILD)/llvm-tests && $(LN) $(SDK)/usr Release
cd $(BUILD)/llvm-tests/projects/test-suite/External && (LANG=C && $(MAKE) TEST=nightly TARGET_LLCFLAGS=-jvm="$(JAVA)" -j$(THREADS) FPCMP=$(FPCMP) DISABLE_CBE=1 CXXFLAGS+='-DSPEC_CPU_MACOSX -DSPEC_CPU_NO_HAS_SIGSETJMP' CFLAGS+='-DSPEC_CPU_MACOSX -DSPEC_CPU_NO_HAS_SIGSETJMP')
python $(SRCROOT)/tools/llvmtestcheck.py --fpcmp $(FPCMP) --srcdir $(SRCROOT)/llvm-2.9/projects/test-suite/ --builddir $(BUILD)/llvm-tests/projects/test-suite/ > $(BUILD)/llvm-tests/passfail.txt
cp $(BUILD)/llvm-tests/passfail.txt $(BUILD)/passfail_spec.txt
cp -r $(BUILD)/llvm-tests/projects $(BUILD)/llvm-spec-tests
cmake:
rm -rf $(BUILD)/cmake
rm -rf $(SDK)/usr/cmake_junk
mkdir -p $(SDK)/usr/bin
mkdir -p $(BUILD)/cmake
mkdir -p $(SDK)/usr/cmake_junk
cp -r $(SRCROOT)/cmake-2.8.10.1/* $(BUILD)/cmake/
cd $(BUILD)/cmake && CC=$(CC) CXX=$(CXX) ./configure --prefix=$(SDK)/usr --docdir=cmake_junk --mandir=cmake_junk
cd $(BUILD)/cmake && CC=$(CC) CXX=$(CXX) $(MAKE) -j$(THREADS)
cd $(BUILD)/cmake && CC=$(CC) CXX=$(CXX) $(MAKE) install
make:
rm -rf $(BUILD)/make
mkdir -p $(SDK)/usr/bin
mkdir -p $(BUILD)/make
cp -r $(SRCROOT)/make-3.82/* $(BUILD)/make/
cd $(BUILD)/make && CC=$(CC) CXX=$(CXX) ./configure --prefix=$(SDK)/usr --program-prefix="" \
--build=$(BUILD_TRIPLE) --host=$(HOST_TRIPLE) --target=$(TRIPLE)
cd $(BUILD)/make && CC=$(CC) CXX=$(CXX) $(MAKE) -j$(THREADS)
cd $(BUILD)/make && CC=$(CC) CXX=$(CXX) $(MAKE) install
gcc:
rm -rf $(BUILD)/llvm-gcc-42
mkdir -p $(SDK)/usr/bin
mkdir -p $(SDK)/usr/lib
mkdir -p $(BUILD)/llvm-gcc-42
cd $(BUILD)/llvm-gcc-42 && CFLAGS='$(NOPIE) -DSHARED_LIBRARY_EXTENSION=$(SOEXT) $(BUILD_VER_DEFS) -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -Os $(DBGOPTS) -I$(SRCROOT)/avm2_env/misc/ ' \
CC=$(CC) CXX=$(CXX) $(SRCROOT)/llvm-gcc-4.2-2.9/configure --enable-languages=c,c++,objc,obj-c++ \
--enable-llvm=$(LLVMINSTALLPREFIX)/llvm-install/ --disable-bootstrap --disable-multilib --disable-libada \
--enable-sjlj-exceptions --disable-shared --program-prefix="" \
--prefix=$(SDK)/usr --with-sysroot="" --with-build-sysroot=$(SDK)/ \
--build=$(BUILD_TRIPLE) --host=$(HOST_TRIPLE) --target=$(TRIPLE)
cd $(BUILD)/llvm-gcc-42 && CC=$(CC) CXX=$(CXX) $(MAKE) -j$(THREADS) all-gcc \
CFLAGS_FOR_TARGET='$(NOPIE) -DSHARED_LIBRARY_EXTENSION=$(SOEXT) $(BUILD_VER_DEFS) -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -Os -emit-llvm -I$(SRCROOT)/avm2_env/misc/ ' \
CXXFLAGS_FOR_TARGET='$(NOPIE) -DSHARED_LIBRARY_EXTENSION=$(SOEXT) $(BUILD_VER_DEFS) -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -Os -emit-llvm -I$(SRCROOT)/avm2_env/misc/ ' && $(MAKE) install-gcc
rm -f $(SDK)/usr/bin/gccbug*
rm -f $(BUILD)/llvm-gcc-42/gcc/gccbug*
rm -rf $(SDK)/usr/lib/avm2-unknown-freebsd8
mv $(SDK)/usr/lib/gcc/* $(SDK)/usr/lib/
mv $(SDK)/usr/lib/avm2-unknown-freebsd8/4.2.1/*.a $(SDK)/usr/lib/
rmdir $(SDK)/usr/lib/gcc
$(RSYNC) $(SDK)/usr/libexec/gcc/avm2-unknown-freebsd8/4.2.1/ $(SDK)/usr/bin/
rm -rf $(SDK)/usr/libexec
csu:
$(RSYNC) avm2_env/usr/ $(BUILD)/lib/
cd $(BUILD)/lib/src/lib/csu/avm2 && $(BMAKE) SSP_CFLAGS="" MACHINE_ARCH=avm2 crt1_c.o
cp -f $(BUILD)/lib/src/lib/csu/avm2/crt1_c.o $(SDK)/usr/lib/.
stdlibs:
$(MAKE) -j$(THREADS) csu libc libthr libm libBlocksRuntime
libc:
mkdir -p $(BUILD)/posix/
rm -f $(BUILD)/posix/*.o
mkdir -p $(BUILD)/lib/src/lib/libc/
$(RSYNC) avm2_env/usr/ $(BUILD)/lib/
cd $(BUILD)/posix && python $(SRCROOT)/posix/gensyscalls.py $(SRCROOT)/posix/syscalls.changed
cp $(BUILD)/posix/IKernel.as $(SRCROOT)/avmplus/shell
cp $(BUILD)/posix/ShellPosix.as $(SRCROOT)/avmplus/shell
cp $(BUILD)/posix/ShellPosixGlue.cpp $(SRCROOT)/avmplus/shell
cp $(BUILD)/posix/ShellPosixGlue.h $(SRCROOT)/avmplus/shell
cd $(SRCROOT)/avmplus/shell && python ./shell_toplevel.py -config CONFIG::VMCFG_ALCHEMY_POSIX=true
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -c posix.c
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -c $(SRCROOT)/posix/vgl.c
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -D_KERNEL -c $(SRCROOT)/avm2_env/usr/src/kern/kern_umtx.c
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -I $(SRCROOT)/avm2_env/usr/src/lib/libc/include/ -c $(SRCROOT)/posix/thrStubs.c
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -c $(SRCROOT)/posix/kpmalloc.c
cd $(BUILD)/posix && cp *.o $(BUILD)/lib/src/lib/libc/
cd $(BUILD)/lib/src/lib/libc && $(BMAKE) -j$(THREADS) SSP_CFLAGS="" MACHINE_ARCH=avm2 libc.a
# find bitcode (and ignore non-bitcode genned from .s files) and put
# it in our lib
rm -f $(BUILD)/lib/src/lib/libc/tmp/*
$(AR) $(SDK)/usr/lib/libssp.a $(BUILD)/lib/src/lib/libc/stack_protector.o && cp $(SDK)/usr/lib/libssp.a $(SDK)/usr/lib/libssp_nonshared.a
# we override these in thrStubs.c but leave them weak
cd $(BUILD)/lib/src/lib/libc && $(SDK)/usr/bin/llvm-dis -o=_pthread_stubs.ll _pthread_stubs.o && sed -E 's/@pthread_(key_create|key_delete|getspecific|setspecific|once) =/@_d_u_m_m_y_\1 =/g' _pthread_stubs.ll | $(SDK)/usr/bin/llvm-as -o _pthread_stubs.o
cd $(BUILD)/lib/src/lib/libc && rm -f libc.a && find . -name '*.o' -exec sh -c 'file {} | grep -v 86 > /dev/null' \; -print | xargs $(AR) libc.a
cd $(BUILD)/posix && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -I $(SRCROOT)/avm2_env/usr/src/lib/libc/include/ -fexceptions -c $(SRCROOT)/posix/libcHack.c
cp -f $(BUILD)/lib/src/lib/libc/libc.a $(BUILD)/posix/libcHack.o $(SDK)/usr/lib/.
abcstdlibs:
$(MAKE) -j$(THREADS) abcflashpp abcstdlibs_more
abcflashpp:
$(SDK)/usr/bin/llc -gendbgsymtable -jvmopt=-Xmx4G -jvm="$(JAVA)" -falcon-parallel -target-player -filetype=obj $(BUILD)/as3wig/Flash++.o -o $(BUILD)/as3wig/Flash++.abc
$(SDK)/usr/bin/ar crus $(SDK)/usr/lib/stdlibs_abc/libFlash++.a $(BUILD)/as3wig/Flash++.abc
abcstdlibs_more:
mkdir -p $(SDK)/usr/lib/stdlibs_abc
$(SDK)/usr/bin/llc -gendbgsymtable -jvm="$(JAVA)" -falcon-parallel -filetype=obj $(SDK)/usr/lib/crt1_c.o -o $(SDK)/usr/lib/stdlibs_abc/crt1_c.o
$(SDK)/usr/bin/llc -gendbgsymtable -jvm="$(JAVA)" -falcon-parallel -filetype=obj $(SDK)/usr/lib/libm.o -o $(SDK)/usr/lib/stdlibs_abc/libm.o
$(SDK)/usr/bin/llc -gendbgsymtable -jvm="$(JAVA)" -falcon-parallel -filetype=obj $(SDK)/usr/lib/libcHack.o -o $(SDK)/usr/lib/stdlibs_abc/libcHack.o
mkdir -p $(BUILD)/libc_abc
cd $(BUILD)/libc_abc && $(SDK)/usr/bin/ar x $(SDK)/usr/lib/libc.a
cd $(BUILD)/libc_abc && cp -f $(SRCROOT)/avm2_env/misc/abcarchive.mk Makefile && SDK=$(SDK) $(MAKE) LLCOPTS=-jvm="$(JAVA)" -j$(THREADS)
mv $(BUILD)/libc_abc/test.a $(SDK)/usr/lib/stdlibs_abc/libc.a
mkdir -p $(BUILD)/libthr_abc
cd $(BUILD)/libthr_abc && $(SDK)/usr/bin/ar x $(SDK)/usr/lib/libthr.a
cd $(BUILD)/libthr_abc && cp -f $(SRCROOT)/avm2_env/misc/abcarchive.mk Makefile && SDK=$(SDK) $(MAKE) LLCOPTS=-jvm="$(JAVA)" -j$(THREADS)
mv $(BUILD)/libthr_abc/test.a $(SDK)/usr/lib/stdlibs_abc/libthr.a
mkdir -p $(BUILD)/libgcc_abc
cd $(BUILD)/libgcc_abc && $(SDK)/usr/bin/ar x $(SDK)/usr/lib/libgcc.a
cd $(BUILD)/libgcc_abc && cp -f $(SRCROOT)/avm2_env/misc/abcarchive.mk Makefile && SDK=$(SDK) $(MAKE) LLCOPTS=-jvm="$(JAVA)" -j$(THREADS)
mv $(BUILD)/libgcc_abc/test.a $(SDK)/usr/lib/stdlibs_abc/libgcc.a
mkdir -p $(BUILD)/libstdcpp_abc
cd $(BUILD)/libstdcpp_abc && $(SDK)/usr/bin/ar x $(SDK)/usr/lib/libstdc++.a
cd $(BUILD)/libstdcpp_abc && cp -f $(SRCROOT)/avm2_env/misc/abcarchive.mk Makefile && SDK=$(SDK) $(MAKE) LLCOPTS=-jvm="$(JAVA)" -j$(THREADS)
mv $(BUILD)/libstdcpp_abc/test.a $(SDK)/usr/lib/stdlibs_abc/libstdc++.a
mkdir -p $(BUILD)/libsupcpp_abc
cd $(BUILD)/libsupcpp_abc && $(SDK)/usr/bin/ar x $(SDK)/usr/lib/libsupc++.a
cd $(BUILD)/libsupcpp_abc && cp -f $(SRCROOT)/avm2_env/misc/abcarchive.mk Makefile && SDK=$(SDK) $(MAKE) LLCOPTS=-jvm="$(JAVA)" -j$(THREADS)
mv $(BUILD)/libsupcpp_abc/test.a $(SDK)/usr/lib/stdlibs_abc/libsupc++.a
# disable this until aliases work in our abc
# mkdir -p $(BUILD)/libgomp_abc
# cd $(BUILD)/libgomp_abc && $(SDK)/usr/bin/ar x $(SDK)/usr/lib/libgomp.a
# cd $(BUILD)/libgomp_abc && cp -f $(SRCROOT)/avm2_env/misc/abcarchive.mk Makefile && SDK=$(SDK) $(MAKE) LLCOPTS=-jvm="$(JAVA)" -j$(THREADS)
# mv $(BUILD)/libgomp_abc/test.a $(SDK)/usr/lib/stdlibs_abc/libgomp.a
mkdir -p $(BUILD)/libobjc_abc
cd $(BUILD)/libobjc_abc && $(SDK)/usr/bin/ar x $(SDK)/usr/lib/libobjc.a
cd $(BUILD)/libobjc_abc && cp -f $(SRCROOT)/avm2_env/misc/abcarchive.mk Makefile && SDK=$(SDK) $(MAKE) LLCOPTS=-jvm="$(JAVA)" -j$(THREADS)
mv $(BUILD)/libobjc_abc/test.a $(SDK)/usr/lib/stdlibs_abc/libobjc.a
mkdir -p $(BUILD)/libBlocksRuntime_abc
cd $(BUILD)/libBlocksRuntime_abc && $(SDK)/usr/bin/ar x $(SDK)/usr/lib/libBlocksRuntime.a
cd $(BUILD)/libBlocksRuntime_abc && cp -f $(SRCROOT)/avm2_env/misc/abcarchive.mk Makefile && SDK=$(SDK) $(MAKE) LLCOPTS=-jvm="$(JAVA)" -j$(THREADS)
mv $(BUILD)/libBlocksRuntime_abc/test.a $(SDK)/usr/lib/stdlibs_abc/libBlocksRuntime.a
extralibs:
$(MAKE) -j$(THREADS) zlib libvgl libjpeg libpng libsdl dmalloc libffi
extratools:
$(MAKE) -j$(THREADS) genfs gdb swig pkgconfig libtool
libiconv:
mkdir -p $(BUILD)/libiconv
cd $(BUILD)/libiconv && PATH=$(SDK)/usr/bin:$(PATH) $(SRCROOT)/libiconv-1.13.1/configure --prefix=$(SDK)/usr
cd $(BUILD)/libiconv && PATH=$(SDK)/usr/bin:$(PATH) $(MAKE) install
libffi:
mkdir -p $(BUILD)/libffi
cd $(BUILD)/libffi && PATH=$(SDK)/usr/bin:$(PATH) $(SRCROOT)/libffi-3.0.11/configure --prefix=$(SDK)/usr
cd $(BUILD)/libffi && PATH=$(SDK)/usr/bin:$(PATH) $(MAKE) install
libfficheck:
cd $(BUILD)/libffi/testsuite && PATH=$(SDK)/usr/bin:$(PATH) $(MAKE) check
libBlocksRuntime:
cd compiler_rt/BlocksRuntime && echo '#define HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT' > config.h && echo '#define HAVE_SYNC_BOOL_COMPARE_AND_SWAP_LONG' >> config.h
cd compiler_rt/BlocksRuntime && $(SDK)/usr/bin/gcc -emit-llvm -c data.c -o data.o
cd compiler_rt/BlocksRuntime && $(SDK)/usr/bin/gcc -emit-llvm -c runtime.c -o runtime.o
cd compiler_rt/BlocksRuntime && $(AR) $(SDK)/usr/lib/libBlocksRuntime.a data.o runtime.o
cp compiler_rt/BlocksRuntime/Block*.h $(SDK)/usr/include/
libvgl:
$(RSYNC) avm2_env/usr/ $(BUILD)/lib/
cd $(BUILD)/lib/src/lib/libvgl && $(BMAKE) -j$(THREADS) SSP_CFLAGS="" MACHINE_ARCH=avm2 libvgl.a
rm -f $(SDK)/usr/lib/libvgl.a
$(AR) $(SDK)/usr/lib/libvgl.a $(BUILD)/lib/src/lib/libvgl/*.o
libjpeg_configure:
rm -rf $(SRCROOT)/cached_build/libjpeg
mkdir -p $(SRCROOT)/cached_build/libjpeg
cd $(SRCROOT)/cached_build/libjpeg && PATH=$(SDK)/usr/bin:$(PATH) CC=gcc CXX=g++ CFLAGS=-O4 CXXFLAGS=-O4 $(SRCROOT)/jpeg-8c/configure \
--prefix=$(SDK)/usr --disable-shared --build=$(BUILD_TRIPLE) --host=$(TRIPLE) --target=$(TRIPLE)
perl -p -i -e 's~$(SRCROOT)/cached_build/libjpeg~FLASCC_BUILD_DIR~g' `grep -ril $(SRCROOT) cached_build/`
perl -p -i -e 's~$(SRCROOT)~FLASCC_SRC_DIR~g' `grep -ril $(SRCROOT) cached_build/`
libjpeg:
rm -rf $(BUILD)/libjpeg
mkdir -p $(BUILD)/libjpeg
cp -r $(SRCROOT)/cached_build/libjpeg $(BUILD)/
perl -p -i -e 's~FLASCC_BUILD_DIR~$(BUILD)/libjpeg~g' `grep -ril FLASCC_BUILD_DIR $(BUILD)/libjpeg/`
perl -p -i -e 's~FLASCC_SRC_DIR~$(SRCROOT)~g' `grep -ril FLASCC_SRC_DIR $(BUILD)/libjpeg/`
cd $(BUILD)/libjpeg && PATH=$(SDK)/usr/bin:$(PATH) $(MAKE) -j$(THREADS) libjpeg.la && PATH=$(SDK)/usr/bin:$(PATH) $(MAKE) install-libLTLIBRARIES install-includeHEADERS
cp -f $(SRCROOT)/cached_build/libjpeg/jconfig.h $(SDK)/usr/include/
rm -f $(SDK)/usr/lib/libjpeg.so
rm -f $(SDK)/usr/bin/avm2-unknown-freebsd8-jpegtran
rm -f $(SDK)/usr/bin/avm2-unknown-freebsd8-rdjpgcom
rm -f $(SDK)/usr/bin/avm2-unknown-freebsd8-wrjpgcom
rm -f $(SDK)/usr/bin/avm2-unknown-freebsd8-cjpeg
rm -f $(SDK)/usr/bin/avm2-unknown-freebsd8-djpeg
libpng_configure:
rm -rf $(SRCROOT)/cached_build/libpng
mkdir -p $(SRCROOT)/cached_build/libpng
cd $(SRCROOT)/cached_build/libpng && PATH=$(SDK)/usr/bin:$(PATH) CC=gcc CXX=g++ CFLAGS=-O4 CXXFLAGS=-O4 $(SRCROOT)/libpng-1.5.7/configure \
--prefix=$(SDK)/usr --disable-shared --build=$(BUILD_TRIPLE) --host=$(TRIPLE) --target=$(TRIPLE) --disable-dependency-tracking
perl -p -i -e 's~$(SRCROOT)/cached_build/libpng~FLASCC_BUILD_DIR~g' `grep -ril $(SRCROOT) cached_build/`
perl -p -i -e 's~$(SRCROOT)~FLASCC_SRC_DIR~g' `grep -ril $(SRCROOT) cached_build/`
libpng:
rm -rf $(BUILD)/libpng
mkdir -p $(BUILD)/libpng
cp -r $(SRCROOT)/cached_build/libpng $(BUILD)/
perl -p -i -e 's~FLASCC_BUILD_DIR~$(BUILD)/libpng~g' `grep -ril FLASCC_BUILD_DIR $(BUILD)/libpng/`
perl -p -i -e 's~FLASCC_SRC_DIR~$(SRCROOT)~g' `grep -ril FLASCC_SRC_DIR $(BUILD)/libpng/`
cd $(BUILD)/libpng && PATH=$(SDK)/usr/bin:$(PATH) $(MAKE) -j$(THREADS) && PATH=$(SDK)/usr/bin:$(PATH) $(MAKE) install
rm -f $(SDK)/usr/bin/libpng-config
cp -f $(SDK)/usr/bin/libpng15-config $(SDK)/usr/bin/libpng-config
rm -f $(SDK)/usr/lib/libpng.a
cp -f $(SDK)/usr/lib/libpng15.a $(SDK)/usr/lib/libpng.a
libm:
cd compiler_rt && $(MAKE) clean && $(MAKE) avm2 CC="$(SDK)/usr/bin/gcc -emit-llvm" RANLIB=$(SDK)/usr/bin/ranlib AR=$(SDK)/usr/bin/ar VERBOSE=1
$(SDK)/usr/bin/llvm-link -o $(BUILD)/libcompiler_rt.o compiler_rt/avm2/avm2/avm2/SubDir.lib/*.o
$(SDK)/usr/bin/nm $(BUILD)/libcompiler_rt.o | grep "T _" | sed 's/_//' | awk '{print $$3}' | sort | uniq > $(BUILD)/compiler_rt.txt
cat $(BUILD)/compiler_rt.txt >> $(SDK)/public-api.txt
cat $(SRCROOT)/llvm-2.9/lib/CodeGen/SelectionDAG/TargetLowering.cpp | grep "Names\[RTLIB::" | awk '{print $$3}' | sed 's/"//g' | sed 's/;//' | sort | uniq > $(BUILD)/rtlib.txt
cat avm2_env/rtlib-extras.txt >> $(BUILD)/rtlib.txt
rm -rf $(BUILD)/msun/ $(BUILD)/libmbc $(SDK)/usr/lib/libm.a $(SDK)/usr/lib/libm.o
mkdir -p $(BUILD)/msun
$(RSYNC) avm2_env/usr/src/lib/ $(BUILD)/msun/
cd $(BUILD)/msun/msun && $(BMAKE) -j$(THREADS) SSP_CFLAGS="" MACHINE_ARCH=avm2 libm.a
# find bitcode (and ignore non-bitcode genned from .s files) and put
# it in our lib
cd $(BUILD)/msun/msun && rm -f libm.a && find . -name '*.o' -exec sh -c 'file {} | grep -v 86 > /dev/null' \; -print | xargs $(AR) libm.a
# remove symbols for sin, cos, other things we support as intrinsics
cd $(BUILD)/msun/msun && $(SDK)/usr/bin/ar sd libm.a s_cos.o s_sin.o e_pow.o e_sqrt.o
$(SDK)/usr/bin/ar r $(SDK)/usr/lib/libm.a
mkdir -p $(BUILD)/libmbc
cd $(BUILD)/libmbc && $(SDK)/usr/bin/ar x $(BUILD)/msun/msun/libm.a
cd $(BUILD)/libmbc && $(SDK)/usr/bin/llvm-link -o $(BUILD)/libmbc/libm.o $(BUILD)/libcompiler_rt.o *.o
$(SDK)/usr/bin/opt -O3 -o $(SDK)/usr/lib/libm.o $(BUILD)/libmbc/libm.o
$(SDK)/usr/bin/nm $(SDK)/usr/lib/libm.o | grep "T _" | sed 's/_//' | awk '{print $$3}' | sort | uniq > $(BUILD)/libm.bc.txt
libthr:
rm -rf $(BUILD)/libthr
mkdir -p $(BUILD)/libthr
$(RSYNC) avm2_env/usr/src/lib/ $(BUILD)/libthr/
cd $(BUILD)/libthr/libthr && $(SDK)/usr/bin/gcc -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -c $(SRCROOT)/posix/thrHelpers.c
# CWARNFLAGS= because thr_exit() can return and pthread_exit() is marked noreturn (where?)...
cd $(BUILD)/libthr/libthr && $(BMAKE) -j$(THREADS) SSP_CFLAGS="" MACHINE_ARCH=avm2 CWARNFLAGS= libthr.a
# find bitcode (and ignore non-bitcode genned from .s files) and put
# it in our lib
cd $(BUILD)/libthr/libthr && rm -f libthr.a && find . -name '*.o' -exec sh -c 'file {} | grep -v 86 > /dev/null' \; -print | xargs $(AR) libthr.a
cp -f $(BUILD)/libthr/libthr/libthr.a $(SDK)/usr/lib/.
libobjc_configure:
cd $(BUILD)/llvm-gcc-42 \
&& $(MAKE) -j1 FLASCC_INTERNAL_SDK_ROOT=$(SDK) CFLAGS_FOR_TARGET='-O2 -emit-llvm -DSJLJ_EXCEPTIONS=1 ' CXXFLAGS_FOR_TARGET='-O2 -emit-llvm -DSJLJ_EXCEPTIONS=1 ' TARGET-target-libobjc="all OBJC_THREAD_FILE=thr-posix" all-target-libobjc > $(SRCROOT)/cached_build/libobjc/compile.log
cd $(BUILD)/llvm-gcc-42 \
&& $(MAKE) -j1 FLASCC_INTERNAL_SDK_ROOT=$(SDK) CFLAGS_FOR_TARGET='-O2 -emit-llvm -DSJLJ_EXCEPTIONS=1 ' CXXFLAGS_FOR_TARGET='-O2 -emit-llvm -DSJLJ_EXCEPTIONS=1 ' install-target-libobjc > $(SRCROOT)/cached_build/libobjc/install.log
perl -p -i -e 's~$(SRCROOT)~FLASCC_SRC_DIR~g' `grep -ril $(SRCROOT) cached_build/libobjc`
libobjc:
rm -rf $(BUILD)/libobjc
mkdir -p $(BUILD)/libobjc
python $(SRCROOT)/tools/build-objc.py $(SRCROOT)/cached_build/libobjc/compile.log $(SRCROOT)/cached_build/libobjc/install.log $(SRCROOT) > $(BUILD)/libobjc/build.sh
cd $(BUILD)/libobjc && PATH="$(SDK)/usr/bin:$(PATH)" bash -x build.sh
# link bitcode
cd $(BUILD)/libobjc && rm -f libobjc.a && mkdir NXConstStr && mv NXConstStr.o NXConstStr/. && $(SDK)/usr/bin/llvm-link -o libobjc.o *.o && $(AR) libobjc.a libobjc.o NXConstStr/*.o && cp libobjc.a $(SDK)/usr/lib/.
gcclibs:
rm -rf $(BUILD)/llvm-gcc-42/$(TRIPLE)
cd $(BUILD)/llvm-gcc-42 \
&& $(MAKE) -j$(THREADS) FLASCC_INTERNAL_SDK_ROOT=$(SDK) CFLAGS_FOR_TARGET='-O2 -emit-llvm ' CXXFLAGS_FOR_TARGET='-O2 -emit-llvm ' all-target-libstdc++-v3 all-target-libgomp \
&& $(MAKE) -j$(THREADS) FLASCC_INTERNAL_SDK_ROOT=$(SDK) install-target-libstdc++-v3 install-target-libgomp \
&& find $(SDK) -name '*.gch' -type d | xargs rm -rf
$(SDK)/usr/bin/ranlib $(SDK)/usr/lib/libstdc++.a
$(SDK)/usr/bin/ranlib $(SDK)/usr/lib/libsupc++.a
$(SDK)/usr/bin/ranlib $(SDK)/usr/lib/libgomp.a
cp -f $(SDK)/usr/lib/gcc/$(TRIPLE)/4.2.1/include/omp.h $(SDK)/usr/include/
rm -rf $(SDK)/usr/lib/gcc
$(MAKE) libobjc
mkdir -p $(SDK)/usr/lib/stdlibs_abc
cd $(BUILD)/posix && $(SDK)/usr/bin/g++ -emit-llvm -fno-stack-protector $(LIBHELPEROPTFLAGS) -c $(SRCROOT)/posix/AS3++.cpp
cd $(BUILD)/posix && $(SDK)/usr/bin/llc -gendbgsymtable -jvm="$(JAVA)" -falcon-parallel -filetype=obj AS3++.o -o AS3++.abc
cd $(BUILD)/posix && $(SDK)/usr/bin/ar crus $(SDK)/usr/lib/libAS3++.a AS3++.o
cd $(BUILD)/posix && $(SDK)/usr/bin/ar crus $(SDK)/usr/lib/stdlibs_abc/libAS3++.a AS3++.abc
dmalloc_configure:
rm -rf $(SRCROOT)/cached_build/dmalloc
mkdir -p $(SRCROOT)/cached_build/dmalloc
cd $(SRCROOT)/cached_build/dmalloc && PATH=$(SDK)/usr/bin:$(PATH) CC=gcc CXX=g++ $(SRCROOT)/dmalloc-5.5.2/configure \
--prefix=$(SDK)/usr --disable-shared --enable-static --build=$(BUILD_TRIPLE) --host=$(TRIPLE) --target=$(TRIPLE)
perl -p -i -e 's~$(SRCROOT)~FLASCC_SRC_DIR~g' `grep -ril $(SRCROOT) cached_build/dmalloc`
dmalloc:
rm -rf $(BUILD)/dmalloc
mkdir -p $(BUILD)/dmalloc
cp -r $(SRCROOT)/cached_build/dmalloc $(BUILD)/
perl -p -i -e 's~FLASCC_SRC_DIR~$(SRCROOT)~g' `grep -ril FLASCC_SRC_DIR $(BUILD)/dmalloc/`
cd $(BUILD)/dmalloc && PATH=$(SDK)/usr/bin:$(PATH) $(MAKE) -j1 threads cxx
cd $(BUILD)/dmalloc && PATH=$(SDK)/usr/bin:$(PATH) $(MAKE) -j1 installcxx installth
cd $(BUILD)/dmalloc && PATH=$(SDK)/usr/bin:$(PATH) $(MAKE) -j1 heavy
abclibobjc:
mkdir -p $(BUILD)/libobjc_abc
cd $(BUILD)/libobjc_abc && $(SDK)/usr/bin/ar x $(SDK)/usr/lib/libobjc.a
cd $(BUILD)/libobjc_abc && cp -f $(SRCROOT)/avm2_env/misc/abcarchive.mk Makefile && SDK=$(SDK) $(MAKE) LLCOPTS=-jvm="$(JAVA)" -j$(THREADS)
mv $(BUILD)/libobjc_abc/test.a $(SDK)/usr/lib/stdlibs_abc/libobjc.a
bmake:
rm -rf $(BUILD)/bmake
mkdir -p $(BUILD)/bmake
cd $(BUILD)/bmake && $(SRCROOT)/bmake/configure && bash make-bootstrap.sh
binutils:
rm -rf $(BUILD)/binutils
mkdir -p $(BUILD)/binutils
mkdir -p $(SDK)/usr
cd $(BUILD)/binutils && CC=$(CC) CXX=$(CXX) CFLAGS="-I$(SRCROOT)/avm2_env/misc/ $(DBGOPTS) " CXXFLAGS="-I$(SRCROOT)/avm2_env/misc/ $(DBGOPTS) " $(SRCROOT)/binutils/configure \
--disable-doc --enable-gold --disable-ld --enable-plugins \
--build=$(BUILD_TRIPLE) --host=$(HOST_TRIPLE) --target=$(TRIPLE) --with-sysroot=$(SDK)/usr \
--program-prefix="" --prefix=$(SDK)/usr --disable-werror \
--enable-targets=$(TRIPLE)
cd $(BUILD)/binutils && $(MAKE) -j$(THREADS) && $(MAKE) install
mv $(SDK)/usr/bin/ld.gold$(EXEEXT) $(SDK)/usr/bin/ld$(EXEEXT)
rm -rf $(SDK)/usr/bin/readelf$(EXEEXT) $(SDK)/usr/bin/elfedit$(EXEEXT) $(SDK)/usr/bin/ld.bfd$(EXEEXT) $(SDK)/usr/bin/objdump$(EXEEXT) $(SDK)/usr/bin/objcopy$(EXEEXT) $(SDK)/usr/share/info $(SDK)/usr/share/man
cxxfiltmingw:
# install the version of mingw for osx from ere: http://crossgcc.rts-software.org/doku.php
rm -rf $(BUILD)/cxxfiltmingw
mkdir -p $(BUILD)/cxxfiltmingw
cd $(BUILD)/cxxfiltmingw && CC=$(SRCROOT)/mingwmac/sdk/usr/bin/$(MINGWTRIPLE)-gcc \
AR=$(SRCROOT)/mingwmac/sdk/usr/bin/$(MINGWTRIPLE)-ar CXX=$(SRCROOT)/mingwmac/sdk/usr/bin/$(MINGWTRIPLE)-g++ \
CFLAGS="-I$(SRCROOT)/avm2_env/misc/ $(DBGOPTS) -DMINGW_MONOCLE_HACKS " \
CXXFLAGS="-I$(SRCROOT)/avm2_env/misc/ $(DBGOPTS) -DMINGW_MONOCLE_HACKS " $(SRCROOT)/binutils/configure \
--disable-doc --disable-gold --disable-ld --disable-plugins \
--build=$(BUILD_TRIPLE) --host=$(MINGWTRIPLE) --target=$(MINGWTRIPLE) \
--program-prefix="" --disable-werror \
--enable-targets=$(TRIPLE)
-cd $(BUILD)/cxxfiltmingw && $(MAKE) -j$(THREADS)
-cd $(BUILD)/cxxfiltmingw && $(SRCROOT)/mingwmac/sdk/usr/bin/$(MINGWTRIPLE)-gcc -DMINGW_MONOCLE_HACKS \
-I$(BUILD)/cxxfiltmingw/binutils -I$(BUILD)/cxxfiltmingw/bfd -I$(SRCROOT)/binutils/include \
-I$(BUILD)/cxxfiltmingw/intl $(SRCROOT)/binutils/binutils/cxxfilt.c \
$(BUILD)/cxxfiltmingw/libiberty/*.o $(BUILD)/cxxfiltmingw/intl/*.o $(BUILD)/cxxfiltmingw/binutils/version.o \
$(BUILD)/cxxfiltmingw/binutils/bucomm.o $(BUILD)/cxxfiltmingw/bfd/*.o -o c++filt.exe
tr:
rm -rf $(BUILD)/tr
mkdir -p $(BUILD)/tr
mkdir -p $(SDK)/usr/bin
cd $(BUILD)/tr && rm -f Makefile && AR=$(NATIVE_AR) CC=$(CC) CXX=$(CXX) $(TAMARINCONFIG) --disable-debugger
cd $(BUILD)/tr && AR=$(NATIVE_AR) CC=$(CC) CXX=$(CXX) $(MAKE) -j$(THREADS)
cp -f $(BUILD)/tr/shell/avmshell $(SDK)/usr/bin/avmshell
cd $(SRCROOT)/avmplus/utils && curdir=$(SRCROOT)/avmplus/utils ASC=$(ASC) $(MAKE) -f manifest.mk utils
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(call nativepath,$(SRCROOT)/avmplus/utils/projectormake.as) -outdir . -out projectormake
#ifeq (,$(findstring cygwin,$(PLATFORM)))
# $(SDK)/usr/bin/avmshell $(BUILD)/abclibs/projectormake.abc -- -o $(SDK)/usr/bin/abcdump$(EXEEXT) $(SDK)/usr/bin/avmshell $(SRCROOT)/avmplus/utils/abcdump.abc -- -Djitordie
# chmod a+x $(SDK)/usr/bin/abcdump$(EXEEXT)
#endif
trd:
rm -rf $(BUILD)/trd
mkdir -p $(BUILD)/trd
mkdir -p $(SDK)/usr/bin
cd $(BUILD)/trd && rm -f Makefile && AR=$(NATIVE_AR) CC=$(CC) CXX=$(CXX) $(TAMARINCONFIG) --enable-debugger
cd $(BUILD)/trd && AR=$(NATIVE_AR) CC=$(CC) CXX=$(CXX) $(MAKE) -j$(THREADS)
cp -f $(BUILD)/trd/shell/avmshell $(SDK)/usr/bin/avmshell-release-debugger
plugins:
rm -rf $(BUILD)/makeswf $(BUILD)/multiplug $(BUILD)/zlib
mkdir -p $(BUILD)/makeswf $(BUILD)/multiplug $(BUILD)/zlib
cd $(BUILD)/makeswf && $(CXX) $(DBGOPTS) -I$(SRCROOT)/avm2_env/misc/ -DHAVE_ABCNM -DDEFTMPDIR=\"$(call nativepath,/tmp)\" -DDEFSYSROOT=\"$(call nativepath,$(SDK))\" -DHAVE_STDINT_H -I$(SRCROOT)/zlib-1.2.5/ -I$(SRCROOT)/binutils/include -c $(SRCROOT)/gold-plugins/makeswf.cpp
cd $(BUILD)/makeswf && $(CXX) $(DBGOPTS) -shared -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup -o makeswf$(SOEXT) makeswf.o
cd $(BUILD)/multiplug && $(CXX) $(DBGOPTS) -I$(SRCROOT)/avm2_env/misc/ -DHAVE_STDINT_H -DSOEXT=\"$(SOEXT)\" -DDEFSYSROOT=\"$(call nativepath,$(SDK))\" -I$(SRCROOT)/binutils/include -c $(SRCROOT)/gold-plugins/multiplug.cpp
cd $(BUILD)/multiplug && $(CXX) $(DBGOPTS) -shared -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup -o multiplug$(SOEXT) multiplug.o
cp -f $(BUILD)/makeswf/makeswf$(SOEXT) $(SDK)/usr/lib/makeswf$(SOEXT)
cp -f $(BUILD)/multiplug/multiplug$(SOEXT) $(SDK)/usr/lib/multiplug$(SOEXT)
cp -f $(BUILD)/multiplug/multiplug$(SOEXT) $(SDK)/usr/lib/bfd-plugins/multiplug$(SOEXT)
basictools:
$(MAKE) -j$(THREADS) uname noenv avm2-as alctool alcdb
uname:
mkdir -p $(SDK)/usr/bin
$(CC) $(SRCROOT)/tools/uname/uname.c -o $(SDK)/usr/bin/uname$(EXEEXT)
noenv:
mkdir -p $(SDK)/usr/bin
$(CC) $(SRCROOT)/tools/noenv/noenv.c -o $(SDK)/usr/bin/noenv$(EXEEXT)
avm2-as:
mkdir -p $(SDK)/usr/bin
$(CXX) $(SRCROOT)/avm2_env/misc/SetAlchemySDKLocation.c $(SRCROOT)/tools/as/as.cpp -o $(SDK)/usr/bin/avm2-as$(EXEEXT)
as3wig:
rm -rf $(BUILD)/as3wig
mkdir -p $(BUILD)/as3wig/flascc
cp -f $(SRCROOT)/tools/aet/AS3Wig.java $(BUILD)/as3wig/flascc/.
cp -f $(SRCROOT)/tools/common/java/flascc/*.java $(BUILD)/as3wig/flascc/.
cd $(BUILD)/as3wig && javac flascc/*.java -cp $(call nativepath,$(SDK)/usr/lib/aet.jar)
cd $(BUILD)/as3wig && echo "Main-Class: flascc.AS3Wig" > MANIFEST.MF
cd $(BUILD)/as3wig && echo "Class-Path: aet.jar" >> MANIFEST.MF
cd $(BUILD)/as3wig && jar cmf MANIFEST.MF as3wig.jar flascc/*.class
cp $(BUILD)/as3wig/as3wig.jar $(SDK)/usr/lib/.
mkdir -p $(SDK)/usr/include/AS3++/
cp -f $(SRCROOT)/tools/aet/AS3Wig.h $(SDK)/usr/include/AS3++/AS3Wig.h
java -jar $(SDK)/usr/lib/as3wig.jar -builtins -i $(SDK)/usr/lib/builtin.abc -o $(SDK)/usr/include/AS3++/builtin
java -jar $(SDK)/usr/lib/as3wig.jar -builtins -i $(SDK)/usr/lib/playerglobal.abc -o $(SDK)/usr/include/AS3++/playerglobal
cp -f $(SRCROOT)/tools/aet/AS3Wig.cpp $(BUILD)/as3wig/
echo "#include <AS3++/builtin.h>\n" > $(BUILD)/as3wig/AS3WigIncludes.h
echo "#include <AS3++/playerglobal.h>\n" >> $(BUILD)/as3wig/AS3WigIncludes.h
cd $(BUILD)/as3wig && $(SDK)/usr/bin/g++ -c -emit-llvm -I. AS3Wig.cpp -o Flash++.o
cd $(BUILD)/as3wig && $(SDK)/usr/bin/ar crus $(SDK)/usr/lib/libFlash++.a Flash++.o
alctool:
rm -rf $(BUILD)/alctool
mkdir -p $(BUILD)/alctool/flascc
cp -f $(SRCROOT)/tools/lib/*.jar $(SDK)/usr/lib/
cp -f $(SRCROOT)/tools/lib/falcon.txt $(SDK)/usr/lib/.
rm -f $(SDK)/usr/lib/mxmlc.jar
cp -f $(SRCROOT)/tools/aet/*.java $(BUILD)/alctool/flascc/.
cp -f $(SRCROOT)/tools/common/java/flascc/*.java $(BUILD)/alctool/flascc/.
cd $(BUILD)/alctool && javac flascc/*.java -cp $(call nativepath,$(SRCROOT)/tools/lib/aet.jar)
cd $(BUILD)/alctool && echo "Main-Class: flascc.AlcTool" > MANIFEST.MF
cd $(BUILD)/alctool && echo "Class-Path: aet.jar" >> MANIFEST.MF
cd $(BUILD)/alctool && jar cmf MANIFEST.MF alctool.jar flascc/*.class
cp $(BUILD)/alctool/alctool.jar $(SDK)/usr/lib/.
alcdb:
rm -rf $(BUILD)/alcdb
mkdir -p $(BUILD)/alcdb/flascc
cp -f $(SRCROOT)/tools/alcdb/*.java $(BUILD)/alcdb/flascc/.
cp -f $(SRCROOT)/tools/common/java/flascc/*.java $(BUILD)/alcdb/flascc/.
cd $(BUILD)/alcdb && javac flascc/*.java -cp $(call nativepath,$(SRCROOT)/tools/lib/fdb.jar)
cd $(BUILD)/alcdb && echo "Main-Class: flascc.AlcDB" > MANIFEST.MF
cd $(BUILD)/alcdb && echo "Class-Path: fdb.jar" >> MANIFEST.MF
cd $(BUILD)/alcdb && jar cmf MANIFEST.MF alcdb.jar flascc/*.class
cp $(BUILD)/alcdb/alcdb.jar $(SDK)/usr/lib/.
builtinabcs:
cd $(SRCROOT)/avmplus/core && ./builtin.py
cd $(SRCROOT)/avmplus/shell && ./shell_toplevel.py
base:
mkdir -p $(BUILDROOT)/extra
mkdir -p $(BUILD)/abclibs
mkdir -p $(SDK)/usr/lib/bfd-plugins
mkdir -p $(SDK)/usr/share
mkdir -p $(SDK)/usr/platform/$(PLATFORM)/bin
mkdir -p $(SDK)/usr/platform/$(PLATFORM)/libexec/gcc/$(TRIPLE)
$(LN) ../usr $(SDK)/usr/$(TRIPLE)
$(LN) $(PLATFORM) $(SDK)/usr/platform/current
$(LN) platform/current/bin $(SDK)/usr/bin
$(LN) ../ $(SDK)/usr/platform/usr
$(LN) ../../lib $(SDK)/usr/platform/current/lib
$(LN) platform/current/libexec $(SDK)/usr/libexec
$(LN) ../../../../../lib $(SDK)/usr/platform/current/libexec/gcc/$(TRIPLE)/lib
cd $(SDK)/usr/platform/current/bin && $(LN) ar$(EXEEXT) avm2-unknown-freebsd8-ar$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) nm$(EXEEXT) avm2-unknown-freebsd8-nm$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) strip$(EXEEXT) avm2-unknown-freebsd8-strip$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) ranlib$(EXEEXT) avm2-unknown-freebsd8-ranlib$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) gcc$(EXEEXT) avm2-unknown-freebsd8-gcc$(EXEEXT)
cd $(SDK)/usr/platform/current/bin && $(LN) g++$(EXEEXT) avm2-unknown-freebsd8-g++$(EXEEXT)
mkdir -p $(BUILD)/ccachebin
mkdir -p ccache
$(LN) `which ccache` $(BUILD)/ccachebin/$(CC)
$(LN) `which ccache` $(BUILD)/ccachebin/$(CXX)
$(LN) `which ccache` $(BUILD)/ccachebin/$(CYGTRIPLE)-gcc
$(LN) `which ccache` $(BUILD)/ccachebin/$(CYGTRIPLE)-g++
$(LN) `which ccache` $(BUILD)/ccachebin/$(MINGTRIPLE)-gcc
$(LN) `which ccache` $(BUILD)/ccachebin/$(MINGTRIPLE)-g++
$(RSYNC) asc/abc/playerglobal.abc $(SDK)/usr/lib/
$(RSYNC) asc/abc/playerglobal.swc $(SDK)/usr/lib/
$(RSYNC) avm2_env/public-api.txt $(SDK)/
cp -f avmplus/generated/*.abc $(SDK)/usr/lib/
$(RSYNC) --exclude '*iconv.h' avm2_env/usr/include/ $(SDK)/usr/include
$(RSYNC) avm2_env/usr/lib/ $(SDK)/usr/lib
cd $(BUILD) && $(SCOMPFALCON) $(call nativepath,$(SRCROOT)/avmplus/utils/swfmake.as) -outdir . -out swfmake
cd $(BUILD) && $(SCOMPFALCON) $(call nativepath,$(SRCROOT)/avmplus/utils/projectormake.as) -outdir . -out projectormake
abclibs_compile:
mkdir -p $(BUILD)/abclibs
mkdir -p $(BUILD)/abclibsposix
mkdir -p $(SDK)/usr/lib/abcs
# Just use this to get the Posix interface
cd $(BUILD)/abclibsposix && python $(SRCROOT)/posix/gensyscalls.py $(SRCROOT)/posix/syscalls.changed
cat $(BUILD)/abclibsposix/IKernel.as | sed '1,1d' | sed '$$d' > $(SRCROOT)/posix/IKernel.as
cd $(BUILD)/abclibs && $(SCOMP) $(ABCLIBOPTS) -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath,$(SRCROOT)/posix/DefaultPreloader.as) -swf com.adobe.flascc.preloader.DefaultPreloader,1024,768,60 -outdir . -out DefaultPreloader
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize $(call nativepath,$(SRCROOT)/posix/ELF.as) -outdir . -out ELF
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize $(call nativepath,$(SRCROOT)/posix/Exit.as) -outdir . -out Exit
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize $(call nativepath,$(SRCROOT)/posix/LongJmp.as) -outdir . -out LongJmp
cd $(BUILD)/abclibs && $(SCOMP) $(ABCLIBOPTS) -import Exit.abc $(call nativepath,$(SRCROOT)/posix/C_Run.as) -outdir . -out C_Run
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize $(call nativepath,$(SRCROOT)/posix/vfs/ISpecialFile.as) -outdir . -out ISpecialFile
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize $(call nativepath,$(SRCROOT)/posix/vfs/IBackingStore.as) -outdir . -out IBackingStore
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) -import IBackingStore.abc $(call nativepath,$(SRCROOT)/posix/vfs/InMemoryBackingStore.as) -outdir . -out InMemoryBackingStore
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) -import IBackingStore.abc -import ISpecialFile.abc $(call nativepath,$(SRCROOT)/posix/vfs/IVFS.as) -outdir . -out IVFS
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) -import ISpecialFile.abc -import IBackingStore.abc -import IVFS.abc -import InMemoryBackingStore.abc $(call nativepath,$(SRCROOT)/posix/vfs/DefaultVFS.as) -outdir . -out DefaultVFS
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath, `find $(SRCROOT)/posix/vfs/nochump -name "*.as"`) -outdir . -out AlcVFSZip
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -import Exit.abc -import C_Run.abc -import IBackingStore.abc -import ISpecialFile.abc -import IVFS.abc -import LongJmp.abc $(call nativepath,$(SRCROOT)/posix/CModule.as) -outdir . -out CModule
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import C_Run.abc -import Exit.abc -import ELF.abc $(call nativepath,$(SRCROOT)/posix/AlcDbgHelper.as) -d -outdir . -out AlcDbgHelper
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath,$(SRCROOT)/posix/BinaryData.as) -outdir . -out BinaryData
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import C_Run.abc -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath,$(SRCROOT)/posix/Console.as) -outdir . -out Console
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import C_Run.abc -import Exit.abc -import ELF.abc $(call nativepath,$(SRCROOT)/posix/startHack.as) -outdir . -out startHack
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import C_Run.abc $(call nativepath,$(SRCROOT)/posix/ShellCreateWorker.as) -outdir . -out ShellCreateWorker
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import IBackingStore.abc -import IVFS.abc -import ISpecialFile.abc -import CModule.abc -import C_Run.abc -import Exit.abc -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath,$(SRCROOT)/posix/PlayerCreateWorker.as) -outdir . -out PlayerCreateWorker
cd $(BUILD)/abclibs && $(SCOMPFALCON) $(ABCLIBOPTS) -strict -optimize -import CModule.abc -import C_Run.abc -import Exit.abc -import IBackingStore.abc -import ISpecialFile.abc -import IVFS.abc -import DefaultVFS.abc -import $(call nativepath,$(SDK)/usr/lib/playerglobal.abc) $(call nativepath,$(SRCROOT)/posix/PlayerKernel.as) -outdir . -out PlayerKernel
cp $(BUILD)/abclibs/*.abc $(SDK)/usr/lib
cp $(BUILD)/abclibs/*.swf $(SDK)/usr/lib
libsdl_configure:
rm -rf $(SRCROOT)/cached_build/libsdl
mkdir -p $(SRCROOT)/cached_build/libsdl
cd $(SRCROOT)/cached_build/libsdl && PATH='$(SDK)/usr/bin:$(PATH)' CC=gcc CXX=g++ CFLAGS=-O4 CXXFLAGS=-O4 $(SRCROOT)/SDL-1.2.14/configure \
--host=$(TRIPLE) --prefix=$(SDK)/usr --disable-pthreads --disable-alsa --disable-video-x11 \
--disable-cdrom --disable-loadso --disable-assembly --disable-esd --disable-arts --disable-nas \
--disable-nasm --disable-altivec --disable-dga --disable-screensaver --disable-sdl-dlopen \
--disable-directx --enable-joystick --enable-video-vgl --enable-static --disable-shared
perl -p -i -e 's~$(SRCROOT)~FLASCC_SRC_DIR~g' `grep -ril $(SRCROOT) cached_build/`
rm $(SRCROOT)/cached_build/libsdl/config.status
libsdl:
rm -rf $(BUILD)/libsdl
mkdir -p $(BUILD)/libsdl
cp -r $(SRCROOT)/cached_build/libsdl $(BUILD)/
perl -p -i -e 's~FLASCC_SRC_DIR~$(SRCROOT)~g' `grep -ril FLASCC_SRC_DIR $(BUILD)/libsdl/`
cd $(BUILD)/libsdl && PATH='$(SDK)/usr/bin:$(PATH)' $(MAKE) -j$(THREADS)
cd $(BUILD)/libsdl && PATH='$(SDK)/usr/bin:$(PATH)' $(MAKE) install
$(MAKE) libsdl-install
rm $(SDK)/usr/include/SDL/SDL_opengl.h
libsdl-install:
cp $(SRCROOT)/tools/sdl-config $(SDK)/usr/bin/. # install our custom sdl-config
chmod a+x $(SDK)/usr/bin/sdl-config
pkgconfig:
rm -rf $(BUILD)/pkgconfig