forked from sifive/freedom-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
1647 lines (1525 loc) · 91.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
# The default target
.PHONY: all non-toolchain toolchain gdb-only openocd qemu xc3sprog trace-decoder sdk-utilities python combo-package
all:
non-toolchain:
toolchain:
gdb-only:
openocd:
qemu:
xc3sprog:
trace-decoder:
sdk-utilities:
python:
combo-package:
.NOTPARALLEL:
export MAKEFLAGS=-j1
# Make uses /bin/sh by default, ignoring the user's value of SHELL.
# Some systems now ship with /bin/sh pointing at dash, and this Makefile
# requires bash
SHELL = /bin/bash
PREFIXPATH ?=
BINDIR := bin
OBJDIR := obj
SRCDIR := $(PREFIXPATH)src
SCRIPTSDIR := $(PREFIXPATH)scripts
UBUNTU32 ?= i686-linux-ubuntu14
UBUNTU64 ?= x86_64-linux-ubuntu14
REDHAT ?= x86_64-linux-centos6
WIN32 ?= i686-w64-mingw32
WIN64 ?= x86_64-w64-mingw32
DARWIN ?= x86_64-apple-darwin
-include /etc/lsb-release
ifneq ($(wildcard /etc/redhat-release),)
NATIVE ?= $(REDHAT)
NINJA ?= ninja-build
all: redhat
non-toolchain: redhat-non-toolchain
toolchain: redhat-toolchain
gdb-only: redhat-gdb-only
openocd: redhat-openocd
qemu: redhat-qemu
xc3sprog: redhat-xc3sprog
trace-decoder: redhat-trace-decoder
sdk-utilities: redhat-sdk-utilities
python: redhat-python
combo-package: redhat-combo-package
else ifeq ($(DISTRIB_ID),Ubuntu)
ifeq ($(shell uname -m),x86_64)
NATIVE ?= $(UBUNTU64)
all: ubuntu64
non-toolchain: ubuntu64-non-toolchain
toolchain: ubuntu64-toolchain
gdb-only: ubuntu64-gdb-only
openocd: ubuntu64-openocd
qemu: ubuntu64-qemu
xc3sprog: ubuntu64-xc3sprog
trace-decoder: ubuntu64-trace-decoder
sdk-utilities: ubuntu64-sdk-utilities
python: ubuntu64-python
combo-package: ubuntu64-combo-package
else
NATIVE ?= $(UBUNTU32)
all: ubuntu32
toolchain: ubuntu32-toolchain
openocd: ubuntu32-openocd
endif
all: win64
non-toolchain: win64-non-toolchain
toolchain: win64-toolchain
gdb-only: win64-gdb-only
openocd: win64-openocd
qemu: win64-qemu
xc3sprog: win64-xc3sprog
trace-decoder: win64-trace-decoder
sdk-utilities: win64-sdk-utilities
python: win64-python
combo-package: win64-combo-package
else ifeq ($(shell uname),Darwin)
NATIVE ?= $(DARWIN)
LIBTOOLIZE ?= glibtoolize
TAR ?= gtar
SED ?= gsed
AWK ?= gawk
all: darwin
non-toolchain: darwin-non-toolchain
toolchain: darwin-toolchain
gdb-only: darwin-gdb-only
openocd: darwin-openocd
qemu: darwin-qemu
xc3sprog: darwin-xc3sprog
trace-decoder: darwin-trace-decoder
sdk-utilities: darwin-sdk-utilities
python: darwin-python
combo-package: darwin-combo-package
else
$(error Unknown host)
endif
LIBTOOLIZE ?= libtoolize
TAR ?= tar
SED ?= sed
AWK ?= awk
NINJA ?= ninja
OBJ_NATIVE := $(OBJDIR)/$(NATIVE)
OBJ_UBUNTU32 := $(OBJDIR)/$(UBUNTU32)
OBJ_UBUNTU64 := $(OBJDIR)/$(UBUNTU64)
OBJ_WIN32 := $(OBJDIR)/$(WIN32)
OBJ_WIN64 := $(OBJDIR)/$(WIN64)
OBJ_DARWIN := $(OBJDIR)/$(DARWIN)
OBJ_REDHAT := $(OBJDIR)/$(REDHAT)
SRC_RBU := $(SRCDIR)/riscv-binutils
SRC_RGCC := $(SRCDIR)/riscv-gcc
SRC_RGDB := $(SRCDIR)/riscv-gdb
SRC_RNL := $(SRCDIR)/riscv-newlib
SRC_RIS := $(SRCDIR)/riscv-isa-sim
SRC_ROCD := $(SRCDIR)/riscv-openocd
SRC_RQEMU := $(SRCDIR)/riscv-qemu
SRC_XC3SP := $(SRCDIR)/xc3sprog
SRC_TDC := $(SRCDIR)/trace-decoder
SRC_DTC := $(SRCDIR)/dtc
SRC_FE2H := $(SRCDIR)/freedom-elf2hex
SRC_EXPAT := $(SRCDIR)/libexpat/expat
SRC_LIBUSB := $(SRCDIR)/libusb
SRC_LIBFTDI := $(SRCDIR)/libftdi
SRC_PICOLIBC := $(SRCDIR)/picolibc
# The version that will be appended to the various tool builds.
RGT_VERSION ?= 8.3.0-2019.11.0-preview5
RGDB_VERSION ?= 8.3.0-2019.11.0-preview4
RGBU_VERSION ?= 2.32.0-2019.11.0-preview4
ROCD_VERSION ?= 0.10.0-2019.08.2
RQEMU_VERSION ?= 4.1.0-2019.08.0
XC3SP_VERSION ?= 0.1.2-2019.08.0
TDC_VERSION ?= 0.0.0-2019.08.0
SDKU_VERSION ?= 0.0.0-2019.11.0-dasm1
PY_VERSION ?= 2.7.0-2019.11.0-preview1
FT_VERSION ?= 2019.11.0-preview4
# The toolchain build needs the tools in the PATH, and the windows build uses the ubuntu (native)
PATH := $(abspath $(OBJ_NATIVE)/install/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(NATIVE)/bin):$(PATH)
export PATH
# The actual output of this repository is a set of tarballs.
.PHONY: win64 win64-non-toolchain win64-toolchain win64-gdb-only win64-openocd win64-qemu win64-xc3sprog win64-trace-decoder win64-sdk-utilities win64-python win64-combo-package
win64: win64-toolchain win64-openocd win64-qemu win64-xc3sprog win64-trace-decoder win64-sdk-utilities win64-python win64-combo-package
win64-non-toolchain: win64-openocd win64-qemu win64-xc3sprog win64-trace-decoder win64-sdk-utilities win64-python
win64-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(WIN64).zip
win64-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(WIN64).src.zip
win64-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(WIN64).tar.gz
win64-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(WIN64).src.tar.gz
win64-gdb-only: $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$(WIN64).zip
win64-gdb-only: $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$(WIN64).src.zip
win64-gdb-only: $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$(WIN64).tar.gz
win64-gdb-only: $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$(WIN64).src.tar.gz
win64-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(WIN64).zip
win64-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(WIN64).src.zip
win64-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(WIN64).tar.gz
win64-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(WIN64).src.tar.gz
win64-qemu: $(BINDIR)/riscv-qemu-$(RQEMU_VERSION)-$(WIN64).zip
win64-qemu: $(BINDIR)/riscv-qemu-$(RQEMU_VERSION)-$(WIN64).src.zip
win64-qemu: $(BINDIR)/riscv-qemu-$(RQEMU_VERSION)-$(WIN64).tar.gz
win64-qemu: $(BINDIR)/riscv-qemu-$(RQEMU_VERSION)-$(WIN64).src.tar.gz
win64-xc3sprog: $(BINDIR)/xc3sprog-$(XC3SP_VERSION)-$(WIN64).zip
win64-xc3sprog: $(BINDIR)/xc3sprog-$(XC3SP_VERSION)-$(WIN64).src.zip
win64-xc3sprog: $(BINDIR)/xc3sprog-$(XC3SP_VERSION)-$(WIN64).tar.gz
win64-xc3sprog: $(BINDIR)/xc3sprog-$(XC3SP_VERSION)-$(WIN64).src.tar.gz
win64-trace-decoder: $(BINDIR)/trace-decoder-$(TDC_VERSION)-$(WIN64).zip
win64-trace-decoder: $(BINDIR)/trace-decoder-$(TDC_VERSION)-$(WIN64).src.zip
win64-trace-decoder: $(BINDIR)/trace-decoder-$(TDC_VERSION)-$(WIN64).tar.gz
win64-trace-decoder: $(BINDIR)/trace-decoder-$(TDC_VERSION)-$(WIN64).src.tar.gz
win64-sdk-utilities: $(BINDIR)/sdk-utilities-$(SDKU_VERSION)-$(WIN64).zip
win64-sdk-utilities: $(BINDIR)/sdk-utilities-$(SDKU_VERSION)-$(WIN64).src.zip
win64-sdk-utilities: $(BINDIR)/sdk-utilities-$(SDKU_VERSION)-$(WIN64).tar.gz
win64-sdk-utilities: $(BINDIR)/sdk-utilities-$(SDKU_VERSION)-$(WIN64).src.tar.gz
win64-python: $(BINDIR)/python-$(PY_VERSION)-$(WIN64).zip
win64-python: $(BINDIR)/python-$(PY_VERSION)-$(WIN64).tar.gz
win64-combo-package: $(BINDIR)/freedom-tools-$(FT_VERSION)-$(WIN64).zip
win64-combo-package: $(BINDIR)/freedom-tools-$(FT_VERSION)-$(WIN64).tar.gz
.PHONY: win32 win32-openocd win32-toolchain
win32: win32-openocd win32-toolchain
win32-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(WIN32).zip
win32-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(WIN32).src.zip
win32-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(WIN32).tar.gz
win32-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(WIN32).src.tar.gz
win32-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(WIN32).zip
win32-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(WIN32).src.zip
win32-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(WIN32).tar.gz
win32-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(WIN32).src.tar.gz
.PHONY: ubuntu64 ubuntu64-non-toolchain ubuntu64-toolchain ubuntu64-gdb-only ubuntu64-openocd ubuntu64-qemu ubuntu64-xc3sprog ubuntu64-trace-decoder ubuntu64-sdk-utilities ubuntu64-python ubuntu64-combo-package
ubuntu64: ubuntu64-toolchain ubuntu64-openocd ubuntu64-qemu ubuntu64-xc3sprog ubuntu64-trace-decoder ubuntu64-sdk-utilities ubuntu64-python ubuntu64-combo-package
ubuntu64-non-toolchain: ubuntu64-openocd ubuntu64-qemu ubuntu64-xc3sprog ubuntu64-trace-decoder ubuntu64-sdk-utilities ubuntu64-python
ubuntu64-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(UBUNTU64).tar.gz
ubuntu64-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(UBUNTU64).src.tar.gz
ubuntu64-gdb-only: $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$(UBUNTU64).tar.gz
ubuntu64-gdb-only: $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$(UBUNTU64).src.tar.gz
ubuntu64-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU64).tar.gz
ubuntu64-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU64).src.tar.gz
ubuntu64-qemu: $(BINDIR)/riscv-qemu-$(RQEMU_VERSION)-$(UBUNTU64).tar.gz
ubuntu64-qemu: $(BINDIR)/riscv-qemu-$(RQEMU_VERSION)-$(UBUNTU64).src.tar.gz
ubuntu64-xc3sprog: $(BINDIR)/xc3sprog-$(XC3SP_VERSION)-$(UBUNTU64).tar.gz
ubuntu64-xc3sprog: $(BINDIR)/xc3sprog-$(XC3SP_VERSION)-$(UBUNTU64).src.tar.gz
ubuntu64-trace-decoder: $(BINDIR)/trace-decoder-$(TDC_VERSION)-$(UBUNTU64).tar.gz
ubuntu64-trace-decoder: $(BINDIR)/trace-decoder-$(TDC_VERSION)-$(UBUNTU64).src.tar.gz
ubuntu64-sdk-utilities: $(BINDIR)/sdk-utilities-$(SDKU_VERSION)-$(UBUNTU64).tar.gz
ubuntu64-sdk-utilities: $(BINDIR)/sdk-utilities-$(SDKU_VERSION)-$(UBUNTU64).src.tar.gz
ubuntu64-python: $(BINDIR)/python-$(PY_VERSION)-$(UBUNTU64).tar.gz
ubuntu64-combo-package: $(BINDIR)/freedom-tools-$(FT_VERSION)-$(UBUNTU64).tar.gz
.PHONY: ubuntu32 ubuntu32-toolchain ubuntu32-openocd
ubuntu32: ubuntu32-toolchain ubuntu32-openocd
ubuntu32-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(UBUNTU32).tar.gz
ubuntu32-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(UBUNTU32).src.tar.gz
ubuntu32-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU32).tar.gz
ubuntu32-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU32).src.tar.gz
.PHONY: redhat redhat-non-toolchain redhat-toolchain redhat-gdb-only redhat-openocd redhat-qemu redhat-xc3sprog redhat-trace-decoder redhat-sdk-utilities redhat-python redhat-combo-package
redhat: redhat-toolchain redhat-openocd redhat-qemu redhat-xc3sprog redhat-trace-decoder redhat-sdk-utilities redhat-python redhat-combo-package
redhat-non-toolchain: redhat-openocd redhat-qemu redhat-xc3sprog redhat-trace-decoder redhat-sdk-utilities redhat-python
redhat-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(REDHAT).tar.gz
redhat-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(REDHAT).src.tar.gz
redhat-gdb-only: $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$(REDHAT).tar.gz
redhat-gdb-only: $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$(REDHAT).src.tar.gz
redhat-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(REDHAT).tar.gz
redhat-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(REDHAT).src.tar.gz
redhat-qemu: $(BINDIR)/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT).tar.gz
redhat-qemu: $(BINDIR)/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT).src.tar.gz
redhat-xc3sprog: $(BINDIR)/xc3sprog-$(XC3SP_VERSION)-$(REDHAT).tar.gz
redhat-xc3sprog: $(BINDIR)/xc3sprog-$(XC3SP_VERSION)-$(REDHAT).src.tar.gz
redhat-trace-decoder: $(BINDIR)/trace-decoder-$(TDC_VERSION)-$(REDHAT).tar.gz
redhat-trace-decoder: $(BINDIR)/trace-decoder-$(TDC_VERSION)-$(REDHAT).src.tar.gz
redhat-sdk-utilities: $(BINDIR)/sdk-utilities-$(SDKU_VERSION)-$(REDHAT).tar.gz
redhat-sdk-utilities: $(BINDIR)/sdk-utilities-$(SDKU_VERSION)-$(REDHAT).src.tar.gz
redhat-python: $(BINDIR)/python-$(PY_VERSION)-$(REDHAT).tar.gz
redhat-combo-package: $(BINDIR)/freedom-tools-$(FT_VERSION)-$(REDHAT).tar.gz
.PHONY: darwin darwin-non-toolchain darwin-toolchain darwin-gdb-only darwin-openocd darwin-qemu darwin-xc3sprog darwin-trace-decoder darwin-sdk-utilities darwin-python darwin-combo-package
darwin: darwin-toolchain darwin-openocd darwin-qemu darwin-xc3sprog darwin-trace-decoder darwin-sdk-utilities darwin-python darwin-combo-package
darwin-non-toolchain: darwin-openocd darwin-qemu darwin-xc3sprog darwin-trace-decoder darwin-sdk-utilities darwin-python
darwin-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(DARWIN).tar.gz
darwin-toolchain: $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$(DARWIN).src.tar.gz
darwin-gdb-only: $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$(DARWIN).tar.gz
darwin-gdb-only: $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$(DARWIN).src.tar.gz
darwin-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(DARWIN).tar.gz
darwin-openocd: $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-$(DARWIN).src.tar.gz
darwin-qemu: $(BINDIR)/riscv-qemu-$(RQEMU_VERSION)-$(DARWIN).tar.gz
darwin-qemu: $(BINDIR)/riscv-qemu-$(RQEMU_VERSION)-$(DARWIN).src.tar.gz
darwin-xc3sprog: $(BINDIR)/xc3sprog-$(XC3SP_VERSION)-$(DARWIN).tar.gz
darwin-xc3sprog: $(BINDIR)/xc3sprog-$(XC3SP_VERSION)-$(DARWIN).src.tar.gz
darwin-trace-decoder: $(BINDIR)/trace-decoder-$(TDC_VERSION)-$(DARWIN).tar.gz
darwin-trace-decoder: $(BINDIR)/trace-decoder-$(TDC_VERSION)-$(DARWIN).src.tar.gz
darwin-sdk-utilities: $(BINDIR)/sdk-utilities-$(SDKU_VERSION)-$(DARWIN).tar.gz
darwin-sdk-utilities: $(BINDIR)/sdk-utilities-$(SDKU_VERSION)-$(DARWIN).src.tar.gz
darwin-python: $(BINDIR)/python-$(PY_VERSION)-$(DARWIN).tar.gz
darwin-combo-package: $(BINDIR)/freedom-tools-$(FT_VERSION)-$(DARWIN).tar.gz
# Some special riscv-gnu-toolchain configure flags for specific targets.
$(WIN32)-rgt-host := --host=$(WIN32)
$(WIN32)-rgcc-configure := --without-system-zlib
$(WIN32)-expat-configure := --host=$(WIN32)
$(WIN32)-xc3sp-host := --host=$(WIN32)
$(WIN64)-rgt-host := --host=$(WIN64)
$(WIN64)-rgcc-configure := --without-system-zlib
$(WIN64)-rgdb-configure := --with-python="$(abspath $(SCRIPTSDIR)/pyconfig-mingw32.sh)"
$(WIN64)-rocd-host := --host=$(WIN64)
$(WIN64)-oftdi-configure := -DCMAKE_TOOLCHAIN_FILE="$(abspath $(OBJ_WIN64)/build/riscv-openocd/libftdi/cmake/Toolchain-x86_64-w64-mingw32.cmake)" -DLIBUSB_LIBRARIES="$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64)/bin/libusb-1.0.dll)" -DLIBUSB_INCLUDE_DIR="$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64)/include/libusb-1.0)"
$(WIN64)-odeps-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64))/lib/pkgconfig" CFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64))/include" CPPFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64))/include"
$(WIN64)-rocd-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64))/lib/pkgconfig" CFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64))/include" CPPFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64))/include"
$(WIN64)-rqemu-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib/pkgconfig" CFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/include" CPPFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/include"
$(WIN64)-rqemu-host := --host=$(WIN64)
$(WIN64)-rqemu-cross := --cross-prefix=x86_64-w64-mingw32-
$(WIN64)-rqemu-bindir := /bin
$(WIN64)-expat-configure := --host=$(WIN64)
$(WIN64)-gettext-configure := --enable-threads=windows
$(WIN64)-glib-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib/pkgconfig" CFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/include"
$(WIN64)-libpng-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib/pkgconfig" CFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/include" CPPFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/include"
$(WIN64)-pixman-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib/pkgconfig" CFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/include" CPPFLAGS="-L$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/riscv-qemu-$(RQEMU_VERSION)-$(WIN64))/include"
$(WIN64)-xc3sp-host := --host=$(WIN64)
$(WIN64)-xftdi-configure := -DCMAKE_TOOLCHAIN_FILE="$(abspath $(OBJ_WIN64)/build/xc3sprog/libftdi/cmake/Toolchain-x86_64-w64-mingw32.cmake)" -DLIBUSB_LIBRARIES="$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64)/bin/libusb-1.0.dll)" -DLIBUSB_INCLUDE_DIR="$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64)/include/libusb-1.0)"
$(WIN64)-xdeps-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64))/lib/pkgconfig" CFLAGS="-L$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64))/include" CPPFLAGS="-L$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64))/include"
$(WIN64)-xc3sp-configure := -DCMAKE_TOOLCHAIN_FILE="$(abspath $(OBJ_WIN64)/build/xc3sprog/xc3sprog/Toolchain-mingw32.cmake)" -DLIBUSB_LIBRARIES="$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64)/bin/libusb-1.0.dll)" -DLIBUSB_INCLUDE_DIR="$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64)/include/libusb-1.0)"
$(WIN64)-xc3sp-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64))/lib/pkgconfig" CFLAGS="-L$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64))/include" CPPFLAGS="-L$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64))/lib -I$(abspath $(OBJ_WIN64)/install/xc3sprog-$(XC3SP_VERSION)-$(WIN64))/include"
$(WIN64)-tdc-cross := x86_64-w64-mingw32-
$(WIN64)-tdc-binext := .exe
$(WIN64)-dtc-configure := CROSSPREFIX=x86_64-w64-mingw32- BINEXT=.exe CC=gcc
$(WIN64)-fe2h-configure := HOST_PREFIX=x86_64-w64-mingw32- EXEC_SUFFIX=.exe
$(WIN64)-sdasm-configure := HOST_PREFIX=x86_64-w64-mingw32- EXEC_SUFFIX=.exe
$(WIN64)-pyobj-tarball := python-2.7.15-x86_64-w64-mingw32.tar.gz
$(UBUNTU32)-rgt-host := --host=i686-linux-gnu
$(UBUNTU32)-rgcc-configure := --with-system-zlib
$(UBUNTU32)-expat-configure := --host=i686-linux-gnu
$(UBUNTU32)-xc3sp-host := --host=x86_64-linux-gnu
$(UBUNTU64)-rgt-host := --host=x86_64-linux-gnu
$(UBUNTU64)-rgcc-configure := --with-system-zlib
$(UBUNTU64)-rgdb-configure := --with-python=python2.7
$(UBUNTU64)-ousb-configure := --disable-shared
$(UBUNTU64)-rocd-host := --host=x86_64-linux-gnu
$(UBUNTU64)-odeps-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_UBUNTU64)/install/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU64))/lib/pkgconfig" CFLAGS="-I$(abspath $(OBJ_UBUNTU64)/install/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU64))/include -fPIC" LDFLAGS="-L$(abspath $(OBJ_UBUNTU64)/install/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU64))/lib -pthread"
$(UBUNTU64)-rocd-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_UBUNTU64)/install/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU64))/lib/pkgconfig" CFLAGS="-I$(abspath $(OBJ_UBUNTU64)/install/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU64))/include" CPPFLAGS="-I$(abspath $(OBJ_UBUNTU64)/install/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU64))/include" LIBUSB_INCLUDE_DIRS="$(abspath $(OBJ_UBUNTU64)/install/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU64))/include" LDFLAGS="-L$(abspath $(OBJ_UBUNTU64)/install/riscv-openocd-$(ROCD_VERSION)-$(UBUNTU64))/lib"
$(UBUNTU64)-rqemu-host := --host=x86_64-linux-gnu
$(UBUNTU64)-expat-configure := --host=x86_64-linux-gnu
$(UBUNTU64)-gettext-configure:= --enable-threads=posix
$(UBUNTU64)-glib-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_UBUNTU64)/install/riscv-qemu-$(RQEMU_VERSION)-$(UBUNTU64))/lib/pkgconfig" CFLAGS="-L$(abspath $(OBJ_UBUNTU64)/install/riscv-qemu-$(RQEMU_VERSION)-$(UBUNTU64))/lib -I$(abspath $(OBJ_UBUNTU64)/install/riscv-qemu-$(RQEMU_VERSION)-$(UBUNTU64))/include"
$(UBUNTU64)-xc3sp-host := --host=x86_64-linux-gnu
$(UBUNTU64)-xdeps-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_UBUNTU64)/install/xc3sprog-$(XC3SP_VERSION)-$(UBUNTU64))/lib/pkgconfig" CFLAGS="-I$(abspath $(OBJ_UBUNTU64)/install/xc3sprog-$(XC3SP_VERSION)-$(UBUNTU64))/include" LDFLAGS="-L$(abspath $(OBJ_UBUNTU64)/install/xc3sprog-$(XC3SP_VERSION)-$(UBUNTU64))/lib"
$(UBUNTU64)-xc3sp-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_UBUNTU64)/install/xc3sprog-$(XC3SP_VERSION)-$(UBUNTU64))/lib/pkgconfig" CFLAGS="-I$(abspath $(OBJ_UBUNTU64)/install/xc3sprog-$(XC3SP_VERSION)-$(UBUNTU64))/include" CPPFLAGS="-I$(abspath $(OBJ_UBUNTU64)/install/xc3sprog-$(XC3SP_VERSION)-$(UBUNTU64))/include" LIBUSB_INCLUDE_DIRS="$(abspath $(OBJ_UBUNTU64)/install/xc3sprog-$(XC3SP_VERSION)-$(UBUNTU64))/include" LDFLAGS="-L$(abspath $(OBJ_UBUNTU64)/install/xc3sprog-$(XC3SP_VERSION)-$(UBUNTU64))/lib"
$(UBUNTU64)-pyobj-tarball := python-2.7.12-x86_64-linux-ubuntu14.tar.gz
$(DARWIN)-rgcc-configure := --with-system-zlib
$(DARWIN)-rgdb-configure := --with-python=python2.7
$(DARWIN)-ousb-configure := --disable-shared
$(DARWIN)-odeps-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_DARWIN)/install/riscv-openocd-$(ROCD_VERSION)-$(DARWIN))/lib/pkgconfig" CFLAGS="-I$(abspath $(OBJ_DARWIN)/install/riscv-openocd-$(ROCD_VERSION)-$(DARWIN))/include" CPPFLAGS="-I$(abspath $(OBJ_DARWIN)/install/riscv-openocd-$(ROCD_VERSION)-$(DARWIN))/include" LDFLAGS="-L$(abspath $(OBJ_DARWIN)/install/riscv-openocd-$(ROCD_VERSION)-$(DARWIN))/lib -framework CoreFoundation -framework IOKit"
$(DARWIN)-rocd-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_DARWIN)/install/riscv-openocd-$(ROCD_VERSION)-$(DARWIN))/lib/pkgconfig" CFLAGS="-I$(abspath $(OBJ_DARWIN)/install/riscv-openocd-$(ROCD_VERSION)-$(DARWIN))/include -O2" CPPFLAGS="-I$(abspath $(OBJ_DARWIN)/install/riscv-openocd-$(ROCD_VERSION)-$(DARWIN))/include" LDFLAGS="-L$(abspath $(OBJ_DARWIN)/install/riscv-openocd-$(ROCD_VERSION)-$(DARWIN))/lib -framework CoreFoundation -framework IOKit"
$(DARWIN)-rqemu-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_DARWIN)/install/riscv-qemu-$(RQEMU_VERSION)-$(DARWIN))/lib/pkgconfig" CFLAGS="-I$(abspath $(OBJ_DARWIN)/install/riscv-qemu-$(RQEMU_VERSION)-$(DARWIN))/include" CPPFLAGS="-I$(abspath $(OBJ_DARWIN)/install/riscv-qemu-$(RQEMU_VERSION)-$(DARWIN))/include" LDFLAGS="-L$(abspath $(OBJ_DARWIN)/install/riscv-qemu-$(RQEMU_VERSION)-$(DARWIN))/lib -liconv -framework CoreFoundation -framework Carbon" PATH=/usr/local/opt/gettext/bin:$(PATH)
$(DARWIN)-expat-configure := --disable-shared --enable-static
$(DARWIN)-gettext-configure := --enable-threads=posix
$(DARWIN)-glib-configure := --enable-static
$(DARWIN)-glib-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_DARWIN)/install/riscv-qemu-$(RQEMU_VERSION)-$(DARWIN))/lib/pkgconfig" CFLAGS="-L$(abspath $(OBJ_DARWIN)/install/riscv-qemu-$(RQEMU_VERSION)-$(DARWIN))/lib -I$(abspath $(OBJ_DARWIN)/install/riscv-qemu-$(RQEMU_VERSION)-$(DARWIN))/include" PATH=/usr/local/opt/gettext/bin:$(PATH)
$(DARWIN)-xdeps-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_DARWIN)/install/xc3sprog-$(XC3SP_VERSION)-$(DARWIN))/lib/pkgconfig" CFLAGS="-I$(abspath $(OBJ_DARWIN)/install/xc3sprog-$(XC3SP_VERSION)-$(DARWIN))/include" CPPFLAGS="-I$(abspath $(OBJ_DARWIN)/install/xc3sprog-$(XC3SP_VERSION)-$(DARWIN))/include" LDFLAGS="-L$(abspath $(OBJ_DARWIN)/install/xc3sprog-$(XC3SP_VERSION)-$(DARWIN))/lib -framework CoreFoundation -framework IOKit"
$(DARWIN)-xc3sp-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_DARWIN)/install/xc3sprog-$(XC3SP_VERSION)-$(DARWIN))/lib/pkgconfig" CFLAGS="-I$(abspath $(OBJ_DARWIN)/install/xc3sprog-$(XC3SP_VERSION)-$(DARWIN))/include" CPPFLAGS="-I$(abspath $(OBJ_DARWIN)/install/xc3sprog-$(XC3SP_VERSION)-$(DARWIN))/include" LDFLAGS="-L$(abspath $(OBJ_DARWIN)/install/xc3sprog-$(XC3SP_VERSION)-$(DARWIN))/lib -liconv -framework CoreFoundation -framework IOKit"
$(DARWIN)-xc3sp-framework := -framework CoreFoundation -framework IOKit
$(DARWIN)-pyobj-tarball := python-2.7.10-x86_64-apple-darwin.tar.gz
$(REDHAT)-rgcc-configure := --with-system-zlib
$(REDHAT)-rgdb-configure := --with-python="$(abspath $(SCRIPTSDIR)/pyconfig-centos.sh)"
$(REDHAT)-ousb-configure := --disable-shared
$(REDHAT)-odeps-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/lib/pkgconfig:$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/lib64/pkgconfig" CFLAGS="-I$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/include -fPIC" LDFLAGS="-L$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/lib -L$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/lib64 -lrt"
$(REDHAT)-rocd-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/lib/pkgconfig:$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/lib64/pkgconfig" CFLAGS="-I$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/include -O2" CPPFLAGS="-I$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/include" LIBUSB_INCLUDE_DIRS="$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/include" LDFLAGS="-L$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/lib -L$(abspath $(OBJ_REDHAT)/install/riscv-openocd-$(ROCD_VERSION)-$(REDHAT))/lib64 -lrt"
$(REDHAT)-rqemu-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_REDHAT)/install/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT))/lib/pkgconfig" CFLAGS="-fPIC -I$(abspath $(OBJ_REDHAT)/install/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT))/include -Wno-unused-result" CPPFLAGS="-fPIC -I$(abspath $(OBJ_REDHAT)/install/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT))/include" LDFLAGS="-L$(abspath $(OBJ_REDHAT)/install/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT))/lib -liconv" LIBS="-L$(abspath $(OBJ_REDHAT)/install/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT))/lib -liconv" SIFIVE_LIBS_QGA="-L$(abspath $(OBJ_REDHAT)/install/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT))/lib -liconv"
$(REDHAT)-zlib-configure := -static
$(REDHAT)-gettext-configure := --enable-threads=posix
$(REDHAT)-glib-configure := --enable-static
$(REDHAT)-glib-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_REDHAT)/install/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT))/lib/pkgconfig" CFLAGS="-fPIC -L$(abspath $(OBJ_REDHAT)/install/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT))/lib -I$(abspath $(OBJ_REDHAT)/install/riscv-qemu-$(RQEMU_VERSION)-$(REDHAT))/include"
$(REDHAT)-libpng-vars := CFLAGS="-fPIC" CPPFLAGS="-fPIC"
$(REDHAT)-pixman-vars := CFLAGS="-fPIC" CPPFLAGS="-fPIC"
$(REDHAT)-deps-vars := CFLAGS="-fPIC"
$(REDHAT)-xdeps-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/lib/pkgconfig:$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/lib64/pkgconfig" CFLAGS="-I$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/include" LDFLAGS="-L$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/lib -L$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/lib64 -lrt"
$(REDHAT)-xc3sp-vars := PKG_CONFIG_PATH="$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/lib/pkgconfig:$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/lib64/pkgconfig" CFLAGS="-I$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/include" CPPFLAGS="-I$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/include" LIBUSB_INCLUDE_DIRS="$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/include" LDFLAGS="-L$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/lib -L$(abspath $(OBJ_REDHAT)/install/xc3sprog-$(XC3SP_VERSION)-$(REDHAT))/lib64 -lrt"
$(REDHAT)-xc3sp-configure := -DLIBRT_LIBRARIES="rt"
$(REDHAT)-pyobj-tarball := python-2.7.16-x86_64-linux-centos6.tar.gz
# Some general riscv-gnu-toolchain flags and list of multilibs for the multilibs generator script
WITH_ABI := lp64d
WITH_ARCH := rv64imafdc
WITH_CMODEL := medany
NEWLIB_TUPLE := riscv64-unknown-elf
MULTILIBS_GEN := \
rv32e-ilp32e--c \
rv32ea-ilp32e--m \
rv32em-ilp32e--c \
rv32eac-ilp32e-- \
rv32emac-ilp32e-- \
rv32i-ilp32--c,f,fc,fd,fdc \
rv32ia-ilp32-rv32ima,rv32iaf,rv32imaf,rv32iafd,rv32imafd- \
rv32im-ilp32--c,f,fc,fd,fdc \
rv32iac-ilp32--f,fd \
rv32imac-ilp32-rv32imafc,rv32imafdc- \
rv32if-ilp32f--c,d,dc \
rv32iaf-ilp32f--c,d,dc \
rv32imf-ilp32f--d \
rv32imaf-ilp32f-rv32imafd- \
rv32imfc-ilp32f--d \
rv32imafc-ilp32f-rv32imafdc- \
rv32ifd-ilp32d--c \
rv32imfd-ilp32d--c \
rv32iafd-ilp32d-rv32imafd,rv32iafdc- \
rv32imafdc-ilp32d-- \
rv64i-lp64--c,f,fc,fd,fdc \
rv64ia-lp64-rv64ima,rv64iaf,rv64imaf,rv64iafd,rv64imafd- \
rv64im-lp64--c,f,fc,fd,fdc \
rv64iac-lp64--f,fd \
rv64imac-lp64-rv64imafc,rv64imafdc- \
rv64if-lp64f--c,d,dc \
rv64iaf-lp64f--c,d,dc \
rv64imf-lp64f--d \
rv64imaf-lp64f-rv64imafd- \
rv64imfc-lp64f--d \
rv64imafc-lp64f-rv64imafdc- \
rv64ifd-lp64d--c \
rv64imfd-lp64d--c \
rv64iafd-lp64d-rv64imafd,rv64iafdc- \
rv64imafdc-lp64d--
CFLAGS_FOR_TARGET := $(CFLAGS_FOR_TARGET_EXTRA) -mcmodel=$(WITH_CMODEL)
CXXFLAGS_FOR_TARGET := $(CXXFLAGS_FOR_TARGET_EXTRA) -mcmodel=$(WITH_CMODEL)
# --with-expat is required to enable XML support used by OpenOCD.
BINUTILS_TARGET_FLAGS := --with-expat=yes $(BINUTILS_TARGET_FLAGS_EXTRA) --with-mpc=no --with-mpfr=no --with-gmp=no
GDB_TARGET_FLAGS := --with-expat=yes $(GDB_TARGET_FLAGS_EXTRA) --with-mpc=no --with-mpfr=no --with-gmp=no
NEWLIB_CC_FOR_TARGET ?= $(NEWLIB_TUPLE)-gcc
NEWLIB_CXX_FOR_TARGET ?= $(NEWLIB_TUPLE)-g++
# There's enough % rules that make starts blowing intermediate files away.
.SECONDARY:
# Builds riscv-gnu-toolchain for various targets.
$(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-%.zip: \
$(OBJDIR)/%/stamps/riscv-gnu-toolchain/install.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-%.zip,%,$@))
mkdir -p $(dir $@)
cd $(OBJDIR)/$($@_TARGET)/install; zip -rq $(abspath $@) riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET)
$(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-%.src.zip: \
$(OBJDIR)/%/stamps/riscv-gnu-toolchain/install.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-%.src.zip,%,$@))
mkdir -p $(dir $@)
cd $(OBJDIR)/$($@_TARGET)/build; zip -rq $(abspath $@) riscv-gnu-toolchain expat
$(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-%.tar.gz: \
$(OBJDIR)/%/stamps/riscv-gnu-toolchain/install.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-%.tar.gz,%,$@))
mkdir -p $(dir $@)
$(TAR) --dereference --hard-dereference -C $(OBJDIR)/$($@_TARGET)/install -c riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET) | gzip > $(abspath $@)
$(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-%.src.tar.gz: \
$(OBJDIR)/%/stamps/riscv-gnu-toolchain/install.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv64-unknown-elf-gcc-$(RGT_VERSION)-%.src.tar.gz,%,$@))
mkdir -p $(dir $@)
$(TAR) --dereference --hard-dereference -C $(OBJDIR)/$($@_TARGET)/build -c riscv-gnu-toolchain expat | gzip > $(abspath $@)
$(OBJDIR)/%/stamps/riscv-gnu-toolchain/install.stamp: \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-gcc-newlib-stage2/stamp \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-gdb-py-newlib/stamp \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-picolibc/stamp
mkdir -p $(dir $@)
date > $@
$(OBJDIR)/%/build/riscv-gnu-toolchain/stamp:
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-toolchain/stamp,%,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
mkdir -p $(dir $@)/python
cd $(dir $@); curl -L -f -s -o $($($@_TARGET)-pyobj-tarball) https://github.com/sifive/freedom-tools-resources/releases/download/v0-test1/$($($@_TARGET)-pyobj-tarball)
cd $(dir $@)/python; $(TAR) -xf ../$($($@_TARGET)-pyobj-tarball)
cd $(dir $@); rm $($($@_TARGET)-pyobj-tarball)
cp -a $(SRC_RBU) $(SRC_RGCC) $(SRC_RGDB) $(SRC_RNL) $(dir $@)
$(SED) -E -i -f $(SCRIPTSDIR)/gdb-python.sed $(dir $@)/riscv-gdb/gdb/python/python.c
cd $(dir $@)/riscv-gcc; ./contrib/download_prerequisites
cd $(dir $@)/riscv-gcc/gcc/config/riscv; rm t-elf-multilib; ./multilib-generator $(MULTILIBS_GEN) > t-elf-multilib
date > $@
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-binutils-newlib/stamp: \
$(OBJDIR)/%/stamps/expat/install.stamp \
$(OBJDIR)/%/build/riscv-gnu-toolchain/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-toolchain/build-binutils-newlib/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-toolchain/build-binutils-newlib/stamp,%/install/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-toolchain/build-binutils-newlib/stamp,%/build/riscv-gnu-toolchain,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
# CC_FOR_TARGET is required for the ld testsuite.
cd $(dir $@) && CC_FOR_TARGET=$(NEWLIB_CC_FOR_TARGET) $(abspath $($@_BUILD))/riscv-binutils/configure \
--target=$(NEWLIB_TUPLE) \
$($($@_TARGET)-rgt-host) \
--prefix=$(abspath $($@_INSTALL)) \
--with-pkgversion="SiFive Binutils $(RGBU_VERSION)" \
--with-bugurl="https://github.com/sifive/freedom-tools/issues" \
--disable-werror \
$(BINUTILS_TARGET_FLAGS) \
--disable-gdb \
--disable-sim \
--disable-libdecnumber \
--disable-libreadline \
CFLAGS="-O2" \
CXXFLAGS="-O2" &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install -j1 install-pdf install-html &>$(dir $@)/make-install.log
date > $@
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-gdb-newlib/stamp: \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-binutils-newlib/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-toolchain/build-gdb-newlib/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-toolchain/build-gdb-newlib/stamp,%/install/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-toolchain/build-gdb-newlib/stamp,%/build/riscv-gnu-toolchain,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
# CC_FOR_TARGET is required for the ld testsuite.
cd $(dir $@) && CC_FOR_TARGET=$(NEWLIB_CC_FOR_TARGET) $(abspath $($@_BUILD))/riscv-gdb/configure \
--target=$(NEWLIB_TUPLE) \
$($($@_TARGET)-rgt-host) \
--prefix=$(abspath $($@_INSTALL)) \
--with-pkgversion="SiFive GDB $(RGDB_VERSION)" \
--with-bugurl="https://github.com/sifive/freedom-tools/issues" \
--disable-werror \
$(GDB_TARGET_FLAGS) \
--with-python=no \
--enable-gdb \
--disable-gas \
--disable-binutils \
--disable-ld \
--disable-gold \
--disable-gprof \
CFLAGS="-O2" \
CXXFLAGS="-O2" &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install -j1 install-pdf install-html &>$(dir $@)/make-install.log
date > $@
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-gdb-py-newlib/stamp: \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-gdb-newlib/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-toolchain/build-gdb-py-newlib/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-toolchain/build-gdb-py-newlib/stamp,%/install/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-toolchain/build-gdb-py-newlib/stamp,%/build/riscv-gnu-toolchain,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
# CC_FOR_TARGET is required for the ld testsuite.
cd $(dir $@) && CC_FOR_TARGET=$(NEWLIB_CC_FOR_TARGET) $(abspath $($@_BUILD))/riscv-gdb/configure \
--target=$(NEWLIB_TUPLE) \
$($($@_TARGET)-rgt-host) \
--prefix=$(abspath $($@_INSTALL)) \
--with-pkgversion="SiFive GDB $(RGDB_VERSION)" \
--with-bugurl="https://github.com/sifive/freedom-tools/issues" \
--disable-werror \
$(GDB_TARGET_FLAGS) \
$($($@_TARGET)-rgdb-configure) \
--program-prefix="$(NEWLIB_TUPLE)-" \
--program-suffix="-py" \
--enable-gdb \
--disable-gas \
--disable-binutils \
--disable-ld \
--disable-gold \
--disable-gprof \
CFLAGS="-O2" \
CXXFLAGS="-O2" &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install -j1 install-pdf install-html &>$(dir $@)/make-install.log
date > $@
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-gcc-newlib-stage1/stamp: \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-binutils-newlib/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-toolchain/build-gcc-newlib-stage1/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-toolchain/build-gcc-newlib-stage1/stamp,%/install/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-toolchain/build-gcc-newlib-stage1/stamp,%/build/riscv-gnu-toolchain,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
cd $(dir $@) && $(abspath $($@_BUILD))/riscv-gcc/configure \
--target=$(NEWLIB_TUPLE) \
$($($@_TARGET)-rgt-host) \
--prefix=$(abspath $($@_INSTALL)) \
--with-pkgversion="SiFive GCC $(RGT_VERSION)" \
--with-bugurl="https://github.com/sifive/freedom-tools/issues" \
--disable-shared \
--disable-threads \
--disable-tls \
--enable-languages=c,c++ \
--with-newlib \
--with-sysroot=$(abspath $($@_INSTALL))/$(NEWLIB_TUPLE) \
--disable-libmudflap \
--disable-libssp \
--disable-libquadmath \
--disable-libgomp \
--disable-nls \
--disable-tm-clone-registry \
--src=../riscv-gcc \
$($($@_TARGET)-rgcc-configure) \
--enable-checking=yes \
--enable-multilib \
--with-abi=$(WITH_ABI) \
--with-arch=$(WITH_ARCH) \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
CFLAGS_FOR_TARGET="-Os $(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="-Os $(CXXFLAGS_FOR_TARGET)" &>make-configure.log
$(MAKE) -C $(dir $@) all-gcc &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install-gcc &>$(dir $@)/make-install.log
date > $@
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-newlib/stamp: \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-gcc-newlib-stage1/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-toolchain/build-newlib/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-toolchain/build-newlib/stamp,%/install/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-toolchain/build-newlib/stamp,%/build/riscv-gnu-toolchain,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
cd $(dir $@) && $(abspath $($@_BUILD))/riscv-newlib/configure \
--target=$(NEWLIB_TUPLE) \
$($($@_TARGET)-rgt-host) \
--prefix=$(abspath $($@_INSTALL)) \
--enable-newlib-io-long-double \
--enable-newlib-io-long-long \
--enable-newlib-io-c99-formats \
--enable-newlib-register-fini \
CFLAGS_FOR_TARGET="-O2 -D_POSIX_MODE $(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="-O2 -D_POSIX_MODE $(CXXFLAGS_FOR_TARGET)" &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install &>$(dir $@)/make-install.log
# These install multiple copies of the same docs into the same destination
# for a multilib build. So we must not parallelize them.
# TODO: Rewrite so that we only install one copy of the docs.
$(MAKE) -j1 -C $(dir $@) install-pdf install-html &>$(dir $@)/make-install-doc.log
date > $@
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-newlib-nano/stamp: \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-gcc-newlib-stage1/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-toolchain/build-newlib-nano/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-toolchain/build-newlib-nano/stamp,%/install/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-toolchain/build-newlib-nano/stamp,%/build/riscv-gnu-toolchain,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
cd $(dir $@) && $(abspath $($@_BUILD))/riscv-newlib/configure \
--target=$(NEWLIB_TUPLE) \
$($($@_TARGET)-rgt-host) \
--prefix=$(abspath $($@_BUILD)/build-newlib-nano-install) \
--enable-newlib-reent-small \
--disable-newlib-fvwrite-in-streamio \
--disable-newlib-fseek-optimization \
--disable-newlib-wide-orient \
--enable-newlib-nano-malloc \
--disable-newlib-unbuf-stream-opt \
--enable-lite-exit \
--enable-newlib-global-atexit \
--enable-newlib-nano-formatted-io \
--disable-newlib-supplied-syscalls \
--disable-nls \
CFLAGS_FOR_TARGET="-Os -ffunction-sections -fdata-sections $(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="-Os -ffunction-sections -fdata-sections $(CXXFLAGS_FOR_TARGET)" &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install &>$(dir $@)/make-install.log
date > $@
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-newlib-nano-install/stamp: \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-newlib-nano/stamp \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-newlib/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-toolchain/build-newlib-nano-install/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-toolchain/build-newlib-nano-install/stamp,%/install/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-toolchain/build-newlib-nano-install/stamp,%/build/riscv-gnu-toolchain,$@))
# Copy nano library files into newlib install dir.
set -e; \
bnl="$(abspath $($@_BUILD))/build-newlib-nano-install/$(NEWLIB_TUPLE)/lib"; \
inl="$(abspath $($@_INSTALL))/$(NEWLIB_TUPLE)/lib"; \
for bnlc in `find $${bnl} -name libc.a`; \
do \
inlc=`echo $${bnlc} | $(SED) -e "s:$${bnl}::" | $(SED) -e "s:libc\.a:libc_nano.a:g"`; \
cp $${bnlc} $${inl}$${inlc}; \
done; \
for bnlg in `find $${bnl} -name libg.a`; \
do \
inlg=`echo $${bnlg} | $(SED) -e "s:$${bnl}::" | $(SED) -e "s:libg\.a:libg_nano.a:g"`; \
cp $${bnlg} $${inl}$${inlg}; \
done; \
for bnls in `find $${bnl} -name libgloss.a`; \
do \
inls=`echo $${bnls} | $(SED) -e "s:$${bnl}::" | $(SED) -e "s:libgloss\.a:libgloss_nano.a:g"`; \
cp $${bnls} $${inl}$${inls}; \
done
for bnls in `find $${bnl} -name crt0.0`; \
do \
inls=`echo $${bnls} | $(SED) -e "s:$${bnl}::"`; \
cp $${bnls} $${inl}$${inls}; \
done
# Copy nano header files into newlib install dir.
mkdir -p $(abspath $($@_INSTALL))/$(NEWLIB_TUPLE)/include/newlib-nano; \
cp $(abspath $($@_BUILD))/build-newlib-nano-install/$(NEWLIB_TUPLE)/include/newlib.h \
$(abspath $($@_INSTALL))/$(NEWLIB_TUPLE)/include/newlib-nano/newlib.h; \
date > $@
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-gcc-newlib-stage2/stamp: \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-newlib/stamp \
$(OBJDIR)/%/build/riscv-gnu-toolchain/build-newlib-nano-install/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-toolchain/build-gcc-newlib-stage2/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-toolchain/build-gcc-newlib-stage2/stamp,%/install/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-toolchain/build-gcc-newlib-stage2/stamp,%/build/riscv-gnu-toolchain,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
cd $(dir $@) && $(abspath $($@_BUILD))/riscv-gcc/configure \
--target=$(NEWLIB_TUPLE) \
$($($@_TARGET)-rgt-host) \
--prefix=$(abspath $($@_INSTALL)) \
--with-pkgversion="SiFive GCC $(RGT_VERSION)" \
--with-bugurl="https://github.com/sifive/freedom-tools/issues" \
--disable-shared \
--disable-threads \
--enable-languages=c,c++ \
--enable-tls \
--with-newlib \
--with-sysroot=$(abspath $($@_INSTALL))/$(NEWLIB_TUPLE) \
--with-native-system-header-dir=/include \
--disable-libmudflap \
--disable-libssp \
--disable-libquadmath \
--disable-libgomp \
--disable-nls \
--disable-tm-clone-registry \
--src=../riscv-gcc \
$($($@_TARGET)-rgcc-configure) \
--enable-checking=yes \
--enable-multilib \
--with-abi=$(WITH_ABI) \
--with-arch=$(WITH_ARCH) \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
CFLAGS_FOR_TARGET="-Os $(CFLAGS_FOR_TARGET)" \
CXXFLAGS_FOR_TARGET="-Os $(CXXFLAGS_FOR_TARGET)" &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install -j1 install-pdf install-html &>$(dir $@)/make-install.log
date > $@
# The Windows build requires the native toolchain. The dependency is enforced
# here, PATH allows the tools to get access.
$(OBJ_WIN64)/stamps/riscv-gnu-toolchain/install.stamp: \
$(OBJ_NATIVE)/stamps/riscv-gnu-toolchain/install.stamp
$(OBJ_WIN32)/stamps/riscv-gnu-toolchain/install.stamp: \
$(OBJ_NATIVE)/stamps/riscv-gnu-toolchain/install.stamp
# OpenOCD requires a GDB that's been build with expat support so it can read
# the target XML files.
$(OBJDIR)/%/stamps/expat/install.stamp: \
$(OBJDIR)/%/build/expat/configure
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/stamps/expat/install.stamp,%,$@))
$(eval $@_BUILD := $(patsubst %/stamps/expat/install.stamp,%/build/expat,$@))
$(eval $@_INSTALL := $(patsubst %/stamps/expat/install.stamp,%/install/riscv64-unknown-elf-gcc-$(RGT_VERSION)-$($@_TARGET),$@))
mkdir -p $($@_BUILD)
cd $($@_BUILD); ./configure --prefix=$(abspath $($@_INSTALL)) $($($@_TARGET)-expat-configure) &>make-configure.log
$(MAKE) -C $($@_BUILD) buildlib &>$($@_BUILD)/make-buildlib.log
$(MAKE) -C $($@_BUILD) installlib &>$($@_BUILD)/make-installlib.log
mkdir -p $(dir $@)
date > $@
$(OBJDIR)/%/build/expat/configure:
rm -rf $(dir $@)
mkdir -p $(dir $@)
cp -a $(SRC_EXPAT)/* $(dir $@)
mkdir -p $(dir $@)/m4
cd $(dir $@); ./buildconf.sh &>make-buildconf.log
touch -c $@
# Builds riscv-gdb-only for various targets.
$(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-%.zip: \
$(OBJDIR)/%/stamps/riscv-gnu-gdb-only/install.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-%.zip,%,$@))
mkdir -p $(dir $@)
cd $(OBJDIR)/$($@_TARGET)/install; zip -rq $(abspath $@) riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$($@_TARGET)
$(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-%.src.zip: \
$(OBJDIR)/%/stamps/riscv-gnu-gdb-only/install.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-%.src.zip,%,$@))
mkdir -p $(dir $@)
cd $(OBJDIR)/$($@_TARGET)/build; zip -rq $(abspath $@) riscv-gnu-gdb-only expat-gdb
$(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-%.tar.gz: \
$(OBJDIR)/%/stamps/riscv-gnu-gdb-only/install.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-%.tar.gz,%,$@))
mkdir -p $(dir $@)
$(TAR) --dereference --hard-dereference -C $(OBJDIR)/$($@_TARGET)/install -c riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$($@_TARGET) | gzip > $(abspath $@)
$(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-%.src.tar.gz: \
$(OBJDIR)/%/stamps/riscv-gnu-gdb-only/install.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-%.src.tar.gz,%,$@))
mkdir -p $(dir $@)
$(TAR) --dereference --hard-dereference -C $(OBJDIR)/$($@_TARGET)/build -c riscv-gnu-gdb-only expat-gdb | gzip > $(abspath $@)
$(OBJDIR)/%/stamps/riscv-gnu-gdb-only/install.stamp: \
$(OBJDIR)/%/build/riscv-gnu-gdb-only/build-gdb-py-newlib/stamp
mkdir -p $(dir $@)
date > $@
$(OBJDIR)/%/build/riscv-gnu-gdb-only/stamp:
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-gdb-only/stamp,%,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
mkdir -p $(dir $@)/python
cd $(dir $@); curl -L -f -s -o $($($@_TARGET)-pyobj-tarball) https://github.com/sifive/freedom-tools-resources/releases/download/v0-test1/$($($@_TARGET)-pyobj-tarball)
cd $(dir $@)/python; $(TAR) -xf ../$($($@_TARGET)-pyobj-tarball)
cd $(dir $@); rm $($($@_TARGET)-pyobj-tarball)
cp -a $(SRC_RBU) $(SRC_RGDB) $(dir $@)
$(SED) -E -i -f $(SCRIPTSDIR)/gdb-python.sed $(dir $@)/riscv-gdb/gdb/python/python.c
date > $@
$(OBJDIR)/%/build/riscv-gnu-gdb-only/build-binutils-newlib/stamp: \
$(OBJDIR)/%/stamps/expat-gdb/install.stamp \
$(OBJDIR)/%/build/riscv-gnu-gdb-only/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-gdb-only/build-binutils-newlib/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-gdb-only/build-binutils-newlib/stamp,%/install/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-gdb-only/build-binutils-newlib/stamp,%/build/riscv-gnu-gdb-only,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
# CC_FOR_TARGET is required for the ld testsuite.
cd $(dir $@) && CC_FOR_TARGET=$(NEWLIB_CC_FOR_TARGET) $(abspath $($@_BUILD))/riscv-binutils/configure \
--target=$(NEWLIB_TUPLE) \
$($($@_TARGET)-rgt-host) \
--prefix=$(abspath $($@_INSTALL)) \
--with-pkgversion="SiFive Binutils $(RGBU_VERSION)" \
--with-bugurl="https://github.com/sifive/freedom-tools/issues" \
--disable-werror \
$(BINUTILS_TARGET_FLAGS) \
--disable-gdb \
--disable-sim \
--disable-libdecnumber \
--disable-libreadline \
CFLAGS="-O2" \
CXXFLAGS="-O2" &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install -j1 install-pdf install-html &>$(dir $@)/make-install.log
date > $@
$(OBJDIR)/%/build/riscv-gnu-gdb-only/build-gdb-newlib/stamp: \
$(OBJDIR)/%/build/riscv-gnu-gdb-only/build-binutils-newlib/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-gdb-only/build-gdb-newlib/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-gdb-only/build-gdb-newlib/stamp,%/install/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-gdb-only/build-gdb-newlib/stamp,%/build/riscv-gnu-gdb-only,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
# CC_FOR_TARGET is required for the ld testsuite.
cd $(dir $@) && CC_FOR_TARGET=$(NEWLIB_CC_FOR_TARGET) $(abspath $($@_BUILD))/riscv-gdb/configure \
--target=$(NEWLIB_TUPLE) \
$($($@_TARGET)-rgt-host) \
--prefix=$(abspath $($@_INSTALL)) \
--with-pkgversion="SiFive GDB $(RGDB_VERSION)" \
--with-bugurl="https://github.com/sifive/freedom-tools/issues" \
--disable-werror \
$(GDB_TARGET_FLAGS) \
--with-python=no \
--enable-gdb \
--disable-gas \
--disable-binutils \
--disable-ld \
--disable-gold \
--disable-gprof \
CFLAGS="-O2" \
CXXFLAGS="-O2" &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install -j1 install-pdf install-html &>$(dir $@)/make-install.log
date > $@
$(OBJDIR)/%/build/riscv-gnu-gdb-only/build-gdb-py-newlib/stamp: \
$(OBJDIR)/%/build/riscv-gnu-gdb-only/build-gdb-newlib/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-gnu-gdb-only/build-gdb-py-newlib/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-gnu-gdb-only/build-gdb-py-newlib/stamp,%/install/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$($@_TARGET),$@))
$(eval $@_BUILD := $(patsubst %/build/riscv-gnu-gdb-only/build-gdb-py-newlib/stamp,%/build/riscv-gnu-gdb-only,$@))
rm -rf $(dir $@)
mkdir -p $(dir $@)
# CC_FOR_TARGET is required for the ld testsuite.
cd $(dir $@) && CC_FOR_TARGET=$(NEWLIB_CC_FOR_TARGET) $(abspath $($@_BUILD))/riscv-gdb/configure \
--target=$(NEWLIB_TUPLE) \
$($($@_TARGET)-rgt-host) \
--prefix=$(abspath $($@_INSTALL)) \
--with-pkgversion="SiFive GDB $(RGDB_VERSION)" \
--with-bugurl="https://github.com/sifive/freedom-tools/issues" \
--disable-werror \
$(GDB_TARGET_FLAGS) \
$($($@_TARGET)-rgdb-configure) \
--program-prefix="$(NEWLIB_TUPLE)-" \
--program-suffix="-py" \
--enable-gdb \
--disable-gas \
--disable-binutils \
--disable-ld \
--disable-gold \
--disable-gprof \
CFLAGS="-O2" \
CXXFLAGS="-O2" &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install -j1 install-pdf install-html &>$(dir $@)/make-install.log
date > $@
# OpenOCD requires a GDB that's been build with expat support so it can read
# the target XML files.
$(OBJDIR)/%/stamps/expat-gdb/install.stamp: \
$(OBJDIR)/%/build/expat-gdb/configure
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/stamps/expat-gdb/install.stamp,%,$@))
$(eval $@_BUILD := $(patsubst %/stamps/expat-gdb/install.stamp,%/build/expat-gdb,$@))
$(eval $@_INSTALL := $(patsubst %/stamps/expat-gdb/install.stamp,%/install/riscv64-unknown-elf-gdb-$(RGDB_VERSION)-$($@_TARGET),$@))
mkdir -p $($@_BUILD)
cd $($@_BUILD); ./configure --prefix=$(abspath $($@_INSTALL)) $($($@_TARGET)-expat-configure) &>make-configure.log
$(MAKE) -C $($@_BUILD) buildlib &>$($@_BUILD)/make-buildlib.log
$(MAKE) -C $($@_BUILD) installlib &>$($@_BUILD)/make-installlib.log
mkdir -p $(dir $@)
date > $@
$(OBJDIR)/%/build/expat-gdb/configure:
rm -rf $(dir $@)
mkdir -p $(dir $@)
cp -a $(SRC_EXPAT)/* $(dir $@)
cd $(dir $@); ./buildconf.sh &>make-buildconf.log
touch -c $@
# The OpenOCD builds go here
$(BINDIR)/riscv-openocd-$(ROCD_VERSION)-%.zip: \
$(OBJDIR)/%/stamps/riscv-openocd/install.stamp \
$(OBJDIR)/%/stamps/riscv-openocd/libs.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-%.zip,%,$@))
mkdir -p $(dir $@)
cd $(OBJDIR)/$($@_TARGET)/install; zip -rq $(abspath $@) riscv-openocd-$(ROCD_VERSION)-$($@_TARGET)
$(BINDIR)/riscv-openocd-$(ROCD_VERSION)-%.src.zip: \
$(OBJDIR)/%/stamps/riscv-openocd/install.stamp \
$(OBJDIR)/%/stamps/riscv-openocd/libs.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-%.src.zip,%,$@))
mkdir -p $(dir $@)
cd $(OBJDIR)/$($@_TARGET)/build; zip -rq $(abspath $@) riscv-openocd
$(BINDIR)/riscv-openocd-$(ROCD_VERSION)-%.tar.gz: \
$(OBJDIR)/%/stamps/riscv-openocd/install.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-%.tar.gz,%,$@))
mkdir -p $(dir $@)
$(TAR) --dereference --hard-dereference -C $(OBJDIR)/$($@_TARGET)/install -c riscv-openocd-$(ROCD_VERSION)-$($@_TARGET) | gzip > $(abspath $@)
$(BINDIR)/riscv-openocd-$(ROCD_VERSION)-%.src.tar.gz: \
$(OBJDIR)/%/stamps/riscv-openocd/install.stamp
$(eval $@_TARGET := $(patsubst $(BINDIR)/riscv-openocd-$(ROCD_VERSION)-%.src.tar.gz,%,$@))
mkdir -p $(dir $@)
$(TAR) --dereference --hard-dereference -C $(OBJDIR)/$($@_TARGET)/build -c riscv-openocd | gzip > $(abspath $@)
$(OBJDIR)/%/stamps/riscv-openocd/install.stamp: \
$(OBJDIR)/%/build/riscv-openocd/riscv-openocd/stamp
mkdir -p $(dir $@)
date > $@
# We might need some extra target libraries for OpenOCD
$(OBJDIR)/%/stamps/riscv-openocd/libs.stamp: \
$(OBJDIR)/%/stamps/riscv-openocd/install.stamp
date > $@
$(OBJ_WIN64)/stamps/riscv-openocd/libs.stamp: \
$(OBJ_WIN64)/stamps/riscv-openocd/install.stamp
$(WIN64)-gcc -print-search-dirs | grep ^libraries | cut -d= -f2- | xargs -I {} -d: find {} -iname "libgcc_*.dll" | xargs cp -t $(OBJDIR)/$(WIN64)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN64)/bin
date > $@
$(OBJ_WIN32)/stamps/riscv-openocd/libs.stamp: \
$(OBJ_WIN32)/stamps/riscv-openocd/install.stamp
$(WIN32)-gcc -print-search-dirs | grep ^libraries | cut -d= -f2- | xargs -I {} -d: find {} -iname "libgcc_*.dll" | xargs cp -t $(OBJDIR)/$(WIN32)/install/riscv-openocd-$(ROCD_VERSION)-$(WIN32)/bin
date > $@
$(OBJDIR)/%/build/riscv-openocd/stamp:
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-openocd/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-openocd/stamp,%/install/riscv-openocd-$(ROCD_VERSION)-$($@_TARGET),$@))
rm -rf $($@_INSTALL)
mkdir -p $($@_INSTALL)
rm -rf $(dir $@)
mkdir -p $(dir $@)
cd $(dir $@); curl -L -f -s -o libusb-1.0.22.tar.bz2 https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.tar.bz2
cd $(dir $@); $(TAR) -xf libusb-1.0.22.tar.bz2
cd $(dir $@); mv libusb-1.0.22 libusb
cd $(dir $@); curl -L -f -s -o libusb-compat-0.1.7.tar.bz2 https://github.com/libusb/libusb-compat-0.1/releases/download/v0.1.7/libusb-compat-0.1.7.tar.bz2
cd $(dir $@); $(TAR) -xf libusb-compat-0.1.7.tar.bz2
cd $(dir $@); mv libusb-compat-0.1.7 libusb-compat
cd $(dir $@); curl -L -f -s -o libftdi1-1.4.tar.bz2 https://www.intra2net.com/en/developer/libftdi/download/libftdi1-1.4.tar.bz2
cd $(dir $@); $(TAR) -xf libftdi1-1.4.tar.bz2
cd $(dir $@); mv libftdi1-1.4 libftdi
cp -a $(SRC_ROCD) $(dir $@)
$(SED) -i -f $(SCRIPTSDIR)/openocd.sed -e "s/SIFIVE_PACKAGE_VERSION/SiFive OpenOCD $(ROCD_VERSION)/" $(dir $@)/riscv-openocd/src/openocd.c
$(SED) -E -i -f $(SCRIPTSDIR)/openocd-rtos.sed $(dir $@)/riscv-openocd/src/rtos/rtos.c
date > $@
$(OBJDIR)/%/build/riscv-openocd/libusb/stamp: \
$(OBJDIR)/%/build/riscv-openocd/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-openocd/libusb/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-openocd/libusb/stamp,%/install/riscv-openocd-$(ROCD_VERSION)-$($@_TARGET),$@))
cd $(dir $@) && $($($@_TARGET)-odeps-vars) ./configure \
$($($@_TARGET)-rocd-host) \
--prefix=$(abspath $($@_INSTALL)) \
--disable-udev \
--enable-static \
$($($@_TARGET)-ousb-configure) &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install &>$(dir $@)/make-install.log
date > $@
$(OBJDIR)/%/build/riscv-openocd/libusb-compat/stamp: \
$(OBJDIR)/%/build/riscv-openocd/libusb/stamp \
$(OBJDIR)/%/build/riscv-openocd/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-openocd/libusb-compat/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-openocd/libusb-compat/stamp,%/install/riscv-openocd-$(ROCD_VERSION)-$($@_TARGET),$@))
cd $(dir $@) && $($($@_TARGET)-odeps-vars) ./configure \
$($($@_TARGET)-rocd-host) \
--prefix=$(abspath $($@_INSTALL)) \
--enable-static \
$($($@_TARGET)-ousb-configure) &>make-configure.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install &>$(dir $@)/make-install.log
date > $@
$(OBJDIR)/%/build/riscv-openocd/libftdi/stamp: \
$(OBJDIR)/%/build/riscv-openocd/libusb-compat/stamp \
$(OBJDIR)/%/build/riscv-openocd/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-openocd/libftdi/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-openocd/libftdi/stamp,%/install/riscv-openocd-$(ROCD_VERSION)-$($@_TARGET),$@))
cd $(dir $@) && $($($@_TARGET)-odeps-vars) cmake \
-DCMAKE_INSTALL_PREFIX:PATH=$(abspath $($@_INSTALL)) \
$($($@_TARGET)-oftdi-configure) . &>make-cmake.log
$(MAKE) -C $(dir $@) &>$(dir $@)/make-build.log
$(MAKE) -C $(dir $@) install &>$(dir $@)/make-install.log
date > $@
$(OBJDIR)/%/build/riscv-openocd/riscv-openocd/stamp: \
$(OBJDIR)/%/build/riscv-openocd/libftdi/stamp \
$(OBJDIR)/%/build/riscv-openocd/stamp
$(eval $@_TARGET := $(patsubst $(OBJDIR)/%/build/riscv-openocd/riscv-openocd/stamp,%,$@))
$(eval $@_INSTALL := $(patsubst %/build/riscv-openocd/riscv-openocd/stamp,%/install/riscv-openocd-$(ROCD_VERSION)-$($@_TARGET),$@))
rm -f $(abspath $($@_INSTALL))/lib/lib*.dylib*
rm -f $(abspath $($@_INSTALL))/lib/lib*.so*
rm -f $(abspath $($@_INSTALL))/lib64/lib*.so*
find $(dir $@) -iname configure.ac | $(SED) s/configure.ac/m4/ | xargs mkdir -p
cd $(dir $@); ./bootstrap nosubmodule &>make-bootstrap.log
cd $(dir $@); $($($@_TARGET)-rocd-vars) ./configure \
$($($@_TARGET)-rocd-host) \
--prefix=$(abspath $($@_INSTALL)) \
--disable-remote-bitbang \