-
Notifications
You must be signed in to change notification settings - Fork 102
/
Makefile
67 lines (50 loc) · 1.76 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
##### Directories
SRCDIR = src
INCDIR = include
OBJDIR = build
DEPDIR = .deps
##### Compiler/linker options
INCL = -I $(INCDIR) -I $(INCDIR)/despot/util -I $(SRCDIR)
CXX = g++
CXXFLAGS = -O3 -c -Wall -Wno-sign-compare -fpic $(INCL)
#LDFLAGS = -O3 -Wno-sign-compare -shared
#LDFLAGS = -O3 -Wno-sign-compare -dynamiclib
LDFLAGS = -O3 -Wno-sign-compare
##### Files
VPATH = $(shell find -L $(INCDIR) $(SRCDIR) -type d \( ! -name '.*' \))
SOURCES = $(shell find -L $(SRCDIR) -name '*.cpp')
OBJS = $(addprefix $(OBJDIR)/, $(notdir $(SOURCES:.cpp=.o)))
DEPS = $(addprefix $(DEPDIR)/, $(notdir $(SOURCES:.cpp=.d)))
CPPEXAMPLE = $(addprefix examples/cpp_models/, $(shell ls examples/cpp_models))
##### Targets
.PHONY: core directory library cpp_models clean
core: directory $(DEPS) $(OBJS)
# Rule for creating directories needed for build
directory:
@mkdir -p $(OBJDIR) $(DEPDIR)
# Rules for generating dependencies
$(DEPDIR)/%.d: %.cpp
@mkdir -p $(DEPDIR); \
$(CXX) -MM $(CXXFLAGS) $< > $@; \
sed -ie 's;\(.*\)\.o:;$(OBJDIR)/\1.o $(DEPDIR)/\1.d:;g' $@
# Include generated dependencies
-include $(DEPS)
# Rules for creating object files
$(OBJDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) $< -o $@
# Rules for creating library from the object files
#library: $(OBJS)
# $(CXX) $(OBJS) $(LDFLAGS) -I $(INCDIR) -o $(OBJDIR)/libdespot.so
# Rules for compiling the executables for the cpp models in examples/cpp_models
cpp_models:
$(foreach var, $(CPPEXAMPLE), make -C $(var);)
# Rule for compiling the executable for the pomdpx model in examples/pomdpx_models
pomdpx_model:
make -C examples/pomdpx_models
# Rule for installing the library
#install:
# sudo cp -r build/libdespot.so usr/lib/
# sudo cp -r include /usr/include/despot
# Rules for repository cleaning
clean:
rm -rf $(OBJDIR) $(DEPDIR)