forked from westerndigitalcorporation/swerv-ISS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile.wdc
88 lines (63 loc) · 2.43 KB
/
GNUmakefile.wdc
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
# Path to the source files.
VPATH := .
# We use boost 1.67.
# Set the BOOST_ROOT environment variable to point to the base install
# location of the Boost Libraries
BOOST_ROOT := /wdc/apps/utilities/boost-1.67
BOOST_DIR := $(BOOST_ROOT)
# For Various Installation types of Boost Library
BOOST_INC := $(BOOST_DIR) $(BOOST_DIR)/include
# These boost libraries must be compiled with c++14 or later.
BOOST_LIB_DIR := $(BOOST_DIR)/stage/lib $(BOOST_DIR)/lib
# Specify only the basename of the Boost libraries
BOOST_LIBS := boost_program_options
# Add External Library location paths here
LINK_DIRS := $(addprefix -L,$(BOOST_LIB_DIR))
# Generating the Linker options for dependent libraries
LINK_LIBS := $(addprefix -l:lib, $(addsuffix .a, $(BOOST_LIBS))) -lpthread \
-lz -lstdc++fs
# For out of dbg/opt build
RM := rm -rf
# Optimization flags. Use -g for debug.
OFLAGS := -O3 -g
# Command to compile .cpp files.
override CXXFLAGS += -MMD -MP -mfma -std=c++17 $(OFLAGS) -pedantic -Wall -Wextra
# Pre-processor flags
override CPPFLAGS += $(addprefix -I,$(BOOST_INC)) -I$(VPATH)
# Compile optimized code in opt directory.
opt:
mkdir -p opt
$(MAKE) -C opt -f ../GNUmakefile.wdc VPATH=.. whisper
# Compile debug code in dbg directory.
dbg:
mkdir -p dbg
$(MAKE) -C dbg -f ../GNUmakefile.wdc OFLAGS='-g' VPATH=.. whisper
# Main target.
whisper: whisper.o librvcore.a
$(CXX) -o $@ $^ $(LINK_DIRS) $(LINK_LIBS)
# List of CPP source files needed for librvcore.a
RVCORE_SRCS := IntRegs.cpp CsRegs.cpp FpRegs.cpp instforms.cpp Memory.cpp
RVCORE_SRCS += Hart.cpp InstEntry.cpp Triggers.cpp PerfRegs.cpp gdb.cpp
RVCORE_SRCS += HartConfig.cpp Server.cpp Interactive.cpp decode.cpp disas.cpp
RVCORE_SRCS += Syscall.cpp DecodedInst.cpp snapshot.cpp
# List of All CPP source files for the project
SRCS += $(RVCORE_SRCS) whisper.cpp
# List of all object files for the project
OBJS := $(SRCS:%.cpp=%.o)
# List of all auto-genreated dependency files.
DEPS_FILES := $(OBJS:.o=.d)
# Include Generated Dependency files if available.
-include $(DEPS_FILES)
# Object files needed for librvcore.a
RVCORE_OBJS := $(RVCORE_SRCS:%.cpp=%.o)
librvcore.a: $(RVCORE_OBJS)
$(AR) cr $@ $^
clean-dbg:
cd dbg; $(RM) whisper $(OBJS) librvcore.a $(DEPS_FILES)
clean-opt:
cd opt; $(RM) whisper $(OBJS) librvcore.a $(DEPS_FILES)
clean: clean-dbg clean-opt
@ :
help:
@echo "Possible targets: opt dbg clean clean-dbg clean-opt"
.PHONY: install clean-dbg clean-opt clean help opt dbg