-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (31 loc) · 873 Bytes
/
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
CXX = g++-13
CC := $(CXX)
TARGET := sc_main
LDFLAGS := -L /opt/systemc/lib-arm
LDLIBS := -l systemc -lm
CPPFLAGS := -std=c++11 -I /opt/systemc/include
# SRC_DIR := .../src
OBJ_DIR := .
# SRC_FILES := $(wildcard $(SRC_DIR)/*.cpp)
# OBJ_FILES := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES))
# $(wildcard *.cpp) $(wildcard */*.cpp): get all .cpp files from the current directory and dir "/xxx/xxx/"
SRCS = $(wildcard *.cpp)
SRCS += $(wildcard **/*.cpp)
# $(patsubst %.cpp,%.o,$(SRCS)): substitute all ".cpp" file name strings to ".o" file name strings
OBJS := $(patsubst %.cpp,%.o,$(SRCS))
.PHONY:all
all: clean build rm_o run
.PHONY: build
build: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^
%.o: %.cpp
$(CC) $(CPPFLAGS) -o $@ -c $<
.PHONY: run
run: sc_main
./sc_main > out.txt
clean:
rm -rf $(TARGET)
rm -rf *.o
rm_o:
rm -rf *.o