-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (41 loc) · 1.45 KB
/
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
.DEFAULT: all
.SUFFIXES:
SHELL:=/bin/bash
SRCDIR:=$(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
BLDDIR:=$(CURDIR)/bld
SOURCES=$(filter-out %/example.cpp,$(wildcard $(SRCDIR)/test/*.cpp))
OBJECTS=$(patsubst $(SRCDIR)/test/%.cpp,$(BLDDIR)/%.o,$(SOURCES))
CXXFLAGS=-std=c++14 -fprofile-arcs -ftest-coverage -I$(SRCDIR)/include
.PHONY: all
all: $(BLDDIR)/test
.PHONY: test
test: $(BLDDIR)/test
$(BLDDIR)/test
@gcov -t -o bld include/html.hpp 2>/dev/null | \
./test/gcovfilter.py -i .hpp > bld/html.hpp.gcov
$(BLDDIR)/test: $(OBJECTS)
$(LINK.cpp) $(OUTPUT_OPTION) $^ -pthread -lgtest
$(BLDDIR)/%.o: $(SRCDIR)/test/%.cpp $(SRCDIR)/include/html.hpp | $(BLDDIR)/
$(COMPILE.cpp) $(OUTPUT_OPTION) $<
$(BLDDIR)/:
@mkdir -p $(BLDDIR)
.PHONY: clean
clean:
@rm -f $(BLDDIR)/test $(OBJECTS)
@rm -rf $(BLDDIR)/networking-ts-impl-master $(BLDDIR)/example*
@rm -rf $(BLDDIR)/*.gcov $(BLDDIR)/*.gcda $(BLDDIR)/*.gcno
@rmdir $(BLDDIR)
.PHONY: lint
lint:
./test/cpplint.py \
--extensions=hpp \
--filter=-legal/copyright \
$(SRCDIR)/include/*.hpp
.PHONY: example
example: $(BLDDIR)/example
$(BLDDIR)/example: CXXFLAGS += -I$(BLDDIR)/networking-ts-impl-master/include
$(BLDDIR)/example: $(BLDDIR)/example.o
$(LINK.cpp) $(OUTPUT_OPTION) $^
$(BLDDIR)/example.o: | $(BLDDIR)/networking-ts-impl-master/
$(BLDDIR)/networking-ts-impl-master/:
@curl -sSL https://github.com/chriskohlhoff/networking-ts-impl/archive/refs/heads/master.zip | tar -xC $(BLDDIR) -f-