-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
86 lines (63 loc) · 2.45 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
SELF := $(abspath $(firstword $(MAKEFILE_LIST)))
SELFDIR := $(dir $(SELF))
GUROBI_MAKEFILE ?= $(SELFDIR)/upstream/libgrbfrc/gurobi.mak
-include ${GUROBI_MAKEFILE}
CXX=c++
CXXFLAGS += -m64 -g -std=c++17 -Wall -Wextra -pedantic -fPIC #-Werror
CPPFLAGS += -Isrc -I${GUROBI_HOME}/include -I$(SELFDIR)/upstream/libgrbfrc/include
LIBGRBFRC ?= $(SELFDIR)/upstream/libgrbfrc/lib
LDPATHS += -L${GUROBI_HOME}/lib -lgurobi${GUROBI_VERSION_SUFFIX} -lgurobi_c++ -L$(LIBGRBFRC) -lgrbfrc
LDFLAGS += ${LDPATHS} -Wl,-rpath=$(LIBGRBFRC)
LDLIBS += -lpthread -lm
SRCDIR=src
SOURCES=$(wildcard $(SRCDIR)/*.cpp)
HEADERS=$(wildcard $(SRCDIR)/*.hpp)
OBJECTS=$(patsubst %.cpp, %.o, $(SOURCES))
DEPS=$(patsubst %.cpp, %.d, $(SOURCES))
BINDIR=src/bin
BIN_SOURCES=$(wildcard $(BINDIR)/*.cpp)
BINS=$(patsubst %.cpp, %, $(BIN_SOURCES))
BINDEPS=$(patsubst %.cpp, %.d, $(BIN_SOURCES))
BINOS=$(patsubst %.cpp, %.o, $(BIN_SOURCES))
clean:
rm -f $(OBJECTS) $(DEPS) $(BINOS) $(BINDEPS)
@cd $(SELFDIR)/upstream/libgrbfrc && make clean && rm -rf include
destroy: clean
rm -rf doc/doxygen/html doc/doxygen/latex bin
@cd $(SELFDIR)/upstream/libgrbfrc && make destroy
deregnet: install-python lgrbfrc all
@#
all : $(BINS)
@#
$(BINS) : % : %.o
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
@mkdir -p bin && cp $@ bin/
$(BINS) : $(OBJECTS)
$(BINDEPS) : %.d : %.cpp
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -MM $< | sed 's,.*.o:,$*.o:,g' > $@
$(BINOS): %.o : %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
lgrbfrc:
@cd $(SELFDIR)/upstream/libgrbfrc && \
make all && \
mkdir -p include/grbfrc && \
cp src/*.hpp include/grbfrc
$(DEPS): %.d : %.cpp
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -MM $< | sed 's,.*.o:,$*.o:,g' > $@
$(OBJECTS): %.o : %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
docker: docker@$(GUROBI_VERSION)
@#
docker@%:
@make destroy
@cd upstream/libgrbfrc && git submodule update --init --recursive && cd upstream/gurobi-docker && make gurobi@$*-local
@cd upstream/libgrbfrc && make docker@$*
@docker build --no-cache --build-arg GUROBI_USER=$$(pwd) --build-arg GRBFRC_GUROBI_VERSION=$* --build-arg GRBFRC_IMAGE_TAG=local -t sebwink/deregnet:local .
docs:
@cd doc/doxygen && doxygen Doxyfile
docs-open: docs
@cd doc/doxygen/html && $(BROWSER) index.html
install-python:
python3 -m pip install biomap-utils
-include $(DEPS)
-include $(BINDEPS)