-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathMakefile
1672 lines (1450 loc) · 57 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
## high-level setup ##
JULIAHOME = $(abspath ..)
include Versions.make
include $(JULIAHOME)/Make.inc
CONFIGURE_COMMON = --prefix=$(abspath $(build_prefix)) --build=$(BUILD_MACHINE) --libdir=$(abspath $(build_libdir))
ifneq ($(XC_HOST),)
CONFIGURE_COMMON += --host=$(XC_HOST)
endif
ifeq ($(OS),WINNT)
ifneq ($(USEMSVC), 1)
CONFIGURE_COMMON += LDFLAGS=-Wl,--stack,8388608
endif
endif
CONFIGURE_COMMON += F77="$(FC)" CC="$(CC)" CXX="$(CXX)"
# If the top-level Makefile is called with environment variables,
# they will override the values passed above to ./configure
MAKE_COMMON = DESTDIR="" prefix=$(build_prefix) bindir=$(build_bindir) libdir=$(build_libdir) libexecdir=$(build_libexecdir) datarootdir=$(build_datarootdir) includedir=$(build_includedir) sysconfdir=$(build_sysconfdir)
#autoconf configure-driven scripts: llvm pcre arpack fftw unwind gmp mpfr patchelf uv
#custom Makefile rules: openlibm Rmath dsfmt suitesparse-wrapper suitesparse lapack openblas mojibake
# prevent installing libs into usr/lib64 on opensuse
unexport CONFIG_SITE
STAGE1_DEPS =
STAGE2_DEPS = Rmath
STAGE3_DEPS = suitesparse-wrapper
ifeq ($(USE_SYSTEM_LIBUV), 0)
STAGE1_DEPS += uv
endif
ifeq ($(USE_SYSTEM_LIBUNWIND), 0)
ifeq ($(OS), Linux)
STAGE1_DEPS += unwind
else ifeq ($(OS), FreeBSD)
STAGE1_DEPS += unwind
else ifeq ($(OS), Darwin)
STAGE1_DEPS += osxunwind
endif
endif
ifeq ($(OS), Linux)
ifeq ($(shell which patchelf 2>/dev/null),)
STAGE1_DEPS += patchelf
PATCHELF=$(build_bindir)/patchelf
else
PATCHELF=patchelf
endif
endif
## USE_SYSTEM_LIBS options
ifeq ($(USE_SYSTEM_OPENLIBM), 0)
ifeq ($(USE_SYSTEM_LIBM), 0)
STAGE1_DEPS += openlibm
endif
endif
ifeq ($(USE_SYSTEM_OPENSPECFUN), 0)
STAGE1_DEPS += openspecfun
endif
ifeq ($(USE_SYSTEM_DSFMT), 0)
STAGE1_DEPS += dsfmt
endif
ifeq ($(USE_SYSTEM_LLVM), 0)
STAGE1_DEPS += llvm
endif
ifeq ($(USE_SYSTEM_PCRE), 0)
STAGE1_DEPS += pcre
endif
ifeq ($(USE_SYSTEM_BLAS), 0)
STAGE1_DEPS += openblas
endif
ifeq ($(USE_SYSTEM_FFTW), 0)
STAGE1_DEPS += fftw
endif
ifeq ($(USE_SYSTEM_GMP), 0)
STAGE1_DEPS += gmp
endif
ifeq ($(USE_SYSTEM_MPFR), 0)
STAGE2_DEPS += mpfr
ifeq ($(USE_SYSTEM_GMP), 0)
MPFR_OPTS = --with-gmp-include=$(abspath $(build_includedir)) --with-gmp-lib=$(abspath $(build_shlibdir))
endif
endif
ifeq ($(BUILD_OS),WINNT)
ifeq ($(OS),WINNT)
MPFR_OPTS += --disable-thread-safe CFLAGS="-DNPRINTF_L -DNPRINTF_T -DNPRINTF_J"
endif
endif
ifeq ($(USE_SYSTEM_ARPACK), 0)
STAGE2_DEPS += arpack
endif
ifeq ($(USE_SYSTEM_SUITESPARSE), 0)
STAGE2_DEPS += suitesparse
endif
ifeq ($(USE_SYSTEM_MOJIBAKE), 0)
STAGE2_DEPS += mojibake
endif
# Only compile standalone LAPACK if we are not using OpenBLAS.
# OpenBLAS otherwise compiles LAPACK as part of its build.
# This is useful where one wants to use the vendor BLAS, but
# build LAPACK as the vendor LAPACK may be too old (eg. Apple vecLib)
ifeq ($(USE_SYSTEM_BLAS), 1)
ifeq ($(USE_SYSTEM_LAPACK), 0)
STAGE2_DEPS += lapack
endif
endif
#Platform specific flags
ifeq ($(OS), WINNT)
LIBTOOL_CCLD = CCLD="$(CC) -no-undefined -avoid-version"
endif
## Common build target prefixes
DEP_LIBS = $(STAGE1_DEPS) $(STAGE2_DEPS) $(STAGE3_DEPS)
default: $(build_prefix) install
get: $(addprefix get-, $(DEP_LIBS))
configure: $(addprefix configure-, $(DEP_LIBS))
compile: $(addprefix compile-, $(DEP_LIBS))
check: $(addprefix check-, $(DEP_LIBS))
install: $(addprefix install-, $(DEP_LIBS))
cleanall: $(addprefix clean-, $(DEP_LIBS))
distcleanall: $(addprefix distclean-, $(DEP_LIBS))
rm -rf $(build_prefix)
getall: get-llvm get-uv get-pcre get-openlibm get-openspecfun get-dsfmt get-Rmath get-openblas get-lapack get-fftw get-suitesparse get-arpack get-unwind get-osxunwind get-gmp get-mpfr get-patchelf get-mojibake get-virtualenv
## PATHS ##
# sort is used to remove potential duplicates
DIRS = $(sort $(build_bindir) $(build_libdir) $(build_includedir) $(build_sysconfdir) $(build_datarootdir))
$(foreach dir,$(DIRS),$(eval $(call dir_target,$(dir))))
$(build_prefix): $(DIRS)
## LLVM ##
LLVM_GIT_URL_BASE ?= http://llvm.org/git
LLVM_GIT_URL_LLVM ?= $(LLVM_GIT_URL_BASE)/llvm.git
LLVM_GIT_URL_CLANG ?= $(LLVM_GIT_URL_BASE)/clang.git
LLVM_GIT_URL_COMPILER_RT ?= $(LLVM_GIT_URL_BASE)/compiler-rt.git
LLVM_GIT_URL_LLDB ?= $(LLVM_GIT_URL_BASE)/lldb.git
LLVM_GIT_URL_LIBCXX ?= $(LLVM_GIT_URL_BASE)/libcxx.git
LLVM_GIT_URL_LIBCXXABI ?= $(LLVM_GIT_URL_BASE)/libcxxabi.git
ifeq ($(BUILD_LLDB), 1)
BUILD_LLVM_CLANG = 1
# because it's a build requirement
endif
ifeq ($(LLVM_DEBUG),1)
LLVM_BUILDTYPE = Debug
else
LLVM_BUILDTYPE = Release
endif
ifeq ($(LLVM_ASSERTIONS),1)
LLVM_BUILDTYPE := $(LLVM_BUILDTYPE)+Asserts
endif
LLVM_FLAVOR := $(LLVM_BUILDTYPE)
ifeq ($(LLVM_SANITIZE),1)
LLVM_BUILDTYPE := $(LLVM_BUILDTYPE)+Sanitize
endif
LLVM_LIB_FILE = libLLVMCodeGen.a
LLVM_OBJ_SOURCE = llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE)/$(LLVM_FLAVOR)/lib/$(LLVM_LIB_FILE)
LLVM_OBJ_TARGET = $(build_libdir)/$(LLVM_LIB_FILE)
ifneq ($(LLVM_VER),svn)
ifeq ($(LLVM_VER), 3.3)
LLVM_TAR=llvm-$(LLVM_VER).src.tar.gz
else
LLVM_TAR=llvm-$(LLVM_VER).src.tar.xz
endif
ifeq ($(BUILD_LLVM_CLANG),1)
ifeq ($(LLVM_VER), 3.0)
LLVM_CLANG_TAR=clang-$(LLVM_VER).tar.gz
LLVM_COMPILER_RT_TAR=
else ifeq ($(LLVM_VER), 3.3)
LLVM_CLANG_TAR=cfe-$(LLVM_VER).src.tar.gz
LLVM_COMPILER_RT_TAR=compiler-rt-$(LLVM_VER).src.tar.gz
else ifeq ($(LLVM_VER), 3.5.0)
LLVM_CLANG_TAR=cfe-$(LLVM_VER).src.tar.xz
LLVM_COMPILER_RT_TAR=compiler-rt-$(LLVM_VER).src.tar.xz
else
LLVM_CLANG_TAR=clang-$(LLVM_VER).src.tar.gz
LLVM_COMPILER_RT_TAR=compiler-rt-$(LLVM_VER).src.tar.gz
endif
else
LLVM_CLANG_TAR=
LLVM_COMPILER_RT_TAR=
LLVM_LIBCXX_TAR=
endif
endif
ifeq ($(BUILD_CUSTOM_LIBCXX),1)
ifneq ($(LLVM_VER),svn)
LLVM_LIBCXX_TAR=libcxx-$(LLVM_VER).src.tar.gz
endif
endif
LLVM_CXXFLAGS = $(CXXFLAGS)
LLVM_CPPFLAGS = $(CPPFLAGS)
LLVM_LDFLAGS = $(LDFLAGS)
LLVM_TARGET_FLAGS= --enable-targets=host
LLVM_FLAGS += --disable-profiling --enable-shared --enable-static $(LLVM_TARGET_FLAGS) --disable-bindings --disable-docs
LLVM_MFLAGS =
ifeq ($(LLVM_ASSERTIONS), 1)
LLVM_FLAGS += --enable-assertions
ifeq ($(OS), WINNT)
LLVM_FLAGS += --disable-embed-stdcxx
endif
else
LLVM_FLAGS += --disable-assertions
endif
ifeq ($(LLVM_DEBUG), 1)
LLVM_FLAGS += --disable-optimized --enable-debug-symbols --enable-keep-symbols
else
LLVM_FLAGS += --enable-optimized
endif
ifeq ($(USE_LIBCPP), 1)
LLVM_FLAGS += --enable-libcpp
endif
ifeq ($(OS), WINNT)
LLVM_FLAGS += --with-extra-ld-options="-Wl,--stack,8388608" LDFLAGS="" --disable-shared
LLVM_CPPFLAGS += -D__USING_SJLJ_EXCEPTIONS__ -D__CRT__NO_INLINE
endif
ifeq ($(USE_INTEL_JITEVENTS), 1)
LLVM_FLAGS += --with-intel-jitevents
ifeq ($(OS), WINNT)
LLVM_FLAGS += --disable-threads
endif
else
LLVM_FLAGS += --disable-threads
endif
ifeq ($(BUILD_LLDB),1)
ifeq ($(USECLANG),1)
LLVM_FLAGS += --enable-cxx11
else
LLVM_CXXFLAGS += -std=c++0x
endif
ifeq ($(LLDB_DISABLE_PYTHON),1)
LLVM_CXXFLAGS += -DLLDB_DISABLE_PYTHON
endif
endif
ifeq ($(ARCH), ppc64)
LLVM_CXXFLAGS += -mminimal-toc
endif
ifeq ($(LLVM_SANITIZE),1)
LLVM_CC = CFLAGS="-fsanitize=address"
LLVM_LDFLAGS += -fsanitize=address
LLVM_CXXFLAGS += -fsanitize=address
LLVM_MFLAGS += TOOL_NO_EXPORTS= HAVE_LINK_VERSION_SCRIPT=0
else
LLVM_CC =
endif
ifneq ($(LLVM_CXXFLAGS),)
LLVM_FLAGS += CXXFLAGS="$(LLVM_CXXFLAGS)"
LLVM_MFLAGS += CXXFLAGS="$(LLVM_CXXFLAGS)"
endif
LLVM_MFLAGS += $(LLVM_CC)
ifeq ($(BUILD_CUSTOM_LIBCXX),1)
LLVM_LDFLAGS += -Wl,-R$(build_libdir)
ifeq ($(USEICC),1)
LLVM_LDFLAGS += -no_cpprt -lc++ -lc++abi
endif
endif
ifneq ($(LLVM_CPPFLAGS),)
LLVM_FLAGS += CPPFLAGS="$(LLVM_CPPFLAGS)"
LLVM_MFLAGS += CPPFLAGS="$(LLVM_CPPFLAGS)"
endif
ifneq ($(LLVM_LDFLAGS),)
LLVM_FLAGS += LDFLAGS="$(LLVM_LDFLAGS)"
LLVM_MFLAGS += LDFLAGS="$(LLVM_LDFLAGS)"
endif
ifneq ($(LLVM_CLANG_TAR),)
$(LLVM_CLANG_TAR):
$(JLDOWNLOAD) $@ http://llvm.org/releases/$(LLVM_VER)/$@
endif
ifneq ($(LLVM_COMPILER_RT_TAR),)
$(LLVM_COMPILER_RT_TAR):
$(JLDOWNLOAD) $@ http://llvm.org/releases/$(LLVM_VER)/$@
endif
ifneq ($(LLVM_LIBCXX_TAR),)
$(LLVM_LIBCXX_TAR):
$(JLDOWNLOAD) $@ http://llvm.org/releases/$(LLVM_VER)/$@
endif
ifneq ($(LLVM_VER),svn)
$(LLVM_TAR):
$(JLDOWNLOAD) $@ http://llvm.org/releases/$(LLVM_VER)/$@
endif
ifeq ($(BUILD_LLDB),1)
llvm-$(LLVM_VER)/tools/lldb:
llvm-$(LLVM_VER)/configure: llvm-$(LLVM_VER)/tools/lldb
endif
ifeq ($(LLVM_VER), 3.2)
## LLVM needs python 2.x, but doesn't check for it, so we have to use an ugly workaround to make it compile
llvm-$(LLVM_VER)/python2_path:
mkdir -p llvm-$(LLVM_VER)/python2_path
-python -c 'import sys; sys.exit(not sys.version_info > (3, 0))' && \
/usr/bin/python2 -c 'import sys; sys.exit(not sys.version_info < (3, 0))' && \
ln -sf /usr/bin/python2 "llvm-$(LLVM_VER)/python2_path/python"
llvm_python_workaround=llvm-$(LLVM_VER)/python2_path
else
LLVM_FLAGS += --with-python="$(shell ./find_python2)"
endif
ifeq ($(BUILD_CUSTOM_LIBCXX),1)
LIBCXX_OPTIONS = OPTIONS="-I../../libcxx/include $(CXXFLAGS) $(LDFLAGS)" CC="$(CC) $(CFLAGS)" CXX="$(CXX)"
ifeq ($(USEICC),1)
LIBCXX_OPTIONS += EXTRA_LIBS="-Bstatic -lirc"
endif
llvm-$(LLVM_VER)/projects/libcxx: $(LLVM_LIBCXX_TAR) | llvm-svn/configure
([ ! -d llvm-$(LLVM_VER)/projects/libcxx ] && \
git clone $(LLVM_GIT_URL_LIBCXX) llvm-$(LLVM_VER)/projects/libcxx ) || \
(cd llvm-$(LLVM_VER)/projects/libcxx && \
git pull --ff-only)
llvm-$(LLVM_VER)/projects/libcxxabi: $(LLVM_LIBCXXABI_TAR) | llvm-svn/configure
([ ! -d llvm-$(LLVM_VER)/projects/libcxxabi ] && \
git clone $(LLVM_GIT_URL_LIBCXXABI) llvm-$(LLVM_VER)/projects/libcxxabi ) || \
(cd llvm-$(LLVM_VER)/projects/libcxxabi && \
git pull --ff-only)
libcxx-build:
mkdir -p libcxx-build
libcxx-build/Makefile: llvm-$(LLVM_VER)/projects/libcxx | llvm-$(LLVM_VER)/projects/libcxxabi libcxx-build
cd libcxx-build && \
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=$(build_prefix) -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_LIBCXXABI_INCLUDE_PATHS="../llvm-$(LLVM_VER)/projects/libcxxabi/include" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(build_prefix) ../llvm-$(LLVM_VER)/projects/libcxx -DCMAKE_C_COMPILER="$(CC)" -DCMAKE_CXX_COMPILER="$(CXX)" -DCMAKE_SHARED_LINKER_FLAGS="-L$(build_libdir) -Bstatic -lirc -Bdynamic" -DCMAKE_CXX_FLAGS="$(CXXFLAGS)"
libcxxabi-build:
mkdir -p libcxxabi-build
libcxxabi-build/Makefile: llvm-$(LLVM_VER)/projects/libcxxabi | libcxxabi-build
cd libcxxabi-build && \
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=$(build_prefix) -DLLVM_MAIN_SRC_DIR=../llvm-svn -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(build_prefix) ../llvm-$(LLVM_VER)/projects/libcxxabi -DCMAKE_C_COMPILER="$(CC)" -DCMAKE_CXX_COMPILER="$(CXX)" -DLIBCXXABI_CXX_ABI_LIBRARIES="-Bstatic -lirc -Bdynamic" -DCMAKE_CXX_FLAGS="$(CXXFLAGS) -std=c++11"
llvm-$(LLVM_VER)/projects/libcxxabi/lib/libc++abi.so.1.0: llvm-$(LLVM_VER)/projects/libcxxabi | llvm-$(LLVM_VER)/projects/libcxx
libcxxabi-build/libc++abi.so.1.0: | libcxxabi-build/Makefile
cd libcxxabi-build && $(MAKE)
$(build_libdir)/libc++abi.so.1.0: libcxxabi-build/lib/libc++abi.so.1.0
cd libcxxabi-build && $(MAKE) install
touch $@
install-libcxxabi: $(build_libdir)/libc++abi.so.1.0
libcxx-build/lib/libc++.so.1.0: | $(build_libdir)/libc++abi.so.1.0 libcxx-build/Makefile
cd libcxx-build && $(MAKE)
$(build_libdir)/libc++.so.1.0: libcxx-build/lib/libc++.so.1.0
cd libcxx-build && $(MAKE) install
touch $@
install-libcxx: $(build_libdir)/libc++.so.1.0
get-libcxx: llvm-$(LLVM_VER)/projects/libcxx
get-libcxxabi: llvm-$(LLVM_VER)/projects/libcxxabi
endif
ifeq ($(BUILD_CUSTOM_LIBCXX),1)
LIBCXX_DEPENDENCY = $(build_libdir)/libc++abi.so.1.0 $(build_libdir)/libc++.so.1.0
LIBCXX_GET_DEPENDENCY = get-libcxx get-libcxxabi
endif
llvm-$(LLVM_VER)/configure: $(LLVM_TAR) $(LLVM_CLANG_TAR) $(LLVM_COMPILER_RT_TAR) $(LLVM_LIBCXX_TAR)
ifneq ($(LLVM_CLANG_TAR),)
$(JLCHECKSUM) $(LLVM_CLANG_TAR)
endif
ifneq ($(LLVM_COMPILER_RT_TAR),)
$(JLCHECKSUM) $(LLVM_COMPILER_RT_TAR)
endif
ifneq ($(LLVM_LIBCXX_TAR),)
$(JLCHECKSUM) $(LLVM_LIBCXX_TAR)
endif
ifneq ($(LLVM_VER),svn)
$(JLCHECKSUM) $(LLVM_TAR)
endif
ifneq ($(LLVM_VER),svn)
mkdir -p llvm-$(LLVM_VER) && \
$(TAR) -C llvm-$(LLVM_VER) --strip-components 1 -xf $(LLVM_TAR)
else
([ ! -d llvm-$(LLVM_VER) ] && \
git clone $(LLVM_GIT_URL_LLVM) llvm-$(LLVM_VER) ) || \
(cd llvm-$(LLVM_VER) && \
git pull --ff-only)
ifneq ($(LLVM_GIT_VER),)
(cd llvm-$(LLVM_VER) && \
git checkout $(LLVM_GIT_VER))
endif
endif
ifneq ($(LLVM_VER),svn)
ifneq ($(LLVM_CLANG_TAR),)
mkdir -p llvm-$(LLVM_VER)/tools/clang && \
$(TAR) -C llvm-$(LLVM_VER)/tools/clang --strip-components 1 -xf $(LLVM_CLANG_TAR)
endif
ifneq ($(LLVM_COMPILER_RT_TAR),)
mkdir -p llvm-$(LLVM_VER)/projects/compiler-rt && \
$(TAR) -C llvm-$(LLVM_VER)/projects/compiler-rt --strip-components 1 -xf $(LLVM_COMPILER_RT_TAR)
endif
else
ifeq ($(BUILD_LLVM_CLANG),1)
([ ! -d llvm-$(LLVM_VER)/tools/clang ] && \
git clone $(LLVM_GIT_URL_CLANG) llvm-$(LLVM_VER)/tools/clang ) || \
(cd llvm-$(LLVM_VER)/tools/clang && \
git pull --ff-only)
endif
endif
ifeq ($(LLVM_VER),svn)
ifeq ($(BUILD_LLVM_CLANG),1)
([ ! -d llvm-$(LLVM_VER)/tools/clang ] && \
git clone $(LLVM_GIT_URL_CLANG) llvm-$(LLVM_VER)/tools/clang ) || \
(cd llvm-$(LLVM_VER)/tools/clang && \
git pull --ff-only)
([ ! -d llvm-$(LLVM_VER)/projects/compiler-rt ] && \
git clone $(LLVM_GIT_URL_COMPILER_RT) llvm-$(LLVM_VER)/projects/compiler-rt ) || \
(cd llvm-$(LLVM_VER)/projects/compiler-rt && \
git pull --ff-only)
ifneq ($(LLVM_CLANG_VER),)
(cd llvm-$(LLVM_VER) && \
git checkout $(LLVM_GIT_VER))
endif
endif
endif
ifeq ($(BUILD_LLDB),1)
([ ! -d llvm-$(LLVM_VER)/tools/lldb ] && \
(cd llvm-$(LLVM_VER)/tools && \
git clone $(LLVM_GIT_URL_LLDB))) || \
([ -d llvm-$(LLVM_VER)/tools/lldb ] && \
(cd llvm-$(LLVM_VER)/tools/lldb && \
git fetch))
cd llvm-$(LLVM_VER)/tools/lldb && git checkout $(LLDB_VER)
endif
ifeq ($(LLVM_VER),3.3)
patch -p0 < llvm-3.3.patch
patch -p0 < instcombine-llvm-3.3.patch
patch -p0 < int128-vector.llvm-3.3.patch
(cd llvm-$(LLVM_VER) && patch < ../osx-10.10.llvm-3.3.patch)
ifeq ($(OS),WINNT)
ifeq ($(ARCH),x86_64)
patch -p0 < win64-int128.llvm-3.3.patch
endif
endif
endif
touch -c $@
llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE)/config.status: llvm-$(LLVM_VER)/configure | $(llvm_python_workaround) $(LIBCXX_DEPENDENCY)
cd llvm-$(LLVM_VER) && \
mkdir -p build_$(LLVM_BUILDTYPE) && cd build_$(LLVM_BUILDTYPE) && \
export PATH=$(abspath llvm-$(LLVM_VER)/python2_path):$$PATH && \
../configure $(CONFIGURE_COMMON) $(LLVM_CC) $(LLVM_FLAGS)
touch -c $@
$(LLVM_OBJ_SOURCE): llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE)/config.status | $(llvm_python_workaround)
cd llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE) && \
export PATH=$(abspath llvm-$(LLVM_VER)/python2_path):$$PATH && \
$(MAKE) $(LLVM_MFLAGS) $(MAKE_COMMON)
touch -c $@
llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE)/checked: $(LLVM_OBJ_SOURCE) | $(llvm_python_workaround)
ifeq ($(OS),$(BUILD_OS))
cd llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE) && \
export PATH=$(abspath llvm-$(LLVM_VER)/python2_path):$$PATH && \
$(MAKE) $(LLVM_MFLAGS) check
endif
echo 1 > $@
$(LLVM_OBJ_TARGET): $(LLVM_OBJ_SOURCE) | $(llvm_python_workaround)
# LLVM has weird install prefixes (see llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE)/Makefile.config for the full list)
# We map them here to the "normal" ones, which means just prefixing "PROJ_" to the variable name.
export PATH=$(abspath llvm-$(LLVM_VER)/python2_path):$$PATH && \
$(MAKE) -C llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE) install $(LLVM_MFLAGS) $(MAKE_COMMON) PROJ_libdir=$(build_libdir) PROJ_bindir=$(build_bindir) PROJ_includedir=$(build_includedir)
touch -c $@
reinstall-llvm:
-rm $(build_bindir)/llvm-config
export PATH=$(abspath llvm-$(LLVM_VER)/python2_path):$$PATH && \
$(MAKE) -C llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE) install $(LLVM_MFLAGS) $(MAKE_COMMON) PROJ_libdir=$(build_libdir) PROJ_bindir=$(build_bindir)
clean-llvm:
-$(MAKE) -C llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE) clean
-rm -f $(build_bindir)/llvm-config
distclean-llvm:
-rm -rf llvm-$(LLVM_VER).tar.gz llvm-$(LLVM_VER).src.tar.gz clang-$(LLVM_VER).src.tar.gz clang-$(LLVM_VER).tar.gz libcxx-$(LLVM_VER).src.tar.gz compiler-rt-$(LLVM_VER).src.tar.gz llvm-$(LLVM_VER)
ifneq ($(LLVM_VER),svn)
get-llvm: $(LLVM_TAR) $(LLVM_CLANG_TAR) $(LLVM_COMPILER_RT_TAR) $(LLVM_LIBCXX_TAR)
else
get-llvm: llvm-$(LLVM_VER)/configure $(LIBCXX_GET_DEPENDENCY)
endif
configure-llvm: llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE)/config.status
compile-llvm: $(LLVM_OBJ_SOURCE)
check-llvm: llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE)/checked
install-llvm: $(LLVM_OBJ_TARGET)
#todo: LLVM make check target is broken on julia.mit.edu (and really slow elsewhere)
## LIBUV ##
UV_SRC_TARGET = libuv/.libs/libuv.a
UV_OBJ_TARGET = $(build_libdir)/libuv.a
UV_CFLAGS =
ifeq ($(USEMSVC), 1)
UV_CFLAGS += -DBUILDING_UV_SHARED
endif
ifeq ($(USEICC), 1)
UV_CFLAGS += -static-intel
endif
UV_MFLAGS += LDFLAGS="$(LDFLAGS) $(CLDFLAGS) -v"
ifneq ($(UV_CFLAGS),)
UV_MFLAGS += CFLAGS="$(UV_CFLAGS)"
endif
ifneq ($(USEMSVC), 1)
UV_FLAGS = $(UV_MFLAGS)
else
UV_FLAGS = --disable-shared $(UV_MFLAGS)
endif
libuv/configure:
(cd .. && git submodule init && git submodule update)
ifeq (exists, $(shell [ -d libuv/.git ] && echo exists ))
libuv/config.status: libuv/.git/HEAD
endif
ifeq (exists, $(shell [ -d $(JULIAHOME)/.git/modules/deps/libuv ] && echo exists ))
libuv/config.status: $(JULIAHOME)/.git/modules/deps/libuv/HEAD
endif
libuv/config.status: libuv/configure
cd libuv && \
./configure --with-pic $(CONFIGURE_COMMON) $(UV_FLAGS)
touch -c $@
$(UV_SRC_TARGET): libuv/config.status
touch -c libuv/aclocal.m4
touch -c libuv/Makefile.in
touch -c libuv/configure
touch -c libuv/config.status
$(MAKE) -C libuv $(UV_MFLAGS)
touch -c $@
libuv/checked: $(UV_SRC_TARGET)
ifeq ($(OS),$(BUILD_OS))
-$(MAKE) -C libuv check
endif
echo 1 > $@
$(UV_OBJ_TARGET): $(UV_SRC_TARGET)
$(MAKE) -C libuv install $(MAKE_COMMON)
$(INSTALL_NAME_CMD)libuv.$(SHLIB_EXT) $(build_shlibdir)/libuv.$(SHLIB_EXT)
clean-uv:
-$(MAKE) -C libuv clean
-rm -rf $(build_shlibdir)/libuv.a $(build_includedir)/uv.h $(build_includedir)/uv-private
distclean-uv: clean-uv
-$(MAKE) -C libuv distclean
get-uv: libuv/configure
configure-uv: libuv/config.status
compile-uv: $(UV_SRC_TARGET)
check-uv: libuv/checked
install-uv: $(UV_OBJ_TARGET)
## PCRE ##
PCRE_SRC_TARGET = pcre-$(PCRE_VER)/.libs/libpcre.$(SHLIB_EXT)
PCRE_OBJ_TARGET = $(build_shlibdir)/libpcre.$(SHLIB_EXT)
pcre-$(PCRE_VER).tar.bz2:
$(JLDOWNLOAD) $@ http://sourceforge.net/projects/pcre/files/pcre/$(PCRE_VER)/$@/download
pcre-$(PCRE_VER)/configure: pcre-$(PCRE_VER).tar.bz2 pcre-gcc49-compile.patch
$(JLCHECKSUM) $<
$(TAR) jxf $<
cd pcre-$(PCRE_VER) && patch -p1 < ../pcre-gcc49-compile.patch
touch -c $@
pcre-$(PCRE_VER)/config.status: pcre-$(PCRE_VER)/configure
cd pcre-$(PCRE_VER) && \
./configure $(CONFIGURE_COMMON) --enable-utf --enable-unicode-properties --enable-jit --includedir=$(build_includedir)
touch -c $@
$(PCRE_SRC_TARGET): pcre-$(PCRE_VER)/config.status
$(MAKE) -C pcre-$(PCRE_VER) $(LIBTOOL_CCLD)
touch -c $@
pcre-$(PCRE_VER)/checked: $(PCRE_SRC_TARGET)
ifeq ($(OS),$(BUILD_OS))
ifneq ($(OS),WINNT)
$(MAKE) -C pcre-$(PCRE_VER) check -j1
endif
endif
echo 1 > $@
$(PCRE_OBJ_TARGET): $(PCRE_SRC_TARGET) pcre-$(PCRE_VER)/checked
$(MAKE) -C pcre-$(PCRE_VER) $(LIBTOOL_CCLD) install $(MAKE_COMMON)
$(INSTALL_NAME_CMD)libpcre.$(SHLIB_EXT) $@
touch -c $@
clean-pcre:
-$(MAKE) -C pcre-$(PCRE_VER) clean
-rm -f $(build_shlibdir)/libpcre*
distclean-pcre: clean-pcre
-rm -rf pcre-$(PCRE_VER).tar.bz2 pcre-$(PCRE_VER)
get-pcre: pcre-$(PCRE_VER).tar.bz2
configure-pcre: pcre-$(PCRE_VER)/config.status
compile-pcre: $(PCRE_SRC_TARGET)
check-pcre: pcre-$(PCRE_VER)/checked
install-pcre: $(PCRE_OBJ_TARGET)
## openlibm ##
OPENLIBM_FLAGS = ARCH="$(ARCH)" CC="$(CC)" FC="$(FC)" AR="$(AR)" OS="$(OS)" USECLANG=$(USECLANG) USEGCC=$(USEGCC)
OPENLIBM_OBJ_TARGET = $(build_shlibdir)/libopenlibm.$(SHLIB_EXT)
OPENLIBM_OBJ_SOURCE = openlibm/libopenlibm.$(SHLIB_EXT)
openlibm/Makefile:
(cd .. && git submodule init && git submodule update)
ifeq (exists, $(shell [ -d openlibm/.git ] && echo exists ))
$(OPENLIBM_OBJ_SOURCE): openlibm/.git/HEAD
endif
ifeq (exists, $(shell [ -d $(JULIAHOME)/.git/modules/deps/openlibm ] && echo exists ))
$(OPENLIBM_OBJ_SOURCE): $(JULIAHOME)/.git/modules/deps/openlibm/HEAD
endif
$(OPENLIBM_OBJ_SOURCE): openlibm/Makefile
$(MAKE) -C openlibm $(OPENLIBM_FLAGS) $(MAKE_COMMON)
touch -c $@
$(OPENLIBM_OBJ_TARGET): $(OPENLIBM_OBJ_SOURCE)
$(MAKE) -C openlibm install $(OPENLIBM_FLAGS) $(MAKE_COMMON)
$(INSTALL_NAME_CMD)libopenlibm.$(SHLIB_EXT) $@
touch -c $@
clean-openlibm:
-$(MAKE) -C openlibm distclean $(OPENLIBM_FLAGS)
-rm $(OPENLIBM_OBJ_TARGET)
-rm $(build_libdir)/libopenlibm.a
distclean-openlibm: clean-openlibm
-cd openlibm && git clean -fdx
get-openlibm: openlibm/Makefile
configure-openlibm: get-openlibm
compile-openlibm: $(OPENLIBM_OBJ_SOURCE)
check-openlibm: compile-openlibm
install-openlibm: $(OPENLIBM_OBJ_TARGET)
## openspecfun ##
OPENSPECFUN_FLAGS = ARCH="$(ARCH)" CC="$(CC)" FC="$(FC)" AR="$(AR)" OS="$(OS)" USECLANG=$(USECLANG) USEGCC=$(USEGCC) FFLAGS="$(JFFLAGS)"
ifeq ($(USE_SYSTEM_LIBM),0)
OPENSPECFUN_FLAGS += USE_OPENLIBM=1
OPENLIBM_FAKE_TARGET = $(OPENLIBM_OBJ_TARGET)
endif
OPENSPECFUN_OBJ_TARGET = $(build_shlibdir)/libopenspecfun.$(SHLIB_EXT)
OPENSPECFUN_OBJ_SOURCE = openspecfun/libopenspecfun.$(SHLIB_EXT)
openspecfun/Makefile openspecfun/Makefile.extras:
(cd .. && git submodule init && git submodule update)
ifeq (exists, $(shell [ -d openspecfun/.git ] && echo exists ))
$(OPENSPECFUN_OBJ_SOURCE): openspecfun/.git/HEAD
endif
ifeq (exists, $(shell [ -d $(JULIAHOME)/.git/modules/deps/openspecfun ] && echo exists ))
$(OPENSPECFUN_OBJ_SOURCE): $(JULIAHOME)/.git/modules/deps/openspecfun/HEAD
endif
$(OPENSPECFUN_OBJ_SOURCE): openspecfun/Makefile $(OPENLIBM_FAKE_TARGET)
$(MAKE) -C openspecfun $(OPENSPECFUN_FLAGS) $(MAKE_COMMON)
touch -c $@
$(OPENSPECFUN_OBJ_TARGET): $(OPENSPECFUN_OBJ_SOURCE)
$(MAKE) -C openspecfun install $(OPENSPECFUN_FLAGS) $(MAKE_COMMON)
$(INSTALL_NAME_CMD)libopenspecfun.$(SHLIB_EXT) $@
touch -c $@
clean-openspecfun:
-$(MAKE) -C openspecfun distclean $(OPENSPECFUN_FLAGS)
-rm $(OPENSPECFUN_OBJ_TARGET)
-rm $(build_libdir)/libopenspecfun.a
distclean-openspecfun: clean-openspecfun
-cd openspecfun && git clean -fdx
get-openspecfun: openspecfun/Makefile
configure-openspecfun: get-openspecfun
compile-openspecfun: $(OPENSPECFUN_OBJ_SOURCE)
check-openspecfun: compile-openspecfun
install-openspecfun: $(OPENSPECFUN_OBJ_TARGET)
## DSFMT ##
DSFMT_OBJ_TARGET = $(build_shlibdir)/libdSFMT.$(SHLIB_EXT)
DSFMT_OBJ_SOURCE = dsfmt-$(DSFMT_VER)/libdSFMT.$(SHLIB_EXT)
DSFMT_CFLAGS = $(CFLAGS) -DNDEBUG -DDSFMT_MEXP=19937 $(fPIC) -DDSFMT_DO_NOT_USE_OLD_NAMES
ifneq ($(USEMSVC), 1)
DSFMT_CFLAGS += -O3 -finline-functions -fomit-frame-pointer -fno-strict-aliasing \
--param max-inline-insns-single=1800 -Wmissing-prototypes -Wall -std=c99 -shared
else
DSFMT_CFLAGS += -Wl,-dll
endif
ifeq ($(ARCH), x86_64)
DSFMT_CFLAGS += -msse2 -DHAVE_SSE2
endif
dsfmt-$(DSFMT_VER).tar.gz:
$(JLDOWNLOAD) $@ http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/dSFMT-src-$(DSFMT_VER).tar.gz
touch -c $@
dsfmt-$(DSFMT_VER)/config.status: dsfmt-$(DSFMT_VER).tar.gz
$(JLCHECKSUM) $<
mkdir -p dsfmt-$(DSFMT_VER) && \
$(TAR) -C dsfmt-$(DSFMT_VER) --strip-components 1 -xf dsfmt-$(DSFMT_VER).tar.gz && \
cd dsfmt-$(DSFMT_VER) && patch < ../dSFMT.h.patch && patch < ../dSFMT.c.patch
echo 1 > $@
$(DSFMT_OBJ_SOURCE): dsfmt-$(DSFMT_VER)/config.status
cd dsfmt-$(DSFMT_VER) && \
$(CC) $(CPPFLAGS) $(DSFMT_CFLAGS) $(LDFLAGS) dSFMT.c -o libdSFMT.$(SHLIB_EXT) && \
cp dSFMT.h $(build_includedir)
$(DSFMT_OBJ_TARGET): $(DSFMT_OBJ_SOURCE)
cp $< $@ && \
$(INSTALL_NAME_CMD)libdSFMT.$(SHLIB_EXT) $(DSFMT_OBJ_TARGET)
clean-dsfmt:
-rm -f dsfmt-$(DSFMT_VER)/libdSFMT.$(SHLIB_EXT)
distclean-dsfmt: clean-dsfmt
-rm -rf dsfmt*.tar.gz dsfmt-$(DSFMT_VER)
get-dsfmt: dsfmt-$(DSFMT_VER).tar.gz
configure-dsfmt: dsfmt-$(DSFMT_VER)/config.status
compile-dsfmt: $(DSFMT_OBJ_SOURCE)
check-dsfmt: compile-dsfmt
install-dsfmt: $(DSFMT_OBJ_TARGET)
## Rmath ##
ifeq ($(USE_SYSTEM_DSFMT),0)
DSFMT_FAKE_TARGET = $(DSFMT_OBJ_TARGET)
endif
RMATH_OBJ_TARGET = $(build_shlibdir)/libRmath-julia.$(SHLIB_EXT)
RMATH_OBJ_SOURCE = Rmath/src/libRmath-julia.$(SHLIB_EXT)
RMATH_FLAGS += CC="$(CC)" USECLANG=$(USECLANG) USEGCC=$(USEGCC) \
OS="$(OS)" ARCH="$(ARCH)" \
USE_DSFMT=1 DSFMT_libdir="$(build_shlibdir)" \
DSFMT_includedir="$(build_includedir)"
Rmath/Make.inc:
(cd .. && git submodule init && git submodule update)
ifeq (exists, $(shell [ -d Rmath/.git ] && echo exists ))
$(RMATH_OBJ_SOURCE): Rmath/.git/HEAD
endif
ifeq (exists, $(shell [ -d $(JULIAHOME)/.git/modules/deps/Rmath ] && echo exists ))
$(RMATH_OBJ_SOURCE): $(JULIAHOME)/.git/modules/deps/Rmath/HEAD
endif
$(RMATH_OBJ_SOURCE): Rmath/Make.inc $(DSFMT_FAKE_TARGET)
$(MAKE) -C Rmath/src $(RMATH_FLAGS) $(MAKE_COMMON)
touch -c $@
$(RMATH_OBJ_TARGET): $(RMATH_OBJ_SOURCE) | $(build_shlibdir)
cp $< $@
$(INSTALL_NAME_CMD)libRmath-julia.$(SHLIB_EXT) $@
clean-Rmath:
-$(MAKE) -C Rmath/src clean
-rm $(RMATH_OBJ_TARGET)
distclean-Rmath: clean-Rmath
-cd Rmath && git clean -fdx
get-Rmath: Rmath/Make.inc
configure-Rmath: get-Rmath
compile-Rmath: $(RMATH_OBJ_SOURCE)
check-Rmath: compile-Rmath
install-Rmath: $(RMATH_OBJ_TARGET)
## OpenBLAS ##
# LAPACK is built into OpenBLAS by default
OPENBLAS_OBJ_SOURCE = openblas-$(OPENBLAS_VER)/libopenblas.$(SHLIB_EXT)
OPENBLAS_OBJ_TARGET = $(build_shlibdir)/libopenblas.$(SHLIB_EXT)
OPENBLAS_BUILD_OPTS = CC="$(CC)" FC="$(FC)" RANLIB="$(RANLIB)" FFLAGS="$(FFLAGS) $(JFFLAGS)" LDFLAGS="$(LDFLAGS)" TARGET=$(OPENBLAS_TARGET_ARCH) BINARY=$(BINARY)
# Thread support
ifeq ($(OPENBLAS_USE_THREAD), 1)
OPENBLAS_BUILD_OPTS += USE_THREAD=1
OPENBLAS_BUILD_OPTS += GEMM_MULTITHREADING_THRESHOLD=50
# Maximum number of threads for parallelism
ifneq ($(ARCH),x86_64)
# Assume we can't address much memory to spawn many threads
# It is also unlikely that 32-bit architectures have too many cores
OPENBLAS_BUILD_OPTS += NUM_THREADS=8
else ifeq ($(OS),WINNT)
# Windows seems unable to handle very many
OPENBLAS_BUILD_OPTS += NUM_THREADS=16
else ifeq ($(OS),Darwin)
# This should suffice for the largest macs
OPENBLAS_BUILD_OPTS += NUM_THREADS=16
else
# On linux, try to provision for the largest possible machine currently
OPENBLAS_BUILD_OPTS += NUM_THREADS=16
endif
else
OPENBLAS_BUILD_OPTS += USE_THREAD=0
endif
# don't touch scheduler affinity since we manage this ourselves
OPENBLAS_BUILD_OPTS += NO_AFFINITY=1
# Build for all architectures - required for distribution
ifeq ($(OPENBLAS_DYNAMIC_ARCH), 1)
OPENBLAS_BUILD_OPTS += DYNAMIC_ARCH=1
endif
# 64-bit BLAS interface
ifeq ($(USE_BLAS64), 1)
OPENBLAS_BUILD_OPTS += INTERFACE64=1
endif
# Decide whether to build for 32-bit or 64-bit arch
ifneq ($(BUILD_OS),$(OS))
OPENBLAS_BUILD_OPTS += OSNAME=$(OS) CROSS=1 HOSTCC=$(HOSTCC)
endif
ifeq ($(OS),WINNT)
ifneq ($(ARCH),x86_64)
OPENBLAS_BUILD_OPTS += CFLAGS="$(CFLAGS) -mincoming-stack-boundary=2"
OPENBLAS_BUILD_OPTS += FFLAGS="$(FFLAGS) -mincoming-stack-boundary=2"
endif
endif
# Debug OpenBLAS
ifeq ($(OPENBLAS_DEBUG), 1)
OPENBLAS_BUILD_OPTS += DEBUG=1
endif
# Allow disabling AVX for older binutils
ifeq ($(OPENBLAS_NO_AVX), 1)
OPENBLAS_BUILD_OPTS += NO_AVX=1 NO_AVX2=1
else ifeq ($(OPENBLAS_NO_AVX2), 1)
OPENBLAS_BUILD_OPTS += NO_AVX2=1
endif
openblas-$(OPENBLAS_VER).tar.gz:
$(JLDOWNLOAD) $@ https://github.com/xianyi/OpenBLAS/tarball/$(OPENBLAS_VER)
openblas-$(OPENBLAS_VER)/config.status: openblas-$(OPENBLAS_VER).tar.gz
ifneq ($(OPENBLAS_VER),develop)
$(JLCHECKSUM) $<
endif
mkdir -p openblas-$(OPENBLAS_VER) && \
$(TAR) -C openblas-$(OPENBLAS_VER) --strip-components 1 -xf $<
perl -i -ple 's/^\s*(EXTRALIB\s*\+=\s*-lSystemStubs)\s*$$/# $$1/g' openblas-$(OPENBLAS_VER)/Makefile.system
echo 1 > $@
$(OPENBLAS_OBJ_SOURCE): openblas-$(OPENBLAS_VER)/config.status
$(MAKE) -C openblas-$(OPENBLAS_VER) $(OPENBLAS_BUILD_OPTS) || (echo "*** Clean the OpenBLAS build with 'make -C deps clean-openblas'. Rebuild with 'make OPENBLAS_USE_THREAD=0 if OpenBLAS had trouble linking libpthread.so, and with 'make OPENBLAS_TARGET_ARCH=NEHALEM' if there were errors building SandyBridge support. Both these options can also be used simultaneously. ***" && false)
touch -c $@
$(OPENBLAS_OBJ_TARGET): $(OPENBLAS_OBJ_SOURCE) | $(build_shlibdir)
cp -f openblas-$(OPENBLAS_VER)/libopenblas.$(SHLIB_EXT) $(build_shlibdir)
ifeq ($(OS), Linux)
cd $(build_shlibdir) && \
ln -sf libopenblas.$(SHLIB_EXT) libopenblas.$(SHLIB_EXT).0
endif
$(INSTALL_NAME_CMD)libopenblas.$(SHLIB_EXT) $(build_shlibdir)/libopenblas.$(SHLIB_EXT)
clean-openblas:
-$(MAKE) -C openblas-$(OPENBLAS_VER) clean
distclean-openblas:
-rm -rf openblas-$(OPENBLAS_VER).tar.gz openblas-$(OPENBLAS_VER)
get-openblas: openblas-$(OPENBLAS_VER).tar.gz
configure-openblas: openblas-$(OPENBLAS_VER)/config.status
compile-openblas: $(OPENBLAS_OBJ_SOURCE)
check-openblas: compile-openblas
install-openblas: $(OPENBLAS_OBJ_TARGET)
## ATLAS (currently 3.10.0) ##
# no threading, with full lapack, shared library
# should always be compiled with (a real) gcc, it's
# configure script will search for the best match
# (gcc 4.7, gcc, clang,ICC/microsoft/others)
ATLAS_OBJ_SOURCE = atlas/build/lib/libsatlas.$(SHLIB_EXT)
ATLAS_OBJ_TARGET = $(build_shlibdir)/libsatlas.$(SHLIB_EXT)
ATLAS_FLAGS = --shared --prefix=$(build_prefix) --cc=gcc -t 0 \
--with-netlib-lapack-tarfile=$(JULIAHOME)/deps/lapack-$(LAPACK_VER).tgz
ifeq ($(OS), WINNT)
ATLAS_FLAGS += -b 32
endif
#force backwards compatibility (pick any 1)
#ATLAS_FLAGS += -V 192 -A 13 # requires SSE2 (P4 & later)
#ATLAS_FLAGS += -V 128 -A 12 # requires SSE1 (P3 & later)
#ATLAS_FLAGS += -V -1 -A 11 # any x87 (PentiumPro or Athlon & later)
#ATLAS_FLAGS += -A 25 # requires Corei132 (Corei232 doesn't have definition yet)
atlas/configure:
git clone git://github.com/vtjnash/atlas-3.10.0.git atlas
ifeq "$(MAKECMDGOALS)" "compile-atlas"
# only allow building atlas as the sole target (without -jN)
# since it internally handles parallelism, for tuning timing accuracy
atlas/build/Make.top: atlas/configure lapack-$(LAPACK_VER).tgz
cd atlas && \
(test -d build || mkdir build) && cd build && \
../configure $(ATLAS_FLAGS)
touch -c $@
$(ATLAS_OBJ_SOURCE): atlas/build/Make.top
$(MAKE) -C atlas/build -j1
touch -c $@
else
$(ATLAS_OBJ_SOURCE):
$(error cannot build atlas in parallel with anything else)
endif
$(ATLAS_OBJ_TARGET): $(ATLAS_OBJ_SOURCE)
cp -f $(ATLAS_OBJ_SOURCE) $@
$(INSTALL_NAME_CMD)libsatlas.$(SHLIB_EXT) $@
clean-atlas:
rm -rf atlas/build
distclean-atlas: clean-atlas
rm -rf atlas
get-atlas: atlas/configure
configure-atlas: atlas/build/Make.top
compile-atlas: $(ATLAS_OBJ_SOURCE)
check-atlas: compile-atlas
install-atlas: $(ATLAS_OBJ_TARGET)
## Mac gfortran BLAS wrapper ##
GFORTBLAS_FFLAGS =
ifeq ($(OS),Darwin)
ifeq ($(USE_SYSTEM_BLAS),1)
ifeq ($(USE_SYSTEM_LAPACK),0)
GFORTBLAS_FFLAGS += -cpp -ffree-line-length-0 -ffixed-line-length-0 \
-Dsasum=sasum_gfort -Dscasum=scasum_gfort \
-Dscnrm2=scnrm2_gfort -Dsdot=sdot_gfort \
-Dsdsdot=sdsdot_gfort -Dsnrm2=snrm2_gfort \
-Dcdotc=cdotc_gfort -Dcdotu=cdotu_gfort \
-Dzdotc=zdotc_gfort -Dzdotu=zdotu_gfort \
\
-DSASUM=SASUM_GFORT -DSCASUM=SCASUM_GFORT \
-DSCNRM2=SCNRM2_GFORT -DSDOT=SDOT_GFORT \
-DSDSDOT=SDSDOT_GFORT -DSNRM2=SNRM2_GFORT \
-DCDOTC=CDOTC_GFORT -DCDOTU=CDOTU_GFORT \
-DZDOTC=ZDOTC_GFORT -DZDOTU=ZDOTU_GFORT
endif
endif
libgfortblas.$(SHLIB_EXT): gfortblas.c gfortblas.alias
$(CC) -Wall -O3 $(CPPFLAGS) $(CFLAGS) $(fPIC) -shared $< -o $@ -pipe \
-Wl,-reexport_framework,vecLib -Wl,-alias_list,gfortblas.alias
$(build_shlibdir)/libgfortblas.$(SHLIB_EXT): libgfortblas.$(SHLIB_EXT)
cp -f $< $@
$(INSTALL_NAME_CMD)libgfortblas.$(SHLIB_EXT) $@
endif
## LAPACK ##
ifeq ($(USE_SYSTEM_LAPACK), 0)
LAPACK_OBJ_TARGET = $(build_shlibdir)/liblapack.$(SHLIB_EXT)
LAPACK_OBJ_SOURCE = lapack-$(LAPACK_VER)/liblapack.$(SHLIB_EXT)
else
LAPACK_OBJ_TARGET =
LAPACK_OBJ_SOURCE =
endif
LAPACK_MFLAGS = NOOPT="$(FFLAGS) $(JFFLAGS) $(GFORTBLAS_FFLAGS) -O0" OPTS="$(FFLAGS) $(JFFLAGS) $(GFORTBLAS_FFLAGS)" FORTRAN="$(FC)" LOADER="$(FC)"
ifneq ($(OS),WINNT)
LAPACK_MFLAGS += BLASLIB="-Wl,-rpath,'$(build_libdir)' $(LIBBLAS)"
endif
lapack-$(LAPACK_VER).tgz:
$(JLDOWNLOAD) $@ http://www.netlib.org/lapack/$@
lapack-$(LAPACK_VER)/Makefile: lapack-$(LAPACK_VER).tgz
$(JLCHECKSUM) $<
$(TAR) zxf $<
touch -c $@
ifeq ($(USE_SYSTEM_BLAS), 0)
lapack-$(LAPACK_VER)/liblapack.a: | $(OPENBLAS_OBJ_TARGET)
else ifeq ($(OS),Darwin)
lapack-$(LAPACK_VER)/liblapack.a: | $(build_shlibdir)/libgfortblas.$(SHLIB_EXT)
endif
lapack-$(LAPACK_VER)/liblapack.a: lapack-$(LAPACK_VER)/Makefile
cd lapack-$(LAPACK_VER) && \
cp INSTALL/make.inc.gfortran ./make.inc && \