-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (32 loc) · 929 Bytes
/
Makefile
File metadata and controls
58 lines (32 loc) · 929 Bytes
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
54
55
56
57
CXX = g++
AR = ar
CXXFLAGS = -O2 -g -Wall -fmessage-length=0 -std=c++14
SRCS = $(shell find src/ -type f -name *.cc)
OBJS = $(SRCS:.cc=.o)
LIBS =
LDFLAGS =
LDLIBS = -lboost_locale
TARGET = elephly
TEST_FLAGS = -O2 -g -Wall -fmessage-length=0 -std=c++14 -Isrc
TEST_SRCS = $(shell find tests/ -type f -name *.test.cc)
TEST_OBJS = $(filter-out src/$(TARGET).o, $(OBJS))
TEST_LDFLAGS =
TEST_LDLIBS = -lboost_unit_test_framework -lboost_locale
TESTS = $(TEST_SRCS:.test.cc=.test)
CHECKS = $(TESTS:.test=.check)
all: build build_test
build: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(LDFLAGS) $(LDLIBS) $(OBJS) $(LIBS)
run:
./$(TARGET) words.txt dict.txt
build_test: $(TESTS)
%.test: %.test.cc $(TEST_OBJS)
$(CXX) -o $@ $(TEST_FLAGS) $(TEST_LDFLAGS) $(TEST_LDLIBS) $^ $(LIBS)
%.check: %.test
$<
test: $(CHECKS)
clean:
rm -f $(OBJS) $(TARGET)
rm -f $(TESTS)
.PHONY: clean all test check