-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
125 lines (90 loc) · 2.49 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
# Copyright (c) 2018-2024 embed-dsp, All Rights Reserved.
# Author: Gudmundur Bogason <[email protected]>
PACKAGE_NAME = systemc
PACKAGE_VERSION = 2.3.3
PACKAGE = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
# ==============================================================================
# Determine system.
SYSTEM = unknown
ifeq ($(findstring Linux, $(shell uname -s)), Linux)
SYSTEM = linux
endif
ifeq ($(findstring MINGW64, $(shell uname -s)), MINGW64)
SYSTEM = mingw64
endif
# Determine machine.
MACHINE = $(shell uname -m)
# ==============================================================================
# Set number of simultaneous jobs (Default 8)
ifeq ($(J),)
J = 8
endif
# System configuration.
CONFIGURE_FLAGS =
# NOTE: We use this C++ compiler flag to match the defaults used in Verilator.
CXXFLAGS = -std=gnu++17
# Configuration for linux system.
ifeq ($(SYSTEM),linux)
# Compiler.
CC = /usr/bin/gcc
CXX = /usr/bin/g++
# Installation directory.
INSTALL_DIR = /opt
endif
# Configuration for mingw64 system.
ifeq ($(SYSTEM),mingw64)
# NOTE: This is required so SystemC-SCV can find the library directory.
CONFIGURE_FLAGS += --with-arch-suffix=-mingw
# Compiler.
CC = /mingw64/bin/gcc
CXX = /mingw64/bin/g++
# Installation directory.
INSTALL_DIR = /c/opt
endif
# Architecture.
ARCH = $(SYSTEM)_$(MACHINE)
PREFIX = $(INSTALL_DIR)/$(PACKAGE_NAME)/$(ARCH)/$(PACKAGE)
# ==============================================================================
all:
@echo "ARCH = $(ARCH)"
@echo "PREFIX = $(PREFIX)"
@echo ""
@echo "## Get Source Code"
@echo "make download"
@echo ""
@echo "## Build"
@echo "make prepare"
@echo "make configure"
@echo "make compile [J=...]"
@echo ""
@echo "## Install"
@echo "[sudo] make install"
@echo ""
@echo "## Cleanup"
@echo "make clean"
@echo "make distclean"
@echo ""
.PHONY: download
download:
-mkdir src
cd src && wget -nc https://github.com/accellera-official/systemc/archive/refs/tags/$(PACKAGE_VERSION).tar.gz
.PHONY: prepare
prepare:
-mkdir build
cd build && tar zxf ../src/$(PACKAGE_VERSION).tar.gz
.PHONY: configure
configure:
cd build/$(PACKAGE) && ./configure CC=$(CC) CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) --prefix=$(PREFIX) --disable-shared --enable-silent-rules=no $(CONFIGURE_FLAGS)
.PHONY: compile
compile:
cd build/$(PACKAGE) && make -j$(J)
.PHONY: install
install:
-cd build/$(PACKAGE) && make install
.PHONY: clean
clean:
# -rm -rf build
cd build/$(PACKAGE) && make clean
.PHONY: distclean
distclean:
cd build/$(PACKAGE) && make distclean