-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (49 loc) · 2.06 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
# Cplex installation folder
CPLEX = /opt/ibm/ILOG/CPLEX_Studio2211/
CPLEXDIR = $(CPLEX)/cplex/
CONCERTDIR = $(CPLEX)/concert/
# ---------------------------------------------------------------------
# Compiler selection, code optimization, debug, and warning options
# ---------------------------------------------------------------------
CCFLAGS = -O3 -m64 -Wall -Wno-ignored-attributes -g
# Debug build flags
DEBUGFLAGS = -g -O0
# ---------------------------------------------------------------------
# Link options and libraries (CPLEX)
# ---------------------------------------------------------------------
LIBFORMAT = static_pic
SYSTEM = x86-64_linux
CPLEXLIBDIR = $(CPLEXDIR)/lib/$(SYSTEM)/$(LIBFORMAT)
CONCERTLIBDIR = $(CONCERTDIR)/lib/$(SYSTEM)/$(LIBFORMAT)
CCLNFLAGS =" "
CCLNFLAGSCPLEX = -L$(CPLEXLIBDIR) -lilocplex -lcplex -L$(CONCERTLIBDIR) -lconcert -lrt -lpthread -ldl
CONCERTINCDIR = $(CONCERTDIR)/include
CPLEXINCDIR = $(CPLEXDIR)/include
CCFLAGSCPLEX = $(CCFLAGS) -I$(CPLEXINCDIR) -I$(CONCERTINCDIR) -DIL_STD -I$(INCDIR) #DIL_STD: CPLEX specific macro
# ---------------------------------------------------------------------
# Linking commands
# ---------------------------------------------------------------------
CXX = g++
SRCDIR = src
INCDIR = include
SRCS = $(wildcard $(SRCDIR)/*.cpp)
OBJS = $(SRCS:$(SRCDIR)/%.cpp=$(SRCDIR)/%.o)
OBJS_DEBUG = $(OBJS:$(SRCDIR)/%.o=$(SRCDIR)/%_debug.o)
TARGET = myprogram
# Release build rule for object files
# use DNDEBUG to remove asserts and turn off some clog debug messages
$(SRCDIR)/%.o: $(SRCDIR)/%.cpp $(INCDIR)/%.h
$(CXX) $(CCFLAGSCPLEX) -DNDEBUG -c $< -o $@
# Debug build rule for object files
$(SRCDIR)/%_debug.o: $(SRCDIR)/%.cpp $(INCDIR)/%.h
$(CXX) $(CCFLAGSCPLEX) $(DEBUGFLAGS) -c $< -o $@
# Debug build
debug: $(OBJS_DEBUG)
$(CXX) $(CCFLAGSCPLEX) $(DEBUGFLAGS) -o $(TARGET)_debug $(OBJS_DEBUG) $(CCLNFLAGSCPLEX)
# Release build
release: $(OBJS)
$(CXX) $(CCFLAGSCPLEX) -DNDEBUG -o $(TARGET) $(OBJS) $(CCLNFLAGSCPLEX)
clean: cleanobj
rm -f $(OBJS) $(TARGET) $(TARGET)_debug
cleanobj:
rm -f $(SRCDIR)/*.o