-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (24 loc) · 867 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
# for compilation
CXXFLAGS = -std=c 11
INCFLAGS = -I$(SYSTEMC)/include
LDFLAGS = -L$(SYSTEMC)/lib-$(ARCH) -lsystemc
# for project
SRCS = $(wildcard src/*.cpp)
OBJS = $(patsubst %.cpp, %.o, $(SRCS))
DEPS = $(patsubst %.cpp, %.d, $(SRCS))
# phony target name
.PHONY = all debug release clean help
all: debug ## compile in debug mode by default
debug: CXXFLAGS = -g -Wall -Werror -O0
debug: main ## debug mode setup
release: CXXFLAGS = -O2
release: main ## release mode setup
main: $(OBJS)
$(CXX) $(CXXFLAGS) $(INCFLAGS) $(LDFLAGS) $^ -o main
-include $(DEPS)
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCFLAGS) $(LDFLAGS) -MMD -MP -c $<
clean: ## clean all file except for source codes
$(RM) -rv main $(OBJS) $(DEPS)
help:
@grep -E '^[a-zA-Z_-] :.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'