Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
662 lines (538 loc) · 31.9 KB
/
Copy pathMakefile
File metadata and controls
662 lines (538 loc) · 31.9 KB
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
#####################################################################################################################################################################################################################################################################################
# _____ ____ __ __ __ __ ____ _ _
# / ____/ __ \| \/ | \/ |/ __ \| \ | |
#| | | | | | \ / | \ / | | | | \| |
#| | | | | | |\/| | |\/| | | | | . ` |
#| |___| |__| | | | | | | | |__| | |\ |
# \_____\____/|_| |_|_| |_|\____/|_| \_|
#
# number of processors to use for build
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
NPROC = $(shell nproc)
else ifeq ($(UNAME), Darwin)
NPROC = $(shell sysctl -n hw.physicalcpu)
endif
# Common CMake setup args
INSTALL_PREFIX :=
CMAKE_COMMON_ARGS := -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DCMAKE_POSITION_INDEPENDENT_CODE=ON
ifdef INSTALL_PREFIX
CMAKE_COMMON_ARGS := $(CMAKE_COMMON_ARGS) -DCMAKE_INSTALL_PREFIX=$(INSTALL_PREFIX)
endif
# use ccache if available
CCACHE := $(shell which ccache 2> /dev/null)
ifdef CCACHE
CMAKE_COMMON_ARGS := $(CMAKE_COMMON_ARGS) -DCMAKE_CXX_COMPILER_LAUNCHER=$(shell which ccache)
endif
CMAKE_COMMON_ARGS_SHARED := -B build_shared $(CMAKE_COMMON_ARGS) -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF
CMAKE_COMMON_ARGS_STATIC := -B build_static $(CMAKE_COMMON_ARGS) -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF
# Common CMake build args
CMAKE_BUILD_ARGS := -- -j $(NPROC)
CMAKE_BUILD_ARGS_SHARED := --build build_shared $(CMAKE_BUILD_ARGS)
CMAKE_BUILD_ARGS_STATIC := --build build_static $(CMAKE_BUILD_ARGS)
# Common CMake install args
CMAKE_INSTALL_ARGS :=
ifdef INSTALL_PREFIX
CMAKE_INSTALL_ARGS := --prefix $(INSTALL_PREFIX)
endif
CMAKE_INSTALL_ARGS_SHARED := --install build_shared $(CMAKE_INSTALL_ARGS)
CMAKE_INSTALL_ARGS_STATIC := --install build_static $(CMAKE_INSTALL_ARGS)
# Common install vars
ifeq ($(UNAME), Linux)
ROOT_PREFIX := $(or $(INSTALL_PREFIX),"/usr/local")
BIN_DIR := $(or $(INSTALL_PREFIX),"/usr/local")/bin/
INC_DIR := $(or $(INSTALL_PREFIX),"/usr/local")/include/
LIB_DIR := $(or $(INSTALL_PREFIX),"/usr/local")/lib/
SHARE_DIR := $(or $(INSTALL_PREFIX),"/usr/local")/share
JAVA_INSTALL_DIR := /usr/local/share
else ifeq ($(UNAME), Darwin)
ROOT_PREFIX := $(or $(INSTALL_PREFIX),"/opt/homebrew")
BIN_DIR := $(or $(INSTALL_PREFIX),"/opt/homebrew")/bin/
INC_DIR := $(or $(INSTALL_PREFIX),"/opt/homebrew")/include/
LIB_DIR := $(or $(INSTALL_PREFIX),"/opt/homebrew")/lib/
SHARE_DIR := $(or $(INSTALL_PREFIX),"/opt/homebrew")/share
JAVA_INSTALL_DIR := /opt/homebrew/share
endif
SUDO:=sudo
#####################################################################################################################################################################################################################################################################################
# __ ________ _____ _____ _____ ____ _ _ _____
# \ \ / / ____| __ \ / ____|_ _/ __ \| \ | |/ ____|
# \ \ / /| |__ | |__) | (___ | || | | | \| | (___
# \ \/ / | __| | _ / \___ \ | || | | | . ` |\___ \
# \ / | |____| | \ \ ____) |_| || |__| | |\ |____) |
# \/ |______|_| \_\_____/|_____\____/|_| \_|_____/
#
GOOGLETEST_VERSION := 1.15.2
CAPNPROTO_VERSION := 1.0.2
JSON_VERSION := 3.11.3
ANTLR_VERSION := 4.13.2
UHDM_VERSION := 1.84
SURELOG_VERSION := 1.84
VERIBLE_VERSION := 0.1.0
YOSYS_VERSION := 0.62
SLANG_COMMIT := d5e8d8558e
SLANG_VERSION := 0.0-g$(SLANG_COMMIT)
VERILATOR_VERSION := 5.044
OPENFPGALOADER_VERSION := 0.13.1
SIMVIEW_VERSION := 0.0.1
SURFER_VERSION := 0.0.1
# TODO
VERIBLE_TAG := v0.0-3981-g0e58c803
#####################################################################################################################################################################################################################################################################################
RELEASE_VERSION := 0.0.1
.PHONY: download
download: ## Download all releases
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/antlr_$(ANTLR_VERSION)_amd64.deb
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/capnproto_$(CAPNPROTO_VERSION)_amd64.deb
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/json_$(JSON_VERSION)_amd64.deb
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/uhdm_$(UHDM_VERSION)_amd64.deb
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/surelog_$(SURELOG_VERSION)_amd64.deb
# wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/simview_$(SIMVIEW_VERSION)_amd64.deb
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/yosys_$(YOSYS_VERSION)_amd64.deb
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/yosys-slang_$(SLANG_VERSION)_amd64.deb
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/verilator_$(VERILATOR_VERSION)_amd64.deb
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/openfpgaloader_$(OPENFPGALOADER_VERSION)_amd64.deb
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/simview_$(SIMVIEW_VERSION)_amd64.deb
wget https://github.com/dau-dev/tools/releases/download/v$(RELEASE_VERSION)/surfer_$(SURFER_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# _ _ _
# | | | | | |
# __ _ ___ ___ __ _| | ___| |_ ___ ___| |_
# / _` |/ _ \ / _ \ / _` | |/ _ \ __/ _ \/ __| __|
#| (_| | (_) | (_) | (_| | | __/ || __/\__ \ |_
# \__, |\___/ \___/ \__, |_|\___|\__\___||___/\__|
# __/ | __/ |
# |___/ |___/
#
# https://github.com/google/googletest
#
googletest/.git:
git clone --depth 1 --branch v$(GOOGLETEST_VERSION) https://github.com/google/googletest.git
googletest/build_shared: googletest/.git
cd googletest && cmake $(CMAKE_COMMON_ARGS_SHARED) .
cd googletest && cmake $(CMAKE_BUILD_ARGS_SHARED)
googletest/build_static: googletest/.git
cd googletest && cmake $(CMAKE_COMMON_ARGS_STATIC)
cd googletest && cmake $(CMAKE_BUILD_ARGS_STATIC)
.PHONY: googletest
googletest: googletest/build_shared googletest/build_static ## build googletest
.PHONY: googletest/install
googletest/install: googletest/build_shared googletest/build_static ## build and install googletest
cd googletest && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_SHARED)
cd googletest && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_STATIC)
#####################################################################################################################################################################################################################################################################################
# _____ _ _____ _
# / ____| ( ) | __ \ | |
# | | __ _ _ __ |/ _ __ | |__) | __ ___ | |_ ___
# | | / _` | '_ \ | '_ \| ___/ '__/ _ \| __/ _ \
# | |___| (_| | |_) | | | | | | | | | (_) | || (_) |
# \_____\__,_| .__/ |_| |_|_| |_| \___/ \__\___/
# | |
# |_|
#
# https://github.com/capnproto/capnproto
#
.PHONY: capnproto/build_shared capnproto/build_static capnproto capnproto/install capnproto/debian
capnproto/.git:
git clone --depth 1 --branch v$(CAPNPROTO_VERSION) https://github.com/capnproto/capnproto.git
capnproto/build_shared: capnproto/.git
cd capnproto && cmake $(CMAKE_COMMON_ARGS_SHARED) .
cd capnproto && cmake $(CMAKE_BUILD_ARGS_SHARED)
capnproto/build_static: capnproto/.git
cd capnproto && cmake $(CMAKE_COMMON_ARGS_STATIC)
cd capnproto && cmake $(CMAKE_BUILD_ARGS_STATIC)
capnproto: capnproto/build_shared capnproto/build_static ## build capnproto
capnproto/install: capnproto/build_shared capnproto/build_static ## build and install capnproto
cd capnproto && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_SHARED)
cd capnproto && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_STATIC)
capnproto/debian: ## build debian package for capnproto
$(SUDO) rm -rf capnproto/build_static/install_manifest.txt
$(SUDO) rm -rf capnproto/build_shared/install_manifest.txt
$(MAKE) capnproto/build_static INSTALL_PREFIX=./debian/usr/local
$(MAKE) capnproto/build_shared INSTALL_PREFIX=./debian/usr/local
$(MAKE) capnproto/install INSTALL_PREFIX=./debian/usr/local SUDO=
mkdir -p capnproto/debian/DEBIAN
printf "Package: capnproto\nVersion: $(CAPNPROTO_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: capnproto\n" > capnproto/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build capnproto/debian capnproto_$(CAPNPROTO_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# _ _____ ____ _ _
# | |/ ____|/ __ \| \ | |
# | | (___ | | | | \| |
# _ | |\___ \| | | | . ` |
#| |__| |____) | |__| | |\ |
# \____/|_____/ \____/|_| \_|
#
# https://github.com/nlohmann/json
#
.PHONY: json/build_shared json/build_static json json/install json/debian
JSON_CMAKE_ARGS:=-DJSON_BuildTests=OFF
json/.git:
git clone --depth 1 --branch v$(JSON_VERSION) https://github.com/nlohmann/json.git
json/build_shared: json/.git
cd json && cmake $(CMAKE_COMMON_ARGS_SHARED) $(JSON_CMAKE_ARGS)
cd json && cmake $(CMAKE_BUILD_ARGS_SHARED)
json/build_static: json/.git
cd json && cmake $(CMAKE_COMMON_ARGS_STATIC) $(JSON_CMAKE_ARGS)
cd json && cmake $(CMAKE_BUILD_ARGS_STATIC)
json: json/build_shared json/build_static ## build json
json/install: json/build_shared json/build_static ## build and install json
cd json && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_SHARED)
cd json && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_STATIC)
json/debian: ## build debian package for json
$(SUDO) rm -rf json/build_static/install_manifest.txt
$(SUDO) rm -rf json/build_shared/install_manifest.txt
$(MAKE) json/build_static INSTALL_PREFIX=./debian/usr/local
$(MAKE) json/build_shared INSTALL_PREFIX=./debian/usr/local
$(MAKE) json/install INSTALL_PREFIX=./debian/usr/local SUDO=
mkdir -p json/debian/DEBIAN
printf "Package: json\nVersion: $(JSON_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: json\n" > json/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build json/debian json_$(JSON_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# _ _ _______ _ _____
# /\ | \ | |__ __| | | __ \
# / \ | \| | | | | | | |__) |
# / /\ \ | . ` | | | | | | _ /
# / ____ \| |\ | | | | |____| | \ \
# /_/ \_\_| \_| |_| |______|_| \_\
#
# https://www.antlr.org/
#
.PHONY: antlr/build_shared antlr/build_static antlr antlr/install antlr/debian
antlr/antlr-$(ANTLR_VERSION)-complete.jar:
mkdir -p antlr
cd antlr && wget https://www.antlr.org/download/antlr4-cpp-runtime-$(ANTLR_VERSION)-source.zip
cd antlr && unzip antlr4-cpp-runtime-$(ANTLR_VERSION)-source.zip
wget https://www.antlr.org/download/antlr-$(ANTLR_VERSION)-complete.jar -P ./antlr
antlr/build_shared: antlr/antlr-$(ANTLR_VERSION)-complete.jar
cd antlr && cmake $(CMAKE_COMMON_ARGS_SHARED) .
cd antlr && cmake $(CMAKE_BUILD_ARGS_SHARED)
antlr/build_static: antlr/antlr-$(ANTLR_VERSION)-complete.jar
cd antlr && cmake $(CMAKE_COMMON_ARGS_STATIC)
cd antlr && cmake $(CMAKE_BUILD_ARGS_STATIC)
antlr: antlr/build_shared antlr/build_static ## build antlr
antlr/install: antlr/build_shared antlr/build_static ## build and install antlr
cd antlr && $(SUDO) mkdir -p $(SHARE_DIR)/java
cd antlr && $(SUDO) cp antlr-$(ANTLR_VERSION)-complete.jar $(SHARE_DIR)/java
cd antlr && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_SHARED)
cd antlr && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_STATIC)
antlr/debian: ## build debian package for antlr
$(SUDO) rm -rf antlr/build_static/install_manifest.txt
$(SUDO) rm -rf antlr/build_shared/install_manifest.txt
$(MAKE) antlr/build_static INSTALL_PREFIX=./debian/usr/local
$(MAKE) antlr/build_shared INSTALL_PREFIX=./debian/usr/local
$(MAKE) antlr/install INSTALL_PREFIX=./debian/usr/local SUDO=
mkdir -p antlr/debian/DEBIAN
printf "Package: antlr\nVersion: $(ANTLR_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: antlr\n" > antlr/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build antlr/debian antlr_$(ANTLR_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# _ _ _ _ _____ __ __
# | | | | | | | __ \| \/ |
# | | | | |__| | | | | \ / |
# | | | | __ | | | | |\/| |
# | |__| | | | | |__| | | | |
# \____/|_| |_|_____/|_| |_|
#
# https://github.com/chipsalliance/UHDM
#
.PHONY: uhdm/build_shared uhdm/build_static uhdm uhdm/install uhdm/debian uhdm/rpm
UHDM_CMAKE_ARGS := -DUHDM_USE_HOST_GTEST=ON -DUHDM_USE_HOST_CAPNP=ON -DUHDM_BUILD_TESTS=OFF
uhdm/.git:
git clone --depth 1 --branch v$(UHDM_VERSION) https://github.com/chipsalliance/UHDM.git uhdm
uhdm/build_shared: uhdm/.git
cd uhdm && cmake $(UHDM_CMAKE_ARGS) $(CMAKE_COMMON_ARGS_SHARED) .
cd uhdm && cmake $(CMAKE_BUILD_ARGS_SHARED)
uhdm/build_static: uhdm/.git
cd uhdm && cmake $(UHDM_CMAKE_ARGS) $(CMAKE_COMMON_ARGS_STATIC)
cd uhdm && cmake $(CMAKE_BUILD_ARGS_STATIC)
uhdm: uhdm/build_shared uhdm/build_static ## build uhdm
uhdm/install: uhdm/build_shared uhdm/build_static ## build and install uhdm
cd uhdm && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_SHARED)
cd uhdm && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_STATIC)
uhdm/debian: ## build debian package for uhdm
$(SUDO) rm -rf uhdm/build_static/install_manifest.txt
$(SUDO) rm -rf uhdm/build_shared/install_manifest.txt
$(MAKE) uhdm/build_static INSTALL_PREFIX=./debian/usr/local
$(MAKE) uhdm/build_shared INSTALL_PREFIX=./debian/usr/local
$(MAKE) uhdm/install INSTALL_PREFIX=./debian/usr/local SUDO=
mkdir -p uhdm/debian/DEBIAN
printf "Package: uhdm\nVersion: $(UHDM_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: UHDM\n" > uhdm/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build uhdm/debian uhdm_$(UHDM_VERSION)_amd64.deb
uhdm/rpm: ## build rpm package for uhdm
mkdir -p uhdm/rpm
printf "Name: uhdm\nVersion: $(UHDM_VERSION)\nLicense: Apache-2\nRelease: 1%%{?dist}\nSummary: UHDM\nPackager: timkpaine <t.paine154@gmail.com>\nBuildArch: x86_64\n\n%%description\nUHDM\n\n%%setup\n\n%%build\n\n%%install\n\n%%clean\n\n%%post\n\n%%files\n%%{_bindir}/%%name\n\n%%changelog\n" > uhdm/rpm/uhdm.spec
#####################################################################################################################################################################################################################################################################################
# _____ _
# / ____| | |
# | (___ _ _ _ __ ___| | ___ __ _
# \___ \| | | | '__/ _ \ |/ _ \ / _` |
# ____) | |_| | | | __/ | (_) | (_| |
# |_____/ \__,_|_| \___|_|\___/ \__, |
# __/ |
# |___/
#
# https://github.com/chipsalliance/Surelog
#
.PHONY: surelog/build_shared surelog/build_static surelog surelog/install surelog/debian
SURELOG_CMAKE_ARGS := -DSURELOG_USE_HOST_ALL=ON -DSURELOG_WITH_TCMALLOC=OFF -DSURELOG_WITH_ZLIB=ON -DANTLR_JAR_LOCATION=${JAVA_INSTALL_DIR}/java/antlr-$(ANTLR_VERSION)-complete.jar
surelog/.git:
git clone --depth 1 --branch v$(SURELOG_VERSION) https://github.com/chipsalliance/Surelog.git surelog
surelog/build_shared: surelog/.git
cd surelog && cmake $(SURELOG_CMAKE_ARGS) $(CMAKE_COMMON_ARGS_SHARED) .
cd surelog && cmake $(CMAKE_BUILD_ARGS_SHARED)
surelog/build_static: surelog/.git
cd surelog && cmake $(SURELOG_CMAKE_ARGS) $(CMAKE_COMMON_ARGS_STATIC)
cd surelog && cmake $(CMAKE_BUILD_ARGS_STATIC)
surelog: surelog/build_shared surelog/build_static ## build surelog
surelog/install: surelog/build_shared surelog/build_static ## build and install surelog
cd surelog && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_SHARED)
cd surelog && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_STATIC)
surelog/debian: ## build debian package for surelog
$(SUDO) rm -rf surelog/build_static/install_manifest.txt
$(SUDO) rm -rf surelog/build_shared/install_manifest.txt
$(MAKE) surelog/build_static INSTALL_PREFIX=./debian/usr/local
$(MAKE) surelog/build_shared INSTALL_PREFIX=./debian/usr/local
$(MAKE) surelog/install INSTALL_PREFIX=./debian/usr/local SUDO=
mkdir -p surelog/debian/DEBIAN
printf "Package: surelog\nVersion: $(SURELOG_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: surelog\n" > surelog/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build surelog/debian surelog_$(SURELOG_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# __ __ _ _ _
# \ \ / / (_) | | |
# \ \ / /__ _ __ _| |__ | | ___
# \ \/ / _ \ '__| | '_ \| |/ _ \
# \ / __/ | | | |_) | | __/
# \/ \___|_| |_|_.__/|_|\___|
#
# https://github.com/chipsalliance/verible
#
.PHONY: verible/libs verible verible/install verible/debian
verible/.git:
git clone --depth 1 --branch $(VERIBLE_TAG) https://github.com/chipsalliance/verible.git
verible/libs: verible/.git
cd verible && bazel build -c opt //...
# cd verible && bazel build -c opt --config=create_static_linked_executables //...
verible: verible/libs ## build verible
verible/install: verible/libs ## build and install verible
mkdir -p $(BIN_DIR)
cd verible && $(SUDO) .github/bin/simple-install.sh $(BIN_DIR)
verible/debian: ## build debian package for verible
$(MAKE) verible/libs
$(MAKE) verible/install INSTALL_PREFIX=$(shell pwd)/verible/debian/usr/local SUDO=
mkdir -p verible/debian/DEBIAN
printf "Package: verible\nVersion: $(VERIBLE_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: verible\n" > verible/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build verible/debian verible_$(VERIBLE_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# _ _ ___ ___ _ _ ___
# | | | |/ _ \/ __| | | / __|
# | |_| | (_) \__ \ |_| \__ \
# \__, |\___/|___/\__, |___/
# __/ | __/ |
# |___/ |___/
#
# https://github.com/YosysHQ/yosys
#
.PHONY: yosys/libs yosys yosys/install yosys/debian
ifeq ($(UNAME), Linux)
YOSYS_ARGS := CONFIG=gcc
else ifeq ($(UNAME), Darwin)
YOSYS_ARGS := CONFIG=clang
endif
yosys/.git:
git clone --depth 1 --branch v$(YOSYS_VERSION) https://github.com/YosysHQ/yosys.git
cd yosys && git submodule update --init --recursive
yosys/libs: yosys/.git
cd yosys && make $(YOSYS_ARGS) -j $(NPROC)
yosys: yosys/libs ## build yosys
yosys/install: yosys/libs ## build and install yosys
cd yosys && $(SUDO) make $(YOSYS_ARGS) PREFIX=$(ROOT_PREFIX) install
yosys/debian: ## build debian package for yosys
$(MAKE) yosys/libs
$(MAKE) yosys/install INSTALL_PREFIX=./debian/usr/local SUDO=
mkdir -p yosys/debian/DEBIAN
printf "Package: yosys\nVersion: $(YOSYS_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: yosys\n" > yosys/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build yosys/debian yosys_$(YOSYS_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# ______ _____ _____ _ _
# | ____| __ \ / ____| /\ | | | |
# ___ _ __ ___ _ __ | |__ | |__) | | __ / \ | | ___ __ _ __| | ___ _ __
# / _ \| '_ \ / _ \ '_ \| __| | ___/| | |_ | / /\ \ | | / _ \ / _` |/ _` |/ _ \ '__|
# | (_) | |_) | __/ | | | | | | | |__| |/ ____ \| |___| (_) | (_| | (_| | __/ |
# \___/| .__/ \___|_| |_|_| |_| \_____/_/ \_\______\___/ \__,_|\__,_|\___|_|
# | |
# |_|
#
# https://github.com/trabucayre/openFPGALoader
#
.PHONY: openfpgaloader/libs openfpgaloader openfpgaloader/install openfpgaloader/debian
openfpgaloader/.git:
git clone --depth 1 --branch v$(OPENFPGALOADER_VERSION) https://github.com/trabucayre/openFPGALoader.git openfpgaloader
openfpgaloader/build_shared: openfpgaloader/.git
cd openfpgaloader && cmake $(CMAKE_COMMON_ARGS_SHARED) .
cd openfpgaloader && cmake $(CMAKE_BUILD_ARGS_SHARED)
openfpgaloader/build_static: openfpgaloader/.git
cd openfpgaloader && cmake $(CMAKE_COMMON_ARGS_STATIC)
cd openfpgaloader && cmake $(CMAKE_BUILD_ARGS_STATIC)
openfpgaloader: openfpgaloader/build_shared openfpgaloader/build_static ## build openfpgaloader
openfpgaloader/install: openfpgaloader/build_shared openfpgaloader/build_static ## build and install openfpgaloader
cd openfpgaloader && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_SHARED)
cd openfpgaloader && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_STATIC)
openfpgaloader/debian: ## build debian package for openfpgaloader
$(SUDO) rm -rf openfpgaloader/build_static/install_manifest.txt
$(SUDO) rm -rf openfpgaloader/build_shared/install_manifest.txt
$(MAKE) openfpgaloader/build_static INSTALL_PREFIX=./debian/usr/local
$(MAKE) openfpgaloader/build_shared INSTALL_PREFIX=./debian/usr/local
$(MAKE) openfpgaloader/install INSTALL_PREFIX=./debian/usr/local SUDO=
mkdir -p openfpgaloader/debian/DEBIAN
printf "Package: openfpgaloader\nVersion: $(OPENFPGALOADER_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: openfpgaloader\n" > openfpgaloader/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build openfpgaloader/debian openfpgaloader_$(OPENFPGALOADER_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# yosys-slang
#
# https://github.com/povik/yosys-slang
#
.PHONY: yosys-slang/build yosys-slang yosys-slang/install yosys-slang/debian
yosys-slang/.git:
git clone --recursive https://github.com/povik/yosys-slang.git
cd yosys-slang && git checkout $(SLANG_COMMIT) && git submodule update --init --recursive
yosys-slang/build: yosys-slang/.git
cd yosys-slang && cmake -S . -B build -DYOSYS_CONFIG=yosys-config -DCMAKE_BUILD_TYPE=Release
cd yosys-slang && cmake --build build -j $(NPROC)
yosys-slang: yosys-slang/build ## build yosys-slang
yosys-slang/install: yosys-slang/build ## build and install yosys-slang
cd yosys-slang && $(SUDO) cmake --install build
yosys-slang/debian: ## build debian package for yosys-slang
$(MAKE) yosys-slang/build
mkdir -p yosys-slang/debian/DEBIAN
cd yosys-slang && DESTDIR=$(CURDIR)/yosys-slang/debian cmake --install build
printf "Package: yosys-slang\nVersion: $(SLANG_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: yosys-slang\n" > yosys-slang/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build yosys-slang/debian yosys-slang_$(SLANG_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# __ __ _ _ _
# \ \ / / (_) | | |
# \ \ / /__ _ __ _| | __ _| |_ ___ _ __
# \ \/ / _ \ '__| | |/ _` | __/ _ \| '__|
# \ / __/ | | | | (_| | || (_) | |
# \/ \___|_| |_|_|\__,_|\__\___/|_|
#
#
# https://github.com/verilator/verilator
#
.PHONY: verilator/build_static verilator verilator/install verilator/debian
verilator/.git:
git clone --depth 1 --branch v$(VERILATOR_VERSION) https://github.com/verilator/verilator.git
verilator/build_static: verilator/.git
cd verilator && cmake $(CMAKE_COMMON_ARGS_STATIC) .
cd verilator && cmake $(CMAKE_BUILD_ARGS_STATIC)
cd verilator && echo "AR = ar" >> build_static/include/verilated.mk
cd verilator && echo "CXX = c++" >> build_static/include/verilated.mk
cd verilator && echo "LINK = c++" >> build_static/include/verilated.mk
cd verilator && echo "PYTHON3 = python" >> build_static/include/verilated.mk
# The cmake build leaves CFG_CXXFLAGS_STD empty where the autoconf build
# would detect it, so nothing puts a -std flag on CPPFLAGS. Anything using
# --timing then fails to compile: verilated_timing.h includes <coroutine>,
# and gcc refuses that below C++20 with "requires -fcoroutines". Patch the
# assignment rather than appending one, so it holds regardless of how the
# CPPFLAGS += line expands.
cd verilator && sed -i 's|^CFG_CXXFLAGS_STD = $$|CFG_CXXFLAGS_STD = -std=gnu++20|' build_static/include/verilated.mk
cd verilator && grep -q '^CFG_CXXFLAGS_STD = -std=' build_static/include/verilated.mk
verilator: verilator/build_static ## build verilator
verilator/install: verilator/build_static ## build and install verilator
cd verilator && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_STATIC)
verilator/debian: ## build debian package for verilator
$(SUDO) rm -rf verilator/debian
$(MAKE) verilator/build_static INSTALL_PREFIX=./debian/usr/local
$(MAKE) verilator/install INSTALL_PREFIX=./debian/usr/local SUDO=
mkdir -p verilator/debian/DEBIAN
printf "Package: verilator\nVersion: $(VERILATOR_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: verilator\n" > verilator/debian/DEBIAN/control
cd verilator/debian/usr/local && rm -rf share/verilator && mkdir -p share/verilator && mv include share/verilator && mv examples share/verilator && mv *.cmake share/verilator/ && sed -i 's|$$verilator_pkgdatadir_relpath = ".."|$$verilator_pkgdatadir_relpath = "../share/verilator"|g' bin/verilator && cp -r bin share/verilator
dpkg-deb -Z"gzip" --root-owner-group --build verilator/debian verilator_$(VERILATOR_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# _ _
# (_) (_)
# ___ _ _ __ _____ ___ _____ __
# / __| | '_ ` _ \ \ / / |/ _ \ \ /\ / /
# \__ \ | | | | | \ V /| | __/\ V V /
# |___/_|_| |_| |_|\_/ |_|\___| \_/\_/
#
# https://github.com/pieter3d/simview
#
.PHONY: simview/build_static simview simview/install simview/debian
simview/.git:
git clone --depth 1 --branch tkp/mac_and_sharedlibs https://github.com/timkpaine/simview.git
simview/build_static: simview/.git
cd simview && cmake $(CMAKE_COMMON_ARGS_STATIC) .
cd simview && cmake $(CMAKE_BUILD_ARGS_STATIC)
simview: simview/build_static ## build simview
simview/install: simview/build_static ## build and install simview
cd simview && $(SUDO) cmake $(CMAKE_INSTALL_ARGS_STATIC)
cd simview && $(SUDO) mkdir -p $(BIN_DIR) && $(SUDO) cp build_static/simview $(BIN_DIR)
simview/debian: ## build debian package for simview
$(SUDO) rm -rf simview/build_static/install_manifest.txt
$(MAKE) simview/build_static INSTALL_PREFIX=./debian/usr/local
$(MAKE) simview/install INSTALL_PREFIX=./debian/usr/local SUDO=
mkdir -p simview/debian/DEBIAN
printf "Package: simview\nVersion: $(SIMVIEW_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: simview\n" > simview/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build simview/debian simview_$(SIMVIEW_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# _____ __
# / ____| / _|
# | (___ _ _ _ __| |_ ___ _ __
# \___ \| | | | '__| _/ _ \ '__|
# ____) | |_| | | | || __/ |
# |_____/ \__,_|_| |_| \___|_|
#
# https://gitlab.com/surfer-project/surfer
#
.PHONY: surfer/build surfer surfer/install surfer/debian
surfer/.git:
git clone --depth 1 --branch main https://gitlab.com/surfer-project/surfer.git
cd surfer && git submodule update --init --recursive
surfer/build: surfer/.git
cd surfer && cargo build --release
surfer: surfer/build ## build surfer
surfer/install: surfer/build ## build and install surfer
cd surfer && $(SUDO) mkdir -p $(BIN_DIR) && $(SUDO) cp target/release/surfer $(BIN_DIR)
surfer/debian: ## build debian package for surfer
$(MAKE) surfer/build INSTALL_PREFIX=./debian/usr/local
$(MAKE) surfer/install INSTALL_PREFIX=./debian/usr/local SUDO=
mkdir -p surfer/debian/DEBIAN
printf "Package: surfer\nVersion: $(SURFER_VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: timkpaine <t.paine154@gmail.com>\nDescription: surfer\n" > surfer/debian/DEBIAN/control
dpkg-deb -Z"gzip" --root-owner-group --build surfer/debian surfer_$(SURFER_VERSION)_amd64.deb
#####################################################################################################################################################################################################################################################################################
# _____ _ ______ _ _
# / ____| | | ____| /\ | \ | |
# | | | | | |__ / \ | \| |
# | | | | | __| / /\ \ | . ` |
# | |____| |____| |____ / ____ \| |\ |
# \_____|______|______/_/ \_\_| \_|
#
.PHONY: clean
clean: ## Delete all built repos
rm -rf googletest
rm -rf capnproto
rm -rf json
rm -rf antlr4
rm -rf uhdm
rm -rf surelog
rm -rf yosys-slang
rm -rf verible
rm -rf yosys
rm -rf openfpgaloader
rm -rf surfer
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '^[a-zA-Z0-9//_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
print-%:
@echo '$*=$($*)'
#####################################################################################################################################################################################################################################################################################
# _______ _ _ _
# |__ __| | | | | |
# | | | |__ __ _ _ __ | | _____| |
# | | | '_ \ / _` | '_ \| |/ / __| |
# | | | | | | (_| | | | | <\__ \_|
# |_| |_| |_|\__,_|_| |_|_|\_\___(_)
#
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
# https://patorjk.com/software/taag/#p=display&f=Big&t=Type%20Something%20
#