-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
86 lines (67 loc) · 2.38 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#-------------------------
# Cplex and other libraries
# ------------------------
SYSTEM = x86-64_linux
LIBFORMAT = static_pic
CPLEXDIR = /opt/ibm/ILOG/CPLEX_Studio126/cplex
CONCERTDIR = /opt/ibm/ILOG/CPLEX_Studio126/concert
CPLEXBINDIR = $(CPLEXDIR)/bin/$(BINDIST)
CPLEXLIBDIR = $(CPLEXDIR)/lib/$(SYSTEM)/$(LIBFORMAT)
CONCERTLIBDIR = $(CONCERTDIR)/lib/$(SYSTEM)/$(LIBFORMAT)
CCLNDIRS = -L$(CPLEXLIBDIR) -L$(CONCERTLIBDIR)
CCLNFLAGS = -lconcert -lilocplex -lcplex -lm -pthread -lemon
CONCERTINCDIR = $(CONCERTDIR)/include
CPLEXINCDIR = $(CPLEXDIR)/include
CPLEXINC = -I$(CPLEXINCDIR) -I$(CONCERTINCDIR)
#-----------------------------------------------------------------------------
# Main Program
#-----------------------------------------------------------------------------
MAINNAME = elpp
MAINOBJ = main.o elpp.o separation.o graph.o
MAIN = $(MAINNAME)
MAINFILE = $(BINDIR)/$(MAIN)
MAINSHORTLINK = $(BINDIR)/$(MAINNAME)
MAINOBJFILES = $(addprefix $(OBJDIR)/,$(MAINOBJ))
USRCXXFLAGS = -std=c++0x -DIL_STD
#^C++11 ^Required by Cplex
OBJDIR = obj
BINOBJDIR = $(OBJDIR)/bin
SRCDIR = src
BINDIR = bin
CXX = g++
CXX_o = -o # the trailing space is important
LINKCXX = g++
LINKCXX_o = -o # the trailing space is important
FLAGS = -I$(SRCDIR) -DNDEBUG -DROUNDING_FE $(USRCXXFLAGS)
OFLAGS = -O3
CXXFLAGS += -m64
LDFLAGS += -m64
#-----------------------------------------------------------------------------
# Rules
#-----------------------------------------------------------------------------
ifeq ($(VERBOSE),false)
.SILENT: $(MAINFILE) $(MAINOBJFILES) $(MAINSHORTLINK)
endif
.PHONY: all
all: $(MAINFILE) $(MAINSHORTLINK)
$(OBJDIR):
@-mkdir -p $(OBJDIR)
$(BINDIR):
@-mkdir -p $(BINDIR)
.PHONY: clean
clean: $(OBJDIR)
ifneq ($(OBJDIR),)
-rm -f $(OBJDIR)/*.o
-rmdir $(OBJDIR)
endif
-rm -f $(MAINFILE)
$(MAINFILE): $(BINDIR) $(OBJDIR) $(LPILIBFILE) $(NLPILIBFILE) $(MAINOBJFILES)
@echo "-> linking $@"
$(LINKCXX) $(CPLEXINC) $(MAINOBJFILES)\
$(CCLNDIRS) \
$(OFLAGS) $(CCLNFLAGS) \
$(LDFLAGS) $(LINKCXX_o)$@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
@echo "-> compiling $@"
$(CXX) $(FLAGS) $(CPLEXINC) $(OFLAGS) $(BINOFLAGS) $(CXXFLAGS) -c $< $(CXX_o)$@
#---- EOF --------------------------------------------------------------------