-
Notifications
You must be signed in to change notification settings - Fork 23
/
build_binaries.mk
executable file
·128 lines (98 loc) · 3.54 KB
/
build_binaries.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
#!/usr/bin/env -S make -rR -Oline -f
.ONESHELL:
SHELL := bash
override .SHELLFLAGS := -e -u -o pipefail -O nullglob -O extglob -O globstar -c
override this_mk.file := $(abspath $(lastword ${MAKEFILE_LIST}))
override this_mk.dir := $(patsubst /%/,/%,$(dir ${this_mk.file}))
override chr.quot := '#'# Single quote; everything starting from the first `#` is a comment intended to fix syntax highlighting.
override chr.percent := %
sh_quote = ${chr.quot}$(subst ${chr.quot},${chr.quot}\'${chr.quot},$(strip ${1}))${chr.quot}
sh_quote_list = $(foreach _v,$(strip ${1}),${chr.quot}$(subst ${chr.quot},${chr.quot}\'${chr.quot},${_v})${chr.quot})
#--------------------------------------------------------------------------------
# Configuration
#--------------------------------------------------------------------------------
REPO_DIR := ${this_mk.dir}
INSTALL_DIR := ${this_mk.dir}/out/current
ENABLE_ASAN ?= 0
ifneq (${CC},)
build_config += CC:=${CC}
endif
ifneq (${CXX},)
build_config += CXX:=${CXX}
endif
ifneq (${LD},)
build_config += LD:=${LD}
endif
ifeq ($(strip ${ENABLE_ASAN}),1)
build_config += CFG_BUILD_TYPE=asan
endif
$(info ------------------------------------------------------------------------)
$(foreach var,REPO_DIR INSTALL_DIR ENABLE_ASAN CC CXX,\
$(info $(shell \
printf '${chr.percent}-32s = ${chr.percent}s\n' ${var} $(call sh_quote,${${var}});\
))\
)
$(info ------------------------------------------------------------------------)
#--------------------------------------------------------------------------------
.PHONY: all
all: install-plugins
#--------------------------------------------------------------------------------
# Surelog
#--------------------------------------------------------------------------------
.PHONY: clean-surelog
clean-surelog:
${MAKE} clean@surelog ${build_config}
.PHONY: build-surelog
build-surelog:
${MAKE} build@surelog ${build_config}
.PHONY: install-surelog
install-surelog:
${MAKE} install@surelog ${build_config}
#--------------------------------------------------------------------------------
# Synlig
#--------------------------------------------------------------------------------
.PHONY: clean-synlig
clean-synlig:
${MAKE} clean@synlig ${build_config}
.PHONY: build-synlig
build-synlig:
${MAKE} build@synlig ${build_config}
.PHONY: install-synlig
install-synlig:
${MAKE} install@synlig ${build_config}
#--------------------------------------------------------------------------------
# Yosys
#--------------------------------------------------------------------------------
YOSYS_SRC_DIR := ${REPO_DIR}/third_party/yosys
.PHONY: clean-yosys
clean-yosys:
${MAKE} clean@yosys ${build_config}
.PHONY: build-yosys
build-yosys:
${MAKE} build@yosys ${build_config}
.PHONY: install-yosys
install-yosys:
${MAKE} install@yosys ${build_config}
#--------------------------------------------------------------------------------
# Plugin
#--------------------------------------------------------------------------------
# TODO: migrate to new Makefiles
.PHONY: build-plugin
clean-plugin:
export PATH=${INSTALL_DIR}/bin:$${PATH}
${MAKE} clean@systemverilog-plugin ${build_config}
.PHONY: build-plugin
build-plugin:
export PATH=${INSTALL_DIR}/bin:$${PATH}
${MAKE} build@systemverilog-plugin ${build_config}
.PHONY: install-plugin
install-plugin:
export PATH=${INSTALL_DIR}/bin:$${PATH}
${MAKE} install@systemverilog-plugin ${build_config}
# For backwards compatibility
.PHONY: clean-plugins
clean-plugins: clean-plugin
.PHONY: build-plugins
build-plugins: build-plugin
.PHONY: install-plugins
install-plugins: install-plugin