-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
113 lines (93 loc) · 3.78 KB
/
Makefile.in
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
106
107
108
109
110
111
112
113
#
# Custom makefile to build the library for the monetdb operator
# Note this only builds the library, you will still need to link monetdb, e.g. :
# ln -s build/libgraph.so <monetdb_build>/lib/monetdb5/lib_graph.so
# ln -s mal/graph.mal <monetdb_build>/lib/monetdb5
# ln -s mal/autoload.mal <monetdb_build>/lib/monetdb5/autoload/50_graph.mal
#
# Current position
srcdir := @srcdir@
VPATH := @srcdir@
top_srcdir := @top_srcdir@
# Compiler settings
include @top_builddir@/common.mk
# FIXME: temporary flag
# Configuration flag, set GRAPHinterjoinlist_SORT to sort the input candidates inside the function
# graph.intersect_join_lists. If unset, the codegen must ensure that the candidates are already sorted
ALL_CFLAGS += -DGRAPHinterjoinlist_SORT
# List of the sources to compile
sources := \
bat_handle.cpp \
configuration.cpp \
debug.cpp \
errorhandling.cpp \
graph_descriptor.cpp \
joiner.cpp \
miscellaneous.c \
parse_request.cpp \
prepare.cpp \
preprocess.c \
query.cpp \
spfw.cpp \
algorithm/sequential/dijkstra/dijkstra.cpp \
third-party/tinyxml2.cpp
# Name of the produces library
library := libgraph.so
# Helper variables
makedepend_c = @$(CC) -MM $(ALL_CFLAGS) -MP -MT $@ -MF $(basename $@).d $<
makedepend_cxx = @$(CXX) -MM $(ALL_CXXFLAGS) -MP -MT $@ -MF $(basename $@).d $<
objectdirs := $(patsubst %./, %, $(sort $(addprefix ${objectdir}/, $(dir ${sources}))))
objects_c := $(addprefix ${objectdir}/, $(patsubst %.c, %.o, $(filter %.c, ${sources})))
objects_cxx := $(addprefix ${objectdir}/, $(patsubst %.cpp, %.o, $(filter %.cpp, ${sources})))
objects := ${objects_c} ${objects_cxx}
.DEFAULT_GOAL = all
.PHONY: all clean
all: ${builddir}/${library}
# Library to build
${builddir}/${library} : ${objects} | ${builddir}
${CXX} -shared $^ ${LDFLAGS} -o $@
# According to https://www.gnu.org/software/make/manual/html_node/Pattern-Match.html#Pattern-Match
# I would have expected that the rules:
# 1) ${objects} : ${objectdir}/%.o : src/%.c
# 2) ${objects} : ${objectdir}/%.o : src/%.cpp
# would have discriminated C++ and C source files. Instead it coalesces the two rules together, e.g.
# build/objects/preprocess.o: src/preprocess.cpp src/preprocess.c
# Objects from C files
${objects_c} : ${objectdir}/%.o : src/%.c | ${objectdirs}
${makedepend_c}
${CC} -c ${ALL_CFLAGS} $< -o $@
# Objects from C++ files
${objects_cxx} : ${objectdir}/%.o : src/%.cpp | ${objectdirs}
${makedepend_cxx}
$(CXX) -c $(ALL_CXXFLAGS) $< -o $@
# Create the build directories
${builddir} ${objectdirs}:
mkdir -pv $@
# Dependencies to update the translation units if a header has been altered
-include ${objects:.o=.d}
# Explicit rule, remove the current build
clean:
rm -rf ${builddir}/${library}
rm -rf ${builddir}/${objectdir}
#############################################################################
# Installation
.PHONY: install install_dev uninstall
install_libdir := ${DESTDIR}${libdir}/monetdb5
install_autoloaddir := ${install_libdir}/autoload
install: ${builddir}/${library}
${INSTALL} -d ${install_libdir}
${INSTALL_DATA} ${builddir}/${library} ${install_libdir}/lib_graph.so
${INSTALL_DATA} ${srcdir}/mal/graph.mal ${install_libdir}
${INSTALL} -d ${install_autoloaddir}
${INSTALL_DATA} ${srcdir}/mal/autoload.mal ${install_autoloaddir}/50_graph.mal
# Similar to `install', but use symbolic links instead. It makes more convenient
# when developing the library to not have to reinstall everytime.
install_dev: ${builddir}/${library}
@mkdir -pv ${install_libdir} ${install_autoloaddir}
ln -s @abs_top_builddir@/${library} ${install_libdir}/lib_graph.so
ln -s @abs_top_srcdir@/mal/graph.mal ${install_libdir}
ln -s @abs_top_srcdir@/mal/autoload.mal ${install_autoloaddir}/50_graph.mal
uninstall:
rm -f ${install_libdir}/lib_graph.so
rm -f ${install_libdir}/graph.mal
rm -f ${install_autoloaddir}/50_graph.mal