-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (53 loc) · 2.28 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# based on makefile from proseminar
CXX=g++
LD=g++
BUILDDIR=src/bin
OBJDIR=$(BUILDDIR)/intermediate
CXXFLAGS=-std=c++17 -Wall -pedantic -Wextra -O3
LDFLAGS=-lsqlite3 -lcrypto -lz -lstdc++fs
FILES= \
$(OBJDIR)/Filesystem/File.o $(OBJDIR)/Filesystem/Directory.o \
$(OBJDIR)/Backup/BackupJob.o $(OBJDIR)/Backup/BackupPlan.o $(OBJDIR)/Backup/TimedBackupJob.o \
$(OBJDIR)/Backup/SQLiteConfigProvider.o $(OBJDIR)/Filesystem/FilesystemUtils.o \
$(OBJDIR)/Filesystem/FilesystemChunkStorageProvider.o $(OBJDIR)/Filesystem/CompressedFilesystemChunkStorageProvider.o \
$(OBJDIR)/UI/UserInterface.o $(OBJDIR)/UI/TerminalUserInterface.o \
$(OBJDIR)/Filesystem/TimeDirectoryComparator.o $(OBJDIR)/Iterators/DirectoryDiffIterator.o \
$(OBJDIR)/Iterators/BackupPlanIterator.o $(OBJDIR)/Iterators/DirectoryIterator.o $(OBJDIR)/Filesystem/FileChunker.o \
$(OBJDIR)/Backup/Chunk.o $(OBJDIR)/Backup/ChunkList.o $(OBJDIR)/Iterators/ChunkListIterator.o \
$(OBJDIR)/Backup/SQLiteBackupIndexProvider.o $(OBJDIR)/Backup/Snapshot.o \
$(OBJDIR)/Backup/SnapshotList.o $(OBJDIR)/Iterators/SnapshotListIterator.o $(OBJDIR)/Backup/TimeUtils.o
.PHONY: all clean run doc prepare test debug debug-noasan backwither-testbench
all: compile doc
debug: CXXFLAGS += -fsanitize=address -g
debug: LDFLAGS := -lasan $(LDFLAGS) # AddressSanitizer needs to be linked first
test: CXXFLAGS += -fsanitize=address -g
test: LDFLAGS := -lasan $(LDFLAGS)
debug-noasan: CXXFLAGS += -g
doc:
doxygen
debug: prepare backwither
debug-noasan: prepare backwither
compile: prepare backwither
cp src/bin/backwither kostada2
# force non-parellel folder creation
prepare:
mkdir -p $(BUILDDIR) > /dev/null 2>&1; \
mkdir -p $(OBJDIR) > /dev/null 2>&1; \
mkdir -p $(OBJDIR)/Iterators > /dev/null 2>&1; \
mkdir -p $(OBJDIR)/UI > /dev/null 2>&1; \
mkdir -p $(OBJDIR)/Backup > /dev/null 2>&1; \
mkdir -p $(OBJDIR)/Filesystem > /dev/null 2>&1
test: prepare backwither-testbench
src/bin/test
backwither-testbench: $(FILES)
$(CXX) $(CXXFLAGS) -c -o $(OBJDIR)/testbench.o src/tests/testbench.cpp
$(LD) -o src/bin/test $^ $(OBJDIR)/testbench.o $(LDFLAGS)
backwither: $(FILES) $(OBJDIR)/main.o
$(LD) -o src/bin/$@ $^ $(LDFLAGS)
clean:
rm -rf $(BUILDDIR)
rm -rf src/cmake-build-debug
rm -f kostada2
rm -rf doc
$(OBJDIR)/%o: src/%cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<