-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
53 lines (44 loc) · 1009 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#
# builds by default in release mode
# call with mode=debug to build in debug mode
#
CXX = g++
CXXFLAGS = -Wall -Wextra -Weffc++ -Wshadow #-Wconversion
LDFLAGS = -lrt -static
ifeq ($(mode),debug)
CXXFLAGS += -O1 -g
else
CXXFLAGS += -Os -DNDEBUG
endif
SRCS=audria.cpp ProcReader.cpp ProcCache.cpp TimeSpec.cpp helper.cpp
SRCSTEST=TimeSpecTest.cpp TimeSpec.cpp
OBJS=$(SRCS:.cpp=.o)
OBJSTEST=$(SRCSTEST:.cpp=.o)
.PHONY: all
all: info audria tests
# info message in which mode to build
info:
ifeq ($(mode),debug)
@echo "building in DEBUG mode\n"
else
@echo "building in RELEASE mode\n"
endif
# our project
audria: $(OBJS)
$(CXX) $(OBJS) $(CXXFLAGS) $(LDFLAGS) -o $@
ifeq ($(mode),release)
strip $@
endif
# tests, don't build in release mode
tests: $(OBJSTEST)
ifeq ($(mode),debug)
$(CXX) $(OBJSTEST) $(CXXFLAGS) -g $(LDFLAGS) -o $@
endif
audria.o: audria.h
ProcReader.o: ProcReader.h
ProcCache.o: ProcCache.h
TimeSpec.o: TimeSpec.h
helper.o: helper.h
.PHONY: clean
clean:
rm -f *.o audria tests