-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile_sqlt
41 lines (31 loc) · 989 Bytes
/
Makefile_sqlt
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
# program/library target and files
TARGET = sqlite_example
SRCS = sqlite_example.cpp
# explicit path to sqlite
LIBPATH = -L/usr/lib
INCLUDES = -I/usr/include
# compiler path and flags
CC = /opt/gcc/bin/g++
CFLAGS = -std=c++1y -Wall -Wno-unused -Wno-sequence-point -Wno-parentheses -c -ggdb3 -m64 -pthread -DSYB_LP64 -D_REENTRANT
SYSLIBS = -Wl,-Bdynamic -ldl -lpthread -lnsl -lm
LIBS = -Bstatic -lsqlite3 $(LIBPATH) $(SYSLIBS)
# make env setup
OBJDIR = obj
OBJECTS = $(SRCS:.cpp=.o)
FPOBJS = $(addprefix $(OBJDIR)/, $(SRCS:.cpp=.o))
vpath %.o $(OBJDIR)
# compilation rules
all: prep $(TARGET)
prep:
rm -f make.log
test -d $(OBJDIR) || mkdir $(OBJDIR)
.cpp.o:
$(CC) $(CFLAGS) $(INCLUDES) $< -o $(OBJDIR)/$(*).o 2>&1 | tee make.log
$(TARGET): $(OBJECTS)
$(CC) -o $(TARGET) $(FPOBJS) $(LIBS) 2>&1 | tee make.log
clean:
rm -f $(TARGET) $(OBJDIR)/*
depend:
rm -f make.dep
touch make.dep
$(CC) $(CFLAGS) -MMD $(INCLUDES) $(SRCS) 2>&1 | tee -a make.log