Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (46 loc) · 1.42 KB
/
Copy pathMakefile
File metadata and controls
64 lines (46 loc) · 1.42 KB
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
58
59
60
61
62
63
CC=g++
DEBUG= -ggdb3 -g -O0
OPT= -O3
CPPSRC= \
main.cpp \
compression.cpp
TARGET=compress
SRCDIR=src
OBJDIR=obj
INSTALLDIR=install
TESTDIR=build
TEST_ROWS?=5000
OBJS=$(addprefix $(OBJDIR)/, $(CPPSRC:.cpp=.o))
CPPFLAGS=
ifndef config
config=debug
endif
ifeq ($(config),debug)
CPPFLAGS += $(DEBUG)
endif
ifeq ($(config),release)
CPPFLAGS += $(OPT)
endif
CPPFLAGS += -Wall -std=c++17 -pthread -fno-omit-frame-pointer -Isrc
LFLAGS = -lstdc++ -lpthread
all: $(TARGET)
@echo "Building $(TARGET)"
$(TARGET): $(OBJS) | $(INSTALLDIR)
@echo "Linking $^"
$(CC) $^ -o $(INSTALLDIR)/$@ $(LFLAGS)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp $(SRCDIR)/compression.h | $(OBJDIR)
@echo "Compiling $<"
$(CC) $(CPPFLAGS) -c $< -o $@
$(OBJDIR) $(INSTALLDIR) $(TESTDIR):
mkdir -p $@
# Round-trip test on synthetic data: generate -> compress -> decompress -> byte compare
test: $(TARGET) | $(TESTDIR)
python3 tools/gen_ticks.py --rows $(TEST_ROWS) --seed 1 > $(TESTDIR)/synthetic.csv
$(INSTALLDIR)/$(TARGET) -c $(TESTDIR)/synthetic.csv $(TESTDIR)/synthetic.tp
$(INSTALLDIR)/$(TARGET) -d $(TESTDIR)/synthetic.tp $(TESTDIR)/roundtrip.csv
cmp $(TESTDIR)/synthetic.csv $(TESTDIR)/roundtrip.csv
@echo "Round-trip OK: $$(wc -l < $(TESTDIR)/synthetic.csv) rows, $$(stat -c %s $(TESTDIR)/synthetic.csv) -> $$(stat -c %s $(TESTDIR)/synthetic.tp) bytes"
clean:
@echo "Cleaning"
rm -rf $(INSTALLDIR)/$(TARGET) $(OBJDIR)/*.o $(TESTDIR)
.PHONY: all test clean