forked from Buanderie/blackbird
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (47 loc) · 1.2 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
# Blackbird Bitcoin Arbitrage Makefile
override INC_DIR += -I ./src -I ./extern/sqlite3/include
override LIB_DIR += -L .
CFLAGS := -std=c99
CXXFLAGS := -Wall -pedantic -std=c++11 -Wno-missing-braces
LDFLAGS :=
LDLIBS := -lsqlite3 -lcrypto -ljansson -lcurl
CC := gcc
EXEC = blackbird
SOURCES = $(wildcard src/*.cpp) $(wildcard src/*/*.cpp)
OBJECTS = $(SOURCES:.cpp=.o)
SQLITE3 = libsqlite3.a
SQLITE3CLI = sqlite3
SQLITE3LIBS :=
ifndef VERBOSE
Q := @
else
Q :=
endif
ifndef DEBUG
CFLAGS += -O2 -DNDEBUG
CXXFLAGS += -O2 -DNDEBUG
else
CFLAGS += -O0 -g
CXXFLAGS += -O0 -g
endif
ifneq ($(OS),Windows_NT)
SQLITE3LIBS += -lpthread -ldl
endif
all: $(SQLITE3CLI) $(EXEC)
$(SQLITE3CLI): shell.o $(SQLITE3)
@echo Linking $@:
$(Q)$(CC) $(LDFLAGS) $(LIB_DIR) $< -o $@ -lsqlite3 $(SQLITE3LIBS)
$(SQLITE3): sqlite3.o
@echo Archiving $@:
$(Q)$(AR) $(ARFLAGS) $@ $^
$(EXEC): $(SQLITE3) $(OBJECTS)
@echo Linking $@:
$(Q)$(CXX) $(LDFLAGS) $(LIB_DIR) $(OBJECTS) -o $@ $(LDLIBS) $(SQLITE3LIBS)
%.o: %.cpp
@echo Compiling $@:
$(Q)$(CXX) $(CXXFLAGS) $(INC_DIR) -c $< -o $@
%.o: extern/sqlite3/src/%.c
@echo Compiling $@:
$(Q)$(CC) $(CFLAGS) $(INC_DIR) -c $< -o $@
clean:
$(Q)rm -rf core $(OBJECTS)