-
Notifications
You must be signed in to change notification settings - Fork 48
/
release.mk
1348 lines (1068 loc) · 44.2 KB
/
release.mk
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
##############################################################################
# Copyright (C) 2014-2017 Synopsys Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
#
# Toolchain "release" makefile that does all of the steps required to make a
# GitHub release of toolchain.
#
# Please refer to doc/release.rst for documentation on how to use this
# makefile.
#
#
# Configuration
#
CONFIG_STATIC_TOOLCHAIN := n
# Whether to build big endian toolchain
ENABLE_BIG_ENDIAN := y
# Whether to create a separate documentation package
ENABLE_DOCS_PACKAGE := n
# Whether to build and upload IDE
ENABLE_IDE := y
# Whether to build and upload IDE on macOS
ENABLE_IDE_MACOS := y
# Whether to build or download GNU IDE Plugins
ENABLE_IDE_PLUGINS_BUILD := y
# Whether to build Linux images
ENABLE_LINUX_IMAGES := n
# Whether to build Toolchain for elf32 targets.
ENABLE_ELF_TOOLS := y
# Whether to build Toolchain for Linux targets.
ENABLE_UCLIBC_TOOLS := y
# Whether to build native toolchain for ARC HS Linux.
ENABLE_NATIVE_TOOLS := y
# Whether to build toolchain for Linux/glibc targets.
ENABLE_GLIBC_TOOLS := y
# Whether to build toolchain for arc64 targets.
ENABLE_ARC64_TOOLS := y
# Whether to build and upload OpenOCD for Linux.
ENABLE_OPENOCD := y
# Whether to install tcftool for targets.
ENABLE_TCF_TOOLS := y
# Whether to build and upload OpenOCD for Windows/macOS.
# Requires ENABLE_OPENOCD to be set to 'y'.
ENABLE_OPENOCD_WIN := y
ENABLE_OPENOCD_MAC := y
# Whether to build Toolchain PDF documentation. This affects only the
# "toolchain" repository - PDF documents from gcc, binutils, etc are always
# created, regardless of this option.
ENABLE_PDF_DOCS := n
# Whether to create a source tarball.
ENABLE_SOURCE_TARBALL := n
# Whether to build and upload windows installer.
# Requires ENABLE_OPENOCD_WIN to be set to 'y'.
ENABLE_WINDOWS_INSTALLER := y
# The user who owns the repository
GITHUB_OWNER := foss-for-synopsys-dwc-arc-processors
# URL base for git repositories.
GIT_URL_BASE := https://github.com/$(GITHUB_OWNER)
# Whether there is a directory that contains already cloned git repositories
# that can be used as a git reference. If specified than it *must* contain
# copies of all repositories that will be used.
GIT_REFERENCE_ROOT :=
# This path to prebuilt IDE plugins should be set only if
# ENABLE_IDE_PLUGINS_BUILD is 'n'.
IDE_PLUGIN_LOCATION :=
# libusb is used by the OpenOCD for
LIBUSB_VERSION := 1.0.23
ROOT := $(realpath ..)
THIRD_PARTY_SOFTWARE_LOCATION :=
# Triplet of Mingw toolchain.
WINDOWS_TRIPLET := i686-w64-mingw32
# Triplet of osxcross toolchain
MACOS_TRIPLET := x86_64-apple-darwin14
# Must be a folder available to Windows host, e.g. Linux folder shared via
# Samba.
WINDOWS_WORKSPACE := $(ROOT)/windows_workspace
# Include overriding configuration
-include release.config
#
# Check prerequisite variables
#
ifeq ($(RELEASE_TAG),)
$(error RELEASE_TAG variable can not be empty)
endif
ifneq ($(filter upload, $(MAKECMDGOALS)),)
ifeq ($(RELEASE_NAME),)
$(error RELEASE_NAME variable can not be empty for "upload" target)
endif
endif
#
# Internal variables
#
# Identify host system (used in release tarball names).
ifeq ($(shell uname -s),Linux)
HOST := linux
else
ifeq ($(shell uname -s),Darwin)
HOST := macos
else
$(error Unknown OS: $(shell uname -s). Only Linux and macOS (Darwin) are supported.)
endif
endif
CP := rsync -a
GIT := git
PYTHON := python3
SSH := ssh
TAR := tar
WGET := wget
INSTALL := install
# Always have `-nv`.
override WGETFLAGS += -nv
CHECKSUM := sha256sum -b
ifneq ($(HOST),macos)
LOCAL_CP := cp -al
else
# macOS' `cp` doesn't support hardlinks and `-l`.
LOCAL_CP := cp -a
endif
# RELEASE_TAG is a literal Git tag, like arc-2016.09-rc1.
# RELEASE in this case would be 2016.09-rc1. However remove -release suffix
# that is used for final release tags.
# RELEASE_DIR in this case would be arc-2016.09-rc1. However remove -release
# suffix that is used for final release tags.
# RELEASE_BRANCH in this case would be 2016.09.
RELEASE := $(patsubst %-release,%,$(shell echo $(RELEASE_TAG) | cut -s -d- -f2-))
RELEASE_DIR:= $(patsubst %-release,%,$(RELEASE_TAG))
RELEASE_BRANCH := $(shell echo $(RELEASE_TAG) | cut -s -d- -f2)
ifeq ($(RELEASE_BRANCH),)
$(error RELEASE_TAG variable must be in format xxx-YYYY.MM)
endif
#
# Helpers
#
# Ensure that group has write access.
define create_dir
mkdir -m775 -p $@
endef
# Create tarball for release
#
# :param $1 - name of directory to tar. Directory must be in the $O.
define create_tar
$(TAR) czf $O/$1$(TAR_EXT) -C $O \
--owner=0 --group=0 --numeric-owner $1/
endef
# Create windows tarball for release. Difference with standard `create_tar` is
# that hard links are dereferenced, because they are notsupported in 7-zip -
# hard links are turned into 0-byte files.
#
# :param $1 - name of directory to tar. Directory must
# be in the $O.
define create_windows_tar
$(TAR) czf $O/$1$(TAR_EXT) -C $O \
--owner=0 --group=0 --numeric-owner --hard-dereference $1/
endef
# :param $1 - name of directory to zip.
define create_zip
cd $O && zip -q -r $1.zip $1/
endef
# Clone git repository
# $1 - Git URL
# $2 - directory name
ifeq ($(GIT_REFERENCE_ROOT),)
define git_clone_url
$(GIT) clone -q $(1) -b $(2) $(ROOT)/$(3)
endef
else
define git_clone_url
$(GIT) clone -q -b $(2) --reference=$(GIT_REFERENCE_ROOT)/$(3) \
$(1) $(ROOT)/$(3)
endef
endif
# Clone git repository
# $1 - tool name
# $2 - git branch or tag
# $3 - directory name
define git_clone
$(call git_clone_url,$(GIT_URL_BASE)/$(1).git,$(2),$(3))
endef
# Copy prebuilt toolchain into workspace
# $1 - name of source directory in directory with prebuilt toolchains
# $2 - name of destination directory to save
define copy_prebuilt
$(CP) --chmod=u+w --ignore-existing $(PREBUILT_TOOLCHAINS_DIR)/$1/ $O/$2/
chmod u+w $O/$2
endef
#
# Build flags common to all toolchains
#
BUILDALLFLAGS := --disable-werror --strip --no-auto-pull \
--no-auto-checkout --elf32-strip-target-libs
# Disable Python and ISL, because those libraries are not shipped with the
# toolchain, and without explicit 'no' ./configure might grab system version of
# library as a dependency and it will not work for the user, who will have a
# different version of library on their system.
EXTRA_CONFIG_FLAGS += --with-python=no --with-isl=no
ifeq ($(CONFIG_STATIC_TOOLCHAIN),y)
EXTRA_CONFIG_FLAGS += LDFLAGS=-static
endif
BUILDALLFLAGS += --config-extra '$(EXTRA_CONFIG_FLAGS)'
#
# Output artifacts
#
O := $(ROOT)/release_output
# Use -a when invoking tar, then we can easily change to .tar.xz if we want.
TAR_EXT := .tar.gz
# Intermediate location for build directories. Toolchain will have it's own
# bd-{elf32,uclibc}, so this is only for OpenOCD ATM.
BUILD_DIR = $(ROOT)/build
# Toolchain: source tarball
# This variable should use .. instead of $(ROOT) so that tar will auto-remove
# .. from file paths. Perhaps this ugliness can be fixed with --transform?
TOOLS_SOURCE_CONTENTS := $(addprefix ../,binutils gcc gdb glibc newlib toolchain uclibc-ng openocd)
TOOLS_SOURCE_DIR := arc_gnu_$(RELEASE)_sources
# Toolchain: baremetal for Linux hosts
TOOLS_ELFLE_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_elf32_le_$(HOST)_install
TOOLS_ELFBE_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_elf32_be_$(HOST)_install
# Toolchain: baremetal for Windows hosts
TOOLS_ELFLE_WIN_DIR := arc_gnu_$(RELEASE)_prebuilt_elf32_le_win_install
TOOLS_ELFBE_WIN_DIR := arc_gnu_$(RELEASE)_prebuilt_elf32_be_win_install
# Toolchain: linux
TOOLS_UCLIBC_LE_700_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_uclibc_le_arc700_$(HOST)_install
TOOLS_UCLIBC_BE_700_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_uclibc_be_arc700_$(HOST)_install
TOOLS_UCLIBC_LE_HS_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_uclibc_le_archs_$(HOST)_install
TOOLS_UCLIBC_BE_HS_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_uclibc_be_archs_$(HOST)_install
TOOLS_UCLIBC_LE_HS38FPU_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_uclibc_le_hs38fpu_$(HOST)_install
# Toolchain: macOS
TOOLS_ELFLE_MAC_DIR := arc_gnu_$(RELEASE)_prebuilt_elf32_le_macos_install
TOOLS_ELFBE_MAC_DIR := arc_gnu_$(RELEASE)_prebuilt_elf32_be_macos_install
# Toolchain: linux with glibc.
TOOLS_GLIBC_LE_HS_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_glibc_le_archs_$(HOST)_install
TOOLS_GLIBC_BE_HS_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_glibc_be_archs_$(HOST)_install
# Toolchain: native linux toolchain
TOOLS_GLIBC_LE_HS_NATIVE_DIR := arc_gnu_$(RELEASE)_prebuilt_glibc_le_archs_native_install
TOOLS_GLIBC_ARC64_NATIVE_DIR := arc_gnu_$(RELEASE)_prebuilt_arc64_glibc_native_install
TOOLS_UCLIBC_ARC32_NATIVE_DIR := arc_gnu_$(RELEASE)_prebuilt_arc32_uclibc_native_install
# Toolchain: arc64
TOOLS_ELF_ARC64_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_arc64_elf_$(HOST)_install
TOOLS_LINUX_ARC64_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_arc64_glibc_$(HOST)_install
TOOLS_UCLIBC_ARC32_HOST_DIR := arc_gnu_$(RELEASE)_prebuilt_arc32_uclibc_$(HOST)_install
# Toolchain PDF User Guide.
PDF_DOC_FILE := $(abspath $(ROOT)/toolchain/doc/_build/pdf/GNU_Toolchain_for_ARC.pdf)
# IDE: vanilla Eclipse variables
ECLIPSE_VERSION := 2020-03-R-incubation
ECLIPSE_VANILLA_WIN_ZIP := eclipse-cpp-$(ECLIPSE_VERSION)-win32-x86_64.zip
ECLIPSE_VANILLA_LINUX_TGZ := eclipse-cpp-$(ECLIPSE_VERSION)-linux-gtk-x86_64.tar.gz
ECLIPSE_VANILLA_MACOS_TGZ := eclipse-cpp-$(ECLIPSE_VERSION)-macosx-cocoa-x86_64.tar.gz
# Coma separated list
ECLIPSE_DL_LINK_BASE := http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2020-03/R
# Java. Note that filenames might differ from originals to ensure consistent
# JAVA_VERSION content.
JAVA_VERSION := 11.0.1_13
JRE_LINUX_TGZ := OpenJDK11-jre_x64_linux_openj9_$(JAVA_VERSION).tar.gz
JRE_WIN_ZIP := OpenJDK11-jre_x64_windows_openj9_$(JAVA_VERSION).zip
# IDE: output related variables
IDE_VERSION := master
IDE_LINUX_INSTALL := arc_gnu_$(RELEASE)_ide_$(HOST)_install
IDE_MACOS_INSTALL := arc_gnu_$(RELEASE)_ide_macos_install
IDE_WIN_EXE := arc_gnu_$(RELEASE)_ide_win_install.exe
IDE_LINUX_TGZ := $(IDE_LINUX_INSTALL).tar.gz
IDE_MACOS_TGZ := $(IDE_MACOS_INSTALL).tar.gz
IDE_PLUGINS_ZIP := arc_gnu_$(RELEASE)_ide_plugins.zip
# Linux
LINUX_IMAGES_DIR = linux_images
LINUX_AXS103_UIMAGE = uImage_axs103
LINUX_AXS103_ROOTFS_CPIO = rootfs_axs103.cpio
LINUX_AXS103_ROOTFS_TAR = rootfs_axs103.tgz
# OpenOCD
OOCD_VERSION := arc-2021.09
OOCD_HOST_DIR := arc_gnu_$(RELEASE)_openocd_$(HOST)_install
OOCD_WIN_DIR := arc_gnu_$(RELEASE)_openocd_win_install
OOCD_MAC_DIR := arc_gnu_$(RELEASE)_openocd_mac_install
OOCD_SRC_DIR := $(ROOT)/openocd
OOCD_BUILD_HOST_DIR := $(BUILD_DIR)/openocd_$(HOST)
OOCD_BUILD_WIN_DIR := $(BUILD_DIR)/openocd_win
OOCD_BUILD_MAC_DIR := $(BUILD_DIR)/openocd_mac
# Documentation package
DOCS_DIR := arc_gnu_$(RELEASE)_docs
# Extras
EXTRAS_DIR := $(abspath $(ROOT)/toolchain/extras)
# List of files that will be uploaded to GitHub Release.
UPLOAD_ARTIFACTS = $(UPLOAD_ARTIFACTS-y)
UPLOAD_ARTIFACTS-$(ENABLE_ELF_TOOLS) += $(TOOLS_ELFLE_HOST_DIR)$(TAR_EXT)
ifeq ($(ENABLE_ELF_TOOLS),y)
UPLOAD_ARTIFACTS-$(ENABLE_BIG_ENDIAN) += $(TOOLS_ELFBE_HOST_DIR)$(TAR_EXT)
endif
UPLOAD_ARTIFACTS-$(ENABLE_SOURCE_TARBALL) += $(TOOLS_SOURCE_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_UCLIBC_TOOLS) += $(TOOLS_UCLIBC_LE_700_HOST_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_UCLIBC_TOOLS) += $(TOOLS_UCLIBC_LE_HS_HOST_DIR)$(TAR_EXT)
ifeq ($(ENABLE_UCLIBC_TOOLS),y)
UPLOAD_ARTIFACTS-$(ENABLE_BIG_ENDIAN) += $(TOOLS_UCLIBC_BE_700_HOST_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_BIG_ENDIAN) += $(TOOLS_UCLIBC_BE_HS_HOST_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_ARC64_TOOLS) += $(TOOLS_UCLIBC_ARC32_HOST_DIR)$(TAR_EXT)
endif
UPLOAD_ARTIFACTS-$(ENABLE_GLIBC_TOOLS) += $(TOOLS_GLIBC_LE_HS_HOST_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_GLIBC_TOOLS) += $(TOOLS_GLIBC_BE_HS_HOST_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_ARC64_TOOLS) += $(TOOLS_ELF_ARC64_HOST_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_ARC64_TOOLS) += $(TOOLS_LINUX_ARC64_HOST_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_DOCS_PACKAGE) += $(DOCS_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_IDE) += $(IDE_LINUX_TGZ)
UPLOAD_ARTIFACTS-$(ENABLE_IDE) += $(IDE_PLUGINS_ZIP)
UPLOAD_ARTIFACTS-$(ENABLE_NATIVE_TOOLS) += $(TOOLS_GLIBC_LE_HS_NATIVE_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_NATIVE_TOOLS) += $(TOOLS_GLIBC_ARC64_NATIVE_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_NATIVE_TOOLS) += $(TOOLS_UCLIBC_ARC32_NATIVE_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_WINDOWS_INSTALLER) += $(IDE_WIN_EXE)
UPLOAD_ARTIFACTS-$(ENABLE_IDE_MACOS) += $(IDE_MACOS_TGZ)
UPLOAD_ARTIFACTS-$(ENABLE_IDE_MACOS) += $(TOOLS_ELFLE_MAC_DIR)$(TAR_EXT)
UPLOAD_ARTIFACTS-$(ENABLE_IDE_MACOS) += $(TOOLS_ELFBE_MAC_DIR)$(TAR_EXT)
# List of files that will be deployed internally. Is a superset of "upload"
# artifacts.
DEPLOY_ARTIFACTS = $(UPLOAD_ARTIFACTS) $(DEPLOY_ARTIFACTS-y)
DEPLOY_ARTIFACTS-$(ENABLE_OPENOCD) += $(OOCD_HOST_DIR)$(TAR_EXT)
DEPLOY_ARTIFACTS-$(ENABLE_OPENOCD_MAC) += $(OOCD_MAC_DIR)$(TAR_EXT)
DEPLOY_ARTIFACTS-$(ENABLE_OPENOCD_WIN) += $(OOCD_WIN_DIR)$(TAR_EXT)
DEPLOY_ARTIFACTS-$(ENABLE_OPENOCD_WIN) += $(OOCD_WIN_DIR).zip
DEPLOY_ARTIFACTS-$(ENABLE_WINDOWS_INSTALLER) += $(TOOLS_ELFLE_WIN_DIR)$(TAR_EXT)
DEPLOY_ARTIFACTS-$(ENABLE_WINDOWS_INSTALLER) += $(TOOLS_ELFBE_WIN_DIR)$(TAR_EXT)
# Include the directory here, because it is passed to rsync, and if that would
# be individual file name, then files would end up in deploy destination
# directly, instead of the linux images dir.
DEPLOY_ARTIFACTS-$(ENABLE_LINUX_IMAGES) += $(LINUX_IMAGES_DIR)
# Artifacts for unpacked builds
DEPLOY_BUILD_ARTIFACTS = $(DEPLOY_BUILD_ARTIFACTS-y)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_ELF_TOOLS) += $(TOOLS_ELFLE_HOST_DIR)
ifeq ($(ENABLE_ELF_TOOLS),y)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_BIG_ENDIAN) += $(TOOLS_ELFBE_HOST_DIR)
endif
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_UCLIBC_TOOLS) += $(TOOLS_UCLIBC_LE_700_HOST_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_UCLIBC_TOOLS) += $(TOOLS_UCLIBC_LE_HS_HOST_DIR)
ifeq ($(ENABLE_UCLIBC_TOOLS),y)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_BIG_ENDIAN) += $(TOOLS_UCLIBC_BE_700_HOST_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_BIG_ENDIAN) += $(TOOLS_UCLIBC_BE_HS_HOST_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_ARC64_TOOLS) += $(TOOLS_UCLIBC_ARC32_HOST_DIR)
endif
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_GLIBC_TOOLS) += $(TOOLS_GLIBC_LE_HS_HOST_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_GLIBC_TOOLS) += $(TOOLS_GLIBC_BE_HS_HOST_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_IDE) += $(IDE_LINUX_INSTALL)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_NATIVE_TOOLS) += $(TOOLS_GLIBC_LE_HS_NATIVE_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_NATIVE_TOOLS) += $(TOOLS_GLIBC_ARC64_NATIVE_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_NATIVE_TOOLS) += $(TOOLS_UCLIBC_ARC32_NATIVE_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_OPENOCD) += $(OOCD_HOST_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_OPENOCD_WIN) += $(OOCD_WIN_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_WINDOWS_INSTALLER) += $(TOOLS_ELFLE_WIN_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_WINDOWS_INSTALLER) += $(TOOLS_ELFBE_WIN_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_IDE_MACOS) += $(TOOLS_ELFLE_MAC_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_IDE_MACOS) += $(TOOLS_ELFBE_MAC_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_ARC64_TOOLS) += $(TOOLS_ELF_ARC64_HOST_DIR)
DEPLOY_BUILD_ARTIFACTS-$(ENABLE_ARC64_TOOLS) += $(TOOLS_LINUX_ARC64_HOST_DIR)
# Linux images are not in this list, because directory names in this list are
# processed, but linux_images doesn't conform to the convention expected by the
# processing.
CHECKSUM_FILE := checksum.txt
#
# Human friendly aliases
#
.PHONY: source-tarball elf-le-build elf-be-build elf-le elf-be \
windows ide openocd-win \
openocd-linux
BUILD_DEPS = $(BUILD_DEPS-y)
BUILD_DEPS-$(ENABLE_ELF_TOOLS) += $O/.stamp_elf_le_tarball
ifeq ($(ENABLE_ELF_TOOLS),y)
BUILD_DEPS-$(ENABLE_ELF_TOOLS) += $O/.stamp_elf_be_tarball
endif
BUILD_DEPS-$(ENABLE_SOURCE_TARBALL) += $O/.stamp_source_tarball
BUILD_DEPS-$(ENABLE_UCLIBC_TOOLS) += $O/.stamp_uclibc_le_700_tarball
BUILD_DEPS-$(ENABLE_UCLIBC_TOOLS) += $O/.stamp_uclibc_le_hs_tarball
ifeq ($(ENABLE_UCLIBC_TOOLS),y)
BUILD_DEPS-$(ENABLE_BIG_ENDIAN) += $O/.stamp_uclibc_be_700_tarball
BUILD_DEPS-$(ENABLE_BIG_ENDIAN) += $O/.stamp_uclibc_be_hs_tarball
endif
BUILD_DEPS-$(ENABLE_GLIBC_TOOLS) += $O/.stamp_glibc_le_hs_tarball
BUILD_DEPS-$(ENABLE_GLIBC_TOOLS) += $O/.stamp_glibc_be_hs_tarball
BUILD_DEPS-$(ENABLE_ARC64_TOOLS) += $O/.stamp_arc64_elf_tarball
BUILD_DEPS-$(ENABLE_ARC64_TOOLS) += $O/.stamp_arc64_linux_tarball
BUILD_DEPS-$(ENABLE_ARC64_TOOLS) += $O/.stamp_uclibc_arc32_tarball
BUILD_DEPS-$(ENABLE_DOCS_PACKAGE) += $O/$(DOCS_DIR)$(TAR_EXT)
BUILD_DEPS-$(ENABLE_IDE) += $O/.stamp_ide_linux_tar
BUILD_DEPS-$(ENABLE_IDE_MACOS) += $O/.stamp_ide_macos_tar
BUILD_DEPS-$(ENABLE_IDE_MACOS) += $O/.stamp_elf_le_mac_tarball
BUILD_DEPS-$(ENABLE_IDE_MACOS) += $O/.stamp_elf_be_mac_tarball
BUILD_DEPS-$(ENABLE_IDE_PLUGINS_BUILD) += $O/$(IDE_PLUGINS_ZIP)
BUILD_DEPS-$(ENABLE_NATIVE_TOOLS) += $O/.stamp_glibc_le_hs_native_tarball
BUILD_DEPS-$(ENABLE_NATIVE_TOOLS) += $O/.stamp_glibc_arc64_native_tarball
BUILD_DEPS-$(ENABLE_NATIVE_TOOLS) += $O/.stamp_uclibc_arc32_native_tarball
BUILD_DEPS-$(ENABLE_OPENOCD) += $O/$(OOCD_HOST_DIR)$(TAR_EXT)
BUILD_DEPS-$(ENABLE_OPENOCD_MAC) += $O/$(OOCD_MAC_DIR)$(TAR_EXT)
BUILD_DEPS-$(ENABLE_OPENOCD_WIN) += $O/$(OOCD_WIN_DIR)$(TAR_EXT)
BUILD_DEPS-$(ENABLE_OPENOCD_WIN) += $O/$(OOCD_WIN_DIR).zip
BUILD_DEPS-$(ENABLE_WINDOWS_INSTALLER) += $O/.stamp_elf_le_windows_tarball
BUILD_DEPS-$(ENABLE_WINDOWS_INSTALLER) += $O/.stamp_elf_be_windows_tarball
BUILD_DEPS-$(ENABLE_WINDOWS_INSTALLER) += $O/$(IDE_WIN_EXE)
BUILD_DEPS-$(ENABLE_LINUX_IMAGES) += $O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_UIMAGE)
BUILD_DEPS-$(ENABLE_LINUX_IMAGES) += $O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_ROOTFS_CPIO)
BUILD_DEPS-$(ENABLE_LINUX_IMAGES) += $O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_ROOTFS_TAR)
# Build all components that can be built on Linux hosts.
.PHONY: build
build: $(BUILD_DEPS)
ifeq ($(ENABLE_WINDOWS_INSTALLER),y)
$O/$(CHECKSUM_FILE): $O/$(IDE_WIN_EXE)
endif
$O/$(CHECKSUM_FILE): $(BUILD_DEPS)
cd $O && $(CHECKSUM) $(UPLOAD_ARTIFACTS) > $@
.PHONY: checksum
checksum: $O/$(CHECKSUM_FILE)
source-tarball: $O/.stamp_source_tarball
elf-le-build: $O/.stamp_elf_le_built
elf-be-build: $O/.stamp_elf_be_built
elf-le: $O/.stamp_elf_le_tarball
elf-be: $O/.stamp_elf_be_tarball
.PHONY: glibc-le
glibc-le: $O/.stamp_glibc_le_hs_tarball
.PHONY: glibc-be
glibc-be: $O/.stamp_glibc_be_hs_tarball
windows: $O/.stamp_elf_le_windows_tarball $O/.stamp_elf_be_windows_tarball
ide: $O/.stamp_ide_linux_tar $O/$(IDE_PLUGINS_ZIP)
#
# Initial preparations
#
.PHONY: clone
clone:
$(call git_clone,arc_gnu_eclipse,$(IDE_VERSION),arc_gnu_eclipse)
ifeq ($(ENABLE_OPENOCD),y)
$(call git_clone,openocd,$(OOCD_VERSION),openocd)
endif
.PHONY: copy-external
copy-external: | $O
ifeq ($(ENABLE_IDE),y)
ifeq ($(THIRD_PARTY_SOFTWARE_LOCATION),)
$(error THIRD_PARTY_SOFTWARE_LOCATION must be set to do copy-external)
endif
ifneq ($(ENABLE_IDE_PLUGINS_BUILD),y)
ifeq ($(IDE_PLUGIN_LOCATION),)
$(error IDE_PLUGIN_LOCATION must be set to do copy-external)
endif
# Copy IDE Plugin
$(CP) $(IDE_PLUGIN_LOCATION)/$(IDE_PLUGINS_ZIP) $O
endif
# Copy JRE.
$(CP) $(THIRD_PARTY_SOFTWARE_LOCATION)/$(JRE_LINUX_TGZ) $O/$(JRE_LINUX_TGZ)
ifeq ($(ENABLE_WINDOWS_INSTALLER),y)
$(CP) $(THIRD_PARTY_SOFTWARE_LOCATION)/$(JRE_WIN_ZIP) $O/$(JRE_WIN_ZIP)
endif
# Copy Eclipse
$(CP) $(THIRD_PARTY_SOFTWARE_LOCATION)/$(ECLIPSE_VANILLA_MACOS_TGZ) $O
$(CP) $(THIRD_PARTY_SOFTWARE_LOCATION)/$(ECLIPSE_VANILLA_LINUX_TGZ) $O
ifeq ($(ENABLE_WINDOWS_INSTALLER),y)
$(CP) $(THIRD_PARTY_SOFTWARE_LOCATION)/$(ECLIPSE_VANILLA_WIN_ZIP) $O
endif
endif
.PHONY: prerequisites
prerequisites: clone copy-external
.PHONY: distclean
distclean: clean
rm -rf $(ROOT)/{binutils,gcc,gdb,newlib,linux,uclibc-ng}
rm -rf $(ROOT)/openocd
#
# Build targets
#
DIRS += $O
TOOLS_ALL_ORDER_DEPS-y += $O
# Create source tarball
$O/.stamp_source_tarball: | $(TOOLS_ALL_ORDER_DEPS-y)
tar --exclude-vcs -c -z -f $O/$(TOOLS_SOURCE_DIR)$(TAR_EXT) --exclude=$O \
--transform="s|^|arc_gnu_$(RELEASE)_sources/|" $(TOOLS_SOURCE_CONTENTS)
touch $@
TOOLS_ALL_DEPS-$(ENABLE_PDF_DOCS) += $(PDF_DOC_FILE)
ifeq ($(ENABLE_SOURCE_TARBALL),y)
$(PDF_DOC_FILE): $O/.stamp_source_tarball
endif
$(PDF_DOC_FILE):
$(MAKE) -C doc clean
$(MAKE) -C doc pdf
# $1 - destination directory.
ifeq ($(ENABLE_PDF_DOCS),y)
define copy_pdf_doc_file
mkdir -p $1/share/doc/
$(CP) $(PDF_DOC_FILE) $1/share/doc/
endef
else
define copy_pdf_doc_file
endef
endif
# Copy tcf handler and linux tcftool version into the workspace
# $1 - arch prefix.
# $2 - destination directory.
ifeq ($(ENABLE_TCF_TOOLS),y)
define copy_tcf_linux
$(INSTALL) -m 0775 $(EXTRAS_DIR)/arc-tcf-gcc $O/$(2)/bin/$(1)-elf32-tcf-gcc
$(INSTALL) -m 0775 $(EXTRAS_DIR)/tcftool/tcftool_x86_linux $O/$(2)/bin/tcftool
endef
else
define copy_tcf_linux
endef
endif
# Copy tcf handler and windows tcftool version into the workspace
# $1 - arch prefix.
# $2 - destination directory.
ifeq ($(ENABLE_TCF_TOOLS),y)
define copy_tcf_win
$(INSTALL) -m 0775 $(EXTRAS_DIR)/arc-tcf-gcc $O/$(2)/bin/$(1)-elf32-tcf-gcc
$(INSTALL) -m 0775 $(EXTRAS_DIR)/tcftool/tcftool_x86_windows.exe $O/$(2)/bin/tcftool.exe
endef
else
define copy_tcf_win
endef
endif
$O/.stamp_elf_le_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc-multilib-elf32,$(TOOLS_ELFLE_HOST_DIR))
$(call copy_tcf_linux,arc,$(TOOLS_ELFLE_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_ELFLE_HOST_DIR))
touch $@
$O/.stamp_elf_be_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arceb-multilib-elf32,$(TOOLS_ELFBE_HOST_DIR))
$(call copy_tcf_linux,arceb,$(TOOLS_ELFBE_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_ELFBE_HOST_DIR))
touch $@
$O/.stamp_elf_le_tarball: $O/.stamp_elf_le_built
$(call create_tar,$(TOOLS_ELFLE_HOST_DIR))
touch $@
$O/.stamp_elf_be_tarball: $O/.stamp_elf_be_built
$(call create_tar,$(TOOLS_ELFBE_HOST_DIR))
touch $@
$O/.stamp_uclibc_le_700_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc-arc700-linux-uclibc,$(TOOLS_UCLIBC_LE_700_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_UCLIBC_LE_700_HOST_DIR))
touch $@
$O/.stamp_uclibc_be_700_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arceb-arc700-linux-uclibc,$(TOOLS_UCLIBC_BE_700_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_UCLIBC_BE_700_HOST_DIR))
touch $@
$O/.stamp_uclibc_le_hs_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc-archs-linux-uclibc,$(TOOLS_UCLIBC_LE_HS_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_UCLIBC_LE_HS_HOST_DIR))
touch $@
$O/.stamp_uclibc_be_hs_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arceb-archs-linux-uclibc,$(TOOLS_UCLIBC_BE_HS_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_UCLIBC_BE_HS_HOST_DIR))
touch $@
$O/.stamp_glibc_le_hs_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc-archs-linux-gnu,$(TOOLS_GLIBC_LE_HS_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_GLIBC_LE_HS_HOST_DIR))
touch $@
$O/.stamp_glibc_be_hs_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arceb-archs-linux-gnu,$(TOOLS_GLIBC_BE_HS_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_GLIBC_BE_HS_HOST_DIR))
touch $@
$O/.stamp_arc64_elf_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc64-unknown-elf,$(TOOLS_ELF_ARC64_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_ELF_ARC64_HOST_DIR))
$O/.stamp_arc64_linux_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc64-snps-linux-gnu,$(TOOLS_LINUX_ARC64_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_LINUX_ARC64_HOST_DIR))
$O/.stamp_uclibc_arc32_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc32-linux-uclibc,$(TOOLS_UCLIBC_ARC32_HOST_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_UCLIBC_ARC32_HOST_DIR))
touch $@
$O/.stamp_uclibc_le_700_tarball: $O/.stamp_uclibc_le_700_built
$(call create_tar,$(TOOLS_UCLIBC_LE_700_HOST_DIR))
touch $@
$O/.stamp_uclibc_le_hs_tarball: $O/.stamp_uclibc_le_hs_built
$(call create_tar,$(TOOLS_UCLIBC_LE_HS_HOST_DIR))
touch $@
$O/.stamp_uclibc_be_700_tarball: $O/.stamp_uclibc_be_700_built
$(call create_tar,$(TOOLS_UCLIBC_BE_700_HOST_DIR))
touch $@
$O/.stamp_uclibc_be_hs_tarball: $O/.stamp_uclibc_be_hs_built
$(call create_tar,$(TOOLS_UCLIBC_BE_HS_HOST_DIR))
touch $@
$O/.stamp_glibc_le_hs_tarball: $O/.stamp_glibc_le_hs_built
$(call create_tar,$(TOOLS_GLIBC_LE_HS_HOST_DIR))
touch $@
$O/.stamp_glibc_be_hs_tarball: $O/.stamp_glibc_be_hs_built
$(call create_tar,$(TOOLS_GLIBC_BE_HS_HOST_DIR))
touch $@
$O/.stamp_arc64_elf_tarball: $O/.stamp_arc64_elf_built
$(call create_tar,$(TOOLS_ELF_ARC64_HOST_DIR))
touch $@
$O/.stamp_arc64_linux_tarball: $O/.stamp_arc64_linux_built
$(call create_tar,$(TOOLS_LINUX_ARC64_HOST_DIR))
touch $@
$O/.stamp_uclibc_arc32_tarball: $O/.stamp_uclibc_arc32_built
$(call create_tar,$(TOOLS_UCLIBC_ARC32_HOST_DIR))
touch $@
#
# macOS toolchain
#
$O/.stamp_elf_le_mac_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc-elf32-macos,$(TOOLS_ELFLE_MAC_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_ELFLE_MAC_DIR))
touch $@
$O/.stamp_elf_be_mac_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arceb-elf32-macos,$(TOOLS_ELFBE_MAC_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_ELFBE_MAC_DIR))
touch $@
$O/.stamp_elf_le_mac_tarball: $O/.stamp_elf_le_mac_built
$(call create_tar,$(TOOLS_ELFLE_MAC_DIR))
touch $@
$O/.stamp_elf_be_mac_tarball: $O/.stamp_elf_be_mac_built
$(call create_tar,$(TOOLS_ELFBE_MAC_DIR))
touch $@
#
# Windows build
#
ifeq ($(ENABLE_WINDOWS_INSTALLER),y)
WINDOWS_SYSROOT := $(shell $(WINDOWS_TRIPLET)-gcc -print-sysroot)/mingw
endif
# Helper function to copy mingw .dll files to installation directories with
# executable files. There are several directories and for simplicity all .dlls
# are copied to all target location.
#
# :param $1 - toolchain installation directory, e.g. $O/$(TOOLS_ELFLE_WIN_DIR).
# :param $2 - toolchain triplet, e.g. arc-elf32, arceb-elf32, etc.
ifneq ($(CONFIG_STATIC_TOOLCHAIN),y)
define copy_mingw_dlls
for t in $(addprefix $1/,bin $2/bin libexec/gcc/$2/*/); do\
cp -a $(WINDOWS_SYSROOT)/bin/* $$t ; \
done
endef
endif
$O/.stamp_elf_le_windows_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc-elf32-win,$(TOOLS_ELFLE_WIN_DIR))
$(call copy_tcf_win,arc,$(TOOLS_ELFLE_WIN_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_ELFLE_WIN_DIR))
touch $@
$O/.stamp_elf_be_windows_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arceb-elf32-win,$(TOOLS_ELFBE_WIN_DIR))
$(call copy_tcf_win,arceb,$(TOOLS_ELFBE_WIN_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_ELFBE_WIN_DIR))
touch $@
$O/.stamp_elf_le_windows_tarball: $O/.stamp_elf_le_windows_built
$(call create_windows_tar,$(TOOLS_ELFLE_WIN_DIR))
touch $@
$O/.stamp_elf_be_windows_tarball: $O/.stamp_elf_be_windows_built
$(call create_windows_tar,$(TOOLS_ELFBE_WIN_DIR))
touch $@
#
# Common build directory.
#
DIRS += $(BUILD_DIR)
#
# Linux
#
BUILDROOT_VERSION = 2018.08.2
BUILDROOT_TAR = buildroot-$(BUILDROOT_VERSION).tar.bz2
BUILDROOT_URL = https://buildroot.org/downloads/$(BUILDROOT_TAR)
BUILDROOT_SRC_DIR = $(BUILD_DIR)/buildroot
BUILDROOT_AXS103_BUILD_DIR = $(BUILD_DIR)/buildroot_axs103
BUILDROOT_AXS103_DEFCONFIG := $(ROOT)/toolchain/extras/buildroot/axs103.defconfig
BUILDROOT_AXS103_MAKEFLAGS = -C $(BUILDROOT_SRC_DIR) \
O=$(abspath $(BUILDROOT_AXS103_BUILD_DIR)) \
ARC_TOOLCHAIN_PATH=$(realpath $O/$(TOOLS_UCLIBC_LE_HS_HOST_DIR)) \
LINUX_SRC_PATH=$(realpath $(ROOT)/linux) \
DEFCONFIG=$(BUILDROOT_AXS103_DEFCONFIG)
# Download Buildroot
$(BUILD_DIR)/$(BUILDROOT_TAR):
$(WGET) $(WGETFLAGS) -O $@ $(BUILDROOT_URL)
# Prepare Buildroot source directory
$(BUILDROOT_SRC_DIR): $(BUILD_DIR)/$(BUILDROOT_TAR) | $(BUILD_DIR)
mkdir -p $@
tar -C $@ --strip-components=1 -x -a -f $<
DIRS += $O/$(LINUX_IMAGES_DIR)
# Configure Buildroot for AXS103
$(BUILDROOT_AXS103_BUILD_DIR)/.config: $(BUILDROOT_AXS103_DEFCONFIG)
$(BUILDROOT_AXS103_BUILD_DIR)/.config: | $(BUILDROOT_SRC_DIR)
$(BUILDROOT_AXS103_BUILD_DIR)/.config:
$(MAKE) $(BUILDROOT_AXS103_MAKEFLAGS) distclean
$(MAKE) $(BUILDROOT_AXS103_MAKEFLAGS) defconfig
# Build images for AXS103
$O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_UIMAGE): $(BUILDROOT_AXS103_BUILD_DIR)/.config \
| $O/$(LINUX_IMAGES_DIR)
$(MAKE) $(BUILDROOT_AXS103_MAKEFLAGS) all
cp -afl $(BUILDROOT_AXS103_BUILD_DIR)/images/uImage \
$O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_UIMAGE)
cp -afl $(BUILDROOT_AXS103_BUILD_DIR)/images/rootfs.cpio \
$O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_ROOTFS_CPIO)
cp -afl $(BUILDROOT_AXS103_BUILD_DIR)/images/rootfs.tar.gz \
$O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_ROOTFS_TAR)
$O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_ROOTFS_CPIO): \
| $O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_UIMAGE)
$O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_ROOTFS_TAR): \
| $O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_UIMAGE)
linux-images: $O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_UIMAGE)
linux-images: $O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_ROOTFS_CPIO)
linux-images: $O/$(LINUX_IMAGES_DIR)/$(LINUX_AXS103_ROOTFS_TAR)
#
# Native toolchain build
#
$O/.stamp_glibc_le_hs_native_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc-archs-native-gnu,$(TOOLS_GLIBC_LE_HS_NATIVE_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_GLIBC_LE_HS_NATIVE_DIR))
touch $@
$O/.stamp_glibc_le_hs_native_tarball: $O/.stamp_glibc_le_hs_native_built
$(call create_tar,$(TOOLS_GLIBC_LE_HS_NATIVE_DIR))
touch $@
$O/.stamp_glibc_arc64_native_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc64-snps-native-gnu,$(TOOLS_GLIBC_ARC64_NATIVE_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_GLIBC_ARC64_NATIVE_DIR))
touch $@
$O/.stamp_glibc_arc64_native_tarball: $O/.stamp_glibc_arc64_native_built
$(call create_tar,$(TOOLS_GLIBC_ARC64_NATIVE_DIR))
touch $@
$O/.stamp_uclibc_arc32_native_built: $(TOOLS_ALL_DEPS-y) | $(TOOLS_ALL_ORDER_DEPS-y)
$(call copy_prebuilt,arc32-native-uclibc,$(TOOLS_UCLIBC_ARC32_NATIVE_DIR))
$(call copy_pdf_doc_file,$O/$(TOOLS_UCLIBC_ARC32_NATIVE_DIR))
touch $@
$O/.stamp_uclibc_arc32_native_tarball: $O/.stamp_uclibc_arc32_native_built
$(call create_tar,$(TOOLS_UCLIBC_ARC32_NATIVE_DIR))
touch $@
#
# IDE related targets
#
ifeq ($(ENABLE_IDE),y)
$O/$(ECLIPSE_VANILLA_LINUX_TGZ):
$(WGET) $(WGETFLAGS) -O $@ '$(ECLIPSE_DL_LINK_BASE)/$(ECLIPSE_VANILLA_LINUX_TGZ)&r=1'
$O/$(ECLIPSE_VANILLA_WIN_ZIP):
$(WGET) $(WGETFLAGS) -O $@ '$(ECLIPSE_DL_LINK_BASE)/$(ECLIPSE_VANILLA_WIN_ZIP)&r=1'
#
# Building IDE Plugins
#
ifeq ($(ENABLE_IDE_PLUGINS_BUILD),y)
IDE_PLUGIN_SRC_DIR=$(ROOT)/arc_gnu_eclipse
IDE_PLUGIN_BUILD_DIR=$(IDE_PLUGIN_SRC_DIR)/build
IDE_PLUGIN_OUT_DIR=$(IDE_PLUGIN_SRC_DIR)/repository/target/
$O/$(IDE_PLUGINS_ZIP):
cd $(IDE_PLUGIN_SRC_DIR) && $(IDE_PLUGIN_BUILD_DIR)/build-repository.sh
$(CP) $(IDE_PLUGIN_OUT_DIR)/repository-*-SNAPSHOT.zip $@
endif
# Install ARC plugins from .zip file and install prerequisites in Eclipse.
# Similar invocation is in windows/build-release.sh. Those invocations must be
# in sync.
$O/.stamp_ide_linux_eclipse: $O/$(ECLIPSE_VANILLA_LINUX_TGZ) $O/$(IDE_PLUGINS_ZIP)
mkdir -m775 -p $O/$(IDE_LINUX_INSTALL)
tar xf $< -C $O/$(IDE_LINUX_INSTALL)
unzip $O/${IDE_PLUGINS_ZIP} -d $O/$(IDE_LINUX_INSTALL)/eclipse/dropins
rm -f $O/$(IDE_LINUX_INSTALL)/eclipse/dropins/artifacts.jar
rm -f $O/$(IDE_LINUX_INSTALL)/eclipse/dropins/content.jar
echo "[email protected]/ARC_GNU_IDE_Workspace" >> $O/$(IDE_LINUX_INSTALL)/eclipse/eclipse.ini
touch $@
$O/.stamp_ide_linux_tar: \
$O/$(OOCD_HOST_DIR)$(TAR_EXT) \
$O/.stamp_ide_linux_eclipse \
$O/.stamp_elf_be_built $O/.stamp_elf_le_built \
$O/.stamp_uclibc_be_hs_built $O/.stamp_uclibc_le_hs_built
$(LOCAL_CP) $O/$(TOOLS_ELFLE_HOST_DIR)/* $O/$(IDE_LINUX_INSTALL)
$(LOCAL_CP) $O/$(TOOLS_ELFBE_HOST_DIR)/* $O/$(IDE_LINUX_INSTALL)
$(LOCAL_CP) $O/$(TOOLS_UCLIBC_LE_HS_HOST_DIR)/* $O/$(IDE_LINUX_INSTALL)
$(LOCAL_CP) $O/$(TOOLS_UCLIBC_BE_HS_HOST_DIR)/* $O/$(IDE_LINUX_INSTALL)
mkdir -p -m775 $O/$(IDE_LINUX_INSTALL)/eclipse/jre
# OpenJ9 tarball has paths starting with `./jdk-11.0.1_13-jre`, thus it is
# needed to strip 2 components instead of 1.
tar xf $O/$(JRE_LINUX_TGZ) -C $O/$(IDE_LINUX_INSTALL)/eclipse/jre \
--strip-components=2
$(LOCAL_CP) $O/$(OOCD_HOST_DIR)/* $O/$(IDE_LINUX_INSTALL)
$(call create_tar,$(IDE_LINUX_INSTALL))
touch $@
#
# IDE on macOS
#
$O/.stamp_ide_macos_eclipse: $O/$(ECLIPSE_VANILLA_MACOS_TGZ) $O/$(IDE_PLUGINS_ZIP)
mkdir -m775 -p $O/$(IDE_MACOS_INSTALL)
tar xf $< -C $O/$(IDE_MACOS_INSTALL)
unzip $O/$(IDE_PLUGINS_ZIP) -d $O/$(IDE_MACOS_INSTALL)/Eclipse.app/Contents/Eclipse/dropins
rm -f $O/$(IDE_MACOS_INSTALL)/Eclipse.app/Contents/Eclipse/dropins/artifacts.jar
rm -f $O/$(IDE_MACOS_INSTALL)/Eclipse.app/Contents/Eclipse/dropins/content.jar
echo "[email protected]/ARC_GNU_IDE_Workspace" >> $O/$(IDE_MACOS_INSTALL)/Eclipse.app/Contents/Eclipse/eclipse.ini
touch $@
$O/.stamp_ide_macos_tar: \
$O/$(OOCD_MAC_DIR)$(TAR_EXT) \
$O/.stamp_ide_macos_eclipse \
$O/.stamp_elf_le_mac_built $O/.stamp_elf_be_mac_built
$(LOCAL_CP) $O/$(TOOLS_ELFLE_MAC_DIR)/* $O/$(IDE_MACOS_INSTALL)
$(LOCAL_CP) $O/$(TOOLS_ELFBE_MAC_DIR)/* $O/$(IDE_MACOS_INSTALL)
mkdir -p -m775 $O/$(IDE_MACOS_INSTALL)/eclipse/jre
$(LOCAL_CP) $O/$(OOCD_MAC_DIR)/* $O/$(IDE_MACOS_INSTALL)
$(call create_tar,$(IDE_MACOS_INSTALL))
touch $@
endif
#
# OpenOCD
#
.PHONY: openocd-linux
openocd-linux: $O/$(OOCD_HOST_DIR)$(TAR_EXT)
DIRS += $(OOCD_BUILD_HOST_DIR)
# Bootstrap is common to Linux and Windows.
$(OOCD_SRC_DIR)/configure: