-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·105 lines (70 loc) · 2.3 KB
/
Makefile
File metadata and controls
executable file
·105 lines (70 loc) · 2.3 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# For home installation adjust CPLEX_DIR, ARCH, GPP, CXXFLAGS, etc.
HOSTNAME = $(shell hostname)
USERNAME = $(shell whoami)
EXEC = ./kmst -f data/g01.dat -m scf -k 5
DEBUG = 0
CPLEX_VERSION = 12.5
CPLEX_DIR = cplex
SRCDIR = src
OBJDIR = obj
# 32bit: x86, 64bit: x86-64
ARCH = x86-64
GPP = g++
CPPFLAGS = -DIL_STD \
-isystem $(CPLEX_DIR)/cplex/include \
-isystem $(CPLEX_DIR)/concert/include
CXXFLAGS += -Wall -Wno-non-virtual-dtor -pipe -std=c++0x
LDFLAGS = -L$(CPLEX_DIR)/cplex/lib/$(ARCH)_sles10_4.1/static_pic \
-L$(CPLEX_DIR)/concert/lib/$(ARCH)_sles10_4.1/static_pic
LDFLAGS += -lilocplex -lcplex -lconcert -lpthread
ifeq ($(DEBUG), 1)
CXXFLAGS += -g -p
else
CXXFLAGS += -O3
endif
STARTUP_SOURCE = $(SRCDIR)/Main.cpp
CPP_SOURCES = \
src/Instance.cpp \
src/kMST_ILP.cpp \
src/Tools.cpp \
# $< the name of the related file that caused the action.
# $* the prefix shared by target and dependent files.
# $? is the names of the changed dependents.
# $@ is the name of the file to be made.
# $^ dependencies above
# ----- object files ---------------------------------------------------------------
OBJ_FILES = $(addprefix $(OBJDIR)/, $(patsubst %.cpp,%.o, \
$(patsubst src/%, %, $(CPP_SOURCES) ) ) )
STARTUP_OBJ = $(addprefix $(OBJDIR)/, $(patsubst %.cpp,%.o, \
$(patsubst src/%, %,$(STARTUP_SOURCE) ) ) )
all: kmst
depend:
@echo
@echo "creating dependencies ..."
$(GPP) -MM $(CPPFLAGS) $(CPP_SOURCES) $(SINGLE_FILE_SOURCES) \
$(STARTUP_SOURCE) $(LD_FLAGS) \
| sed -e "s/.*:/$(OBJDIR)\/&/" > depend.in
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp $(SRCDIR)/%.h
@echo
@echo "compiling $<"
$(GPP) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
# for startup (no header file available)
$(OBJDIR)/Main.o: $(SRCDIR)/Main.cpp
@echo
@echo "compiling $<"
$(GPP) $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $<
# ----- linking --------------------------------------------------------------------
kmst: $(STARTUP_OBJ) $(OBJ_FILES)
@echo
@echo "linking ..."
@echo
$(GPP) $(CPPFLAGS) $(CXXFLAGS) -o kmst $(OBJ_FILES) $(STARTUP_OBJ) $(LDFLAGS)
# ----- debugging and profiling ----------------------------------------------------
gdb: all
gdb --args $(EXEC)
clean:
rm -rf obj/*.o kmst gmon.out
doc: all
doxygen doc/doxygen.cfg
# ------ include dependency file ---------------------------------------------------
include depend.in