File: Makefile

package info (click to toggle)
sdpb 1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,580 kB
  • sloc: cpp: 12,762; makefile: 74; xml: 44; sh: 20
file content (98 lines) | stat: -rwxr-xr-x 2,861 bytes parent folder | download
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
UNAME := $(shell uname)

################ Modify these variables ################

ifeq ($(UNAME), Darwin)
# Mac OS X Defaults, assuming Readme instructions.

GMPINCLUDEDIR   = /usr/local/include
BOOSTINCLUDEDIR = /usr/local/include/boost
LIBDIR          = /usr/local/lib

else
# If you're using Linux or Windows or a nonstandard OS X setup, modify
# these variables to point to the appropriate places.

BASEDIR := $(HOME)

# directory containing the header files 'gmp.h' and 'gmpxx.h'
GMPINCLUDEDIR   = $(BASEDIR)/include

# directory containing boost header files, e.g. 'bind.hpp', etc.
BOOSTINCLUDEDIR = $(BASEDIR)/include/boost

# directory containing library files, e.g.
#   libboost_filesystem.a,
#   libboost_filesystem.so,
#   libboost_filesystem.so.1.54.0
# as well as analogous files for 'boost_system',
# 'boost_serialization', 'boost_timer', 'boost_program_options',
# 'gmp', and 'gmpxx',
LIBDIR          = $(BASEDIR)/lib

endif

################ End of modifications ################

SOURCES = $(wildcard src/*.cpp) $(wildcard src/mpack/*.cpp)
HEADERS = $(wildcard src/*.h) $(wildcard src/mpack/*.h)
OBJECTS = $(patsubst src/%.cpp,obj/%.o,$(SOURCES))
RESULT  = sdpb

ifeq ($(SHARED_TINYXML2), 1)
LIBS = -ltinyxml2
CXXFLAGS += -D___SHARED_TINYXML2___
else
SOURCES += $(wildcard src/tinyxml2/*.cpp)
HEADERS += $(wildcard src/tinyxml2/*.h)
endif

ifdef INTEL

CXX = icpc
CXXFLAGS += -g -O2 -ipo -xhost -Wall -ansi -std=c++0x -L${LIBDIR} -Isrc/mpack -I${GMPINCLUDEDIR} -I${BOOSTINCLUDEDIR} -openmp -D___MPACK_BUILD_WITH_GMP___
LIBS += -lgmpxx -lgmp -lboost_serialization -lboost_system -lboost_filesystem -lboost_timer -lboost_program_options -lboost_chrono -lrt

else 
ifdef CLANG

CXX = clang-omp
CXXFLAGS += -g -O2 -Wall -ansi -std=c++0x -L${LIBDIR} -Isrc/mpack -I${GMPINCLUDEDIR} -I${BOOSTINCLUDEDIR} -fopenmp -D___MPACK_BUILD_WITH_GMP___
LIBS +=  -liomp5 -lgmpxx -lgmp -lboost_serialization -lboost_system -lboost_filesystem -lboost_timer -lboost_program_options -lboost_chrono -lc++

else

CXX = g++
CXXFLAGS += -g -O2 -Wall -ansi -std=c++0x -L${LIBDIR} -Isrc/mpack -I${GMPINCLUDEDIR} -I${BOOSTINCLUDEDIR} -fopenmp -D___MPACK_BUILD_WITH_GMP___
LIBS += -lgomp -lgmpxx -lgmp -lboost_serialization -lboost_system -lboost_filesystem -lboost_timer -lboost_program_options -lboost_chrono -lrt

endif
endif


.SUFFIXES: .cpp .o

$(RESULT): $(OBJECTS)
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

obj/%.o: src/%.cpp
	$(CXX) $(CXXFLAGS) -c -o $@ $<

clean:
	rm -rf obj

obj:
	@mkdir -p $@
	@mkdir -p $@/mpack
	@mkdir -p $@/tinyxml2

test:
	./sdpb -s test.xml --noFinalCheckpoint
	test -f test.out
	grep "primalObjective = 1.84026576313204924668804017173" test.out > /dev/null || \
	(echo "Test failed: primalObjective differs from 1.84026576313204924668804017173." && exit 1)

$(OBJECTS): $(HEADERS) | obj

CXXFLAGS += -MMD
-include $(OBJECTS:.o=.d)