-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
43 lines (33 loc) · 1000 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
cxxflags = $(CPPFLAGS) $(CXXFLAGS) -I. \
-Wall -Wextra -Werror -std=c++11 -fPIC
ldflags = $(LDFLAGS)
sources = \
Grinder/EventLoop.cpp \
Grinder/GenericSignalSource.cpp \
Grinder/SignalSource.cpp \
Grinder/TimeoutSource.cpp \
Grinder/Linux/SignalFD.cpp \
Grinder/Linux/TimerFD.cpp
objects = $(sources:.cpp=.o)
ifeq ($(V),1)
VCXX = $(CXX) -c
VCXXLD = $(CXX)
VDEPS = $(CXX) -MM
else
VCXX = @echo " COMPILE $@" && $(CXX) -c
VCXXLD = @echo " LINK $@" && $(CXX)
VDEPS = @echo " DEPENDS $@" && $(CXX) -MM
endif
all: GrinderTest
GrinderTest: libgrinder.so main.cpp
$(VCXXLD) $(strip $(cxxflags) -o $@ main.cpp $(ldflags) -L. -lgrinder)
libgrinder.so: $(objects)
$(VCXXLD) $(strip -shared $(cxxflags) -o $@ $(objects) $(ldflags))
.cpp.o:
$(VCXX) $(strip $(cxxflags) -o $@ $<)
-include Makefile.deps
Makefile.deps: $(sources) main.cpp
$(VDEPS) $(strip $(cxxflags) $(sources) main.cpp > $@)
clean:
$(RM) *.o Grinder/*.o Grinder/Linux/*.o *.so GrinderTest
.PHONY: all clean