-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmakefile.env
executable file
·436 lines (319 loc) · 10.5 KB
/
makefile.env
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# This file is part of SECONDO.
#
# Copyright (C) 2004, University in Hagen, Department of Computer Science,
# Database Systems for New Applications.
#
# SECONDO is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# SECONDO is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SECONDO; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
########################################################################
#
# SECONDO makefile.env - definition of global macro values included by
# every other makefile.
#
#######################################################################
SHELL = /bin/bash
# OS-Type
platform := $(SECONDO_PLATFORM)
ifndef platform
$(error Variable SECONDO_PLATFORM not defined. Set it to linux, linux64, android, win32 or mac_osx!)
endif
# Berkeley DB library
ifdef BERKELEY_DB_LIB
BDB_LIB := -l$(BERKELEY_DB_LIB)
else
BDB_LIB := -ldb_cxx
endif
# Secondo build directory
BUILDDIR := $(SECONDO_BUILD_DIR)
TYPEMAPLIB=$(BUILDDIR)/lib/libTypeMapper.a
TYPEMAPFLAG=-lTypeMapper
ifndef BUILDDIR
$(error Variable SECONDO_BUILD_DIR not defined. I do not know the root directory of the SECONDO source tree!)
endif
ifeq ($(platform),android)
CFLAGS += -I $(HOME)/toolchain-standalone/include
endif
ifdef BERKELEY_DB_DIR
ifndef BDB_INCLUDE_DIR
BDB_INCLUDE_DIR := $(BERKELEY_DB_DIR)/include
endif
ifndef BDB_LIB_DIR
BDB_LIB_DIR := $(BERKELEY_DB_DIR)/lib
endif
else
ifndef BDB_INCLUDE_DIR
BDB_INCLUDE_DIR := $(SECONDO_SDK)/include
endif
ifndef BDB_LIB_DIR
BDB_LIB_DIR := $(SECONDO_SDK)/lib
endif
endif
# macros for some frequently used commands
ifeq ($(platform),android)
#CC := $(HOME)/toolchain-standalone/bin/arm-linux-androideabi-gcc
CPPC := $(HOME)/toolchain-standalone/bin/arm-linux-androideabi-g++
LD := $(HOME)/toolchain-standalone/bin/arm-linux-androideabi-ld
AR := $(HOME)/toolchain-standalone/bin/arm-linux-androideabi-ar
RANLIB := $(HOME)/toolchain-standalone/bin/arm-linux-androideabi-ranlib
else
CC := gcc
CPPC := g++
LD := gcc
AR := ar
RANLIB := ranlib
endif
ifdef SECONDO_CC
CC := $(SECONDO_CC)
endif
ifdef SECONDO_CPP
CPPC := $(SECONDO_CPP)
endif
ifdef SECONDO_AR
AR := $(SECONDO_AR)
endif
ifdef SECONDO_LD
LD := $(SECONDO_LD)
endif
ifdef SECONDO_RANLIB
RANLIB := $(SECONDO_RANLIB)
endif
CP := cp
RM := rm -f
RC := windres
ifndef SECONDO_LEX
LEX := flex
else
LEX := $(SECONDO_LEX)
endif
ifndef SECONDO_YACC
YACC := bison
else
YACC := $(SECONDO_YACC)
endif
# Check if optimizer should be compiled
include $(BUILDDIR)/makefile.optimizer
# set the java compiler
ifndef SECONDO_JAVAC
JAVAC := javac
else
JAVAC := $(SECONDO_JAVAC)
endif
ifndef SECONDO_JAVAH
JAVAH := javah
else
JAVAH := $(SECONDO_JAVAH)
endif
#set the standard classpath
CLASSPATH = .
# define directories
INCLUDEDIR := $(BUILDDIR)/include
LIBDIR := $(BUILDDIR)/lib
BINDIR := $(BUILDDIR)/bin
OPTDIR := $(BUILDDIR)/Optimizer
# generic rules for calculating dependency files
# and for generating objects from cpp files.
CPP_FILES = $(wildcard *.cpp)
DEP_FILES = $(patsubst %.cpp, %.dep, $(CPP_FILES))
OBJECTS = $(patsubst %.dep, %.$(OBJEXT), $(DEP_FILES))
# add directories with template classes here. Don't forget
# to add an dependency between .h and .cpp file in the file
# include.dep.
TEMPLATES := \
Tools/ListsAndTables
TEMPLATEFLAGS := $(addprefix -I$(BUILDDIR)/,$(TEMPLATES))
TEMPLATEDIRS := $(strip $(foreach dir,$(TEMPLATES), $(BUILDDIR)/$(dir):))
# directories where make searches for prerequisites
VPATH := $(INCLUDEDIR):$(TEMPLATEDIRS)$(LIBDIR):$(BINDIR)
# compilation options for the PROLOG shell
ifdef PL_INCLUDE_DIR
PLINCLUDEFLAGS := -I$(PL_INCLUDE_DIR)
else
$(info switch off optimizer)
DEFAULTCCFLAGS += -DNO_OPTIMIZER
endif
# load Platform specific definitions
include $(BUILDDIR)/makefile.$(platform)
# load options
include $(BUILDDIR)/makefile.options
# Set up directory search
ifdef BDB_INCLUDE_DIR
DEFAULTCCFLAGS += -I$(BDB_INCLUDE_DIR)
endif
ifdef SECONDO_LIB_INCLUDE_FLAGS
DEFAULTCCFLAGS += $(SECONDO_LIB_INCLUDE_FLAGS)
endif
ifdef SECONDO_ADDITIONAL_DEFAULTCCFLAGS
DEFAULTCCFLAGS += $(SECONDO_ADDITIONAL_DEFAULTCCFLAGS)
endif
#DEFAULTCCFLAGS += -std=c++17
# DEFAULTCCFLAGS += -DSM_FILE_ID
# when commenting out or in the SM_FILE_ID flag,
# the involved files should be recompiled
# otherwise it may lead to runtime errors.
# This can be done by running "make clean; make"
# note that using this flag required an installed boost library
# (developer version)
# the macro below should be used in local makefiles to
# add specific flags
DEFAULTCCFLAGS += -I$(BUILDDIR)
CCFLAGS = $(DEFAULTCCFLAGS)
# Storage Manager suffix
SMIUP:=BDB
SMILOW:=bdb
# load algebra definitions
alg := auto
HAS_ALGDEF := $(shell if [ -f $(BUILDDIR)/makefile.algebras ]; then echo "true"; fi)
ifeq ($(HAS_ALGDEF),true)
include $(BUILDDIR)/makefile.algebras
else
include $(BUILDDIR)/makefile.algebras.sample
endif
# create dependencies from include directives
%.dep: %.cpp
$(CC) -MM $(CCFLAGS) $(CPPSTDOPTION) $< -o $@
# compile object
%.o: %.cpp
$(CC) -c -o $@ $< $(CCFLAGS) $(CPPSTDOPTION)
ifdef SECONDO_ACTIVATE_ALL_ALGEBRAS
ALGEBRA_ARCHIVES := $(subst lib,,$(subst Algebra.a,,$(shell find $(BUILDDIR)/lib -name "lib*Algebra*" -printf "%f ")))
JNIALGEBRAS :=
JNIALGEBRA_DIRS :=
USE_JNI := "true"
include $(BUILDDIR)/makefile.jni
LDFLAGS += $(JNILDFLAGS)
else
# check if JNI algebras are used
ifdef JNIALGEBRAS
ALGEBRA_DIRS += $(JNI_ALGEBRA_DIRS)
ALGEBRAS += $(JNIALGEBRAS)
LDFLAGS += $(JNILDFLAGS)
USE_JNI := "true"
include $(BUILDDIR)/makefile.jni
endif
ifdef SECONDO_LIB_LD_FLAGS
LDFLAGS += $(SECONDO_LIB_LD_FLAGS)
endif
ifneq ($(platform),android)
ifndef SECONDO_HAS_RECODE
SECONDO_HAS_RECODE = $(shell $(SECONDO_BUILD_DIR)/CM-Scripts/checkRecode $(CPPC))
export SECONDO_HAS_RECODE
endif
ifeq ($(SECONDO_HAS_RECODE),true)
DEFAULTLIB += -lrecode
CCFLAGS += -DRECODE
endif
endif
ALGEBRA_ARCHIVES := $(ALGEBRA_DIRS)
endif
# define standard rule for creating configuration files by
# copying the sample files.
define cp-config-file
@([ ! -f $@ ] && (cp $< $@; echo ; echo "Make created $@ as a copy of $<")) \
|| (echo ; echo "* Warning: Example file $< is newer than $@"; sleep 2)
endef
SDB_LIBRARIES = \
sdbsys \
sdbnl \
sdbutils \
smi$(SMILOW) \
sdbsocket
# In order to make the managment of linking libraries easier two macros which are used in the linker command are defined.
# This files mainly cover all cases of linkage. Some libraries are not necessary for all applications but
# writing specific rules for every application is more complicated and error prone.
ALGBASE := $(addsuffix Algebra, $(ALGEBRA_ARCHIVES))
ALGLIBS := $(addprefix -l, $(ALGBASE))
ALGDEPS := $(addprefix -L, $(ALGEBRA_DEP_DIRS)) $(addprefix -l, $(ALGEBRA_DEPS))
ALGINCLUDES := $(addprefix -I, $(ALGEBRA_INCLUDE_DIRS))
ALGLINKFLAGS := $(ALGEBRA_LINK_FLAGS)
CCFLAGS += $(ALGINCLUDES)
# The variables below will be used in makefiles at the algebra level. The
# define the name of the library file based on the directory name of the algebra
# without sub directories. For exmaple:
#
# Algebras/Pregel will be ALGEBRA_NAME=Pregel
# Algebras/Pregel/Helper will be ALGEBRA_NAME=Pregel
# Algebras/Pregel/Helper/Helpers will be ALGEBRA_NAME=Pregel
ALGEBRA_NAME = $(shell echo -n $(CURDIR) | sed -E "s|^$(SECONDO_BUILD_DIR)/Algebras/([^/]+).*|\1|g")
LIBNAME = lib$(ALGEBRA_NAME)Algebra
LIBOBJ = $(LIBDIR)/$(LIBNAME).$(LIBEXT)
# generic rule for creating an algebra library
ifeq ($(shared),yes)
# ... as shared object
define create-lib
$(LD) $(LDFLAGS) -o $(LIBOBJ) $(TUPLEMANAGER) -L$(LIBDIR) -lStandardAlgebra -lRelationAlgebra $(SMILIB) $(SDBLIB) $(TOOLLIB) $(DEFAULTLIB)
endef
else
# ... as static library
define create-lib
$(AR) -rs $@ $^
endef
endif
# generic rule for cleaning an algebra directory
define clean-algebra
$(RM) $(DEP_FILES) $(OBJECTS) $(LIBOBJ)
endef
#rule for checking for additional algebra dependencies
define check-algebra-dependencies
@for d in $(ALGEBRA_DEPENDENCIES) ; \
do \
if [[ ! "$(ALGEBRAS)" == *$$d* ]];\
then \
echo "Algebras required by $(CURRENT_ALGEBRA) are:"; \
echo "$(ALGEBRA_DEPENDENCIES)" ;\
echo ; \
echo "In $(CURRENT_ALGEBRA) is a dependency to algebra $$d, but this algebra is not included."; \
echo "Please correct your makefile.algebras to be consistent."; \
echo ; \
exit 1; \
fi\
done;
endef
ALGLIBFILES := $(addprefix lib, $(addsuffix .$(LIBEXT),$(ALGBASE)))
ALGLIBFILES += $(JVMINIT_O_FILE)
SECLIBFILES := $(addprefix lib, $(addsuffix .$(LIBEXT),$(SDB_LIBRARIES)))
# There are some circular dependencies between the libraries.
# By putting them into groups with the linker
# options -( -la1 .. -lan -) the archives will be read multiple times. But some
# linkers don't support it.
ifneq ($(platform),mac_osx)
XOPEN := -Xlinker -\(
XCLOSE := -Xlinker -\)
endif
ifeq ($(platform),mac_osx)
MAC_LDF := -lsdbnl -lsmibdb -lsdbutils -lsdbsys
endif
SECLIBS_ALG := $(XOPEN) -lsdbsys $(ALGLIBS) $(ALGDEPS) $(ALGLINKFLAGS) -lsdbnl -lsmi$(SMILOW) -lsdbutils $(MAC_LDF) -lsdbsocket $(XCLOSE)
SECLIBS := $(XOPEN) -lsdbsys -lsdbnl -lsmi$(SMILOW) -lsdbutils $(MAC_LDF) -lsdbsocket $(XCLOSE)
LIB_FLAGS := -L$(LIBDIR)
ifdef BDB_LIB_DIR
LIB_FLAGS += -L$(BDB_LIB_DIR)
endif
ifdef SECONDO_LIBFLAGS
LIB_FLAGS += $(SECONDO_LIBFLAGS)
endif
LD_LINK_LIBS_ALG := $(SECONDO_LDFLAGS) $(LIB_FLAGS) $(SECLIBS_ALG) $(BDB_LIB) $(DEFAULTLIB) $(JNILINKOPTS) $(TYPEMAPFLAG)
LD_LINK_LIBS := $(SECONDO_LDFLAGS) $(LIB_FLAGS) $(SECLIBS) $(BDB_LIB) $(DEFAULTLIB) $(TYPEMAPFLAG)
ifndef ALL_ALGEBRA_DIRS
ALL_ALGEBRA_DIRS := $(shell find $(BUILDDIR)/Algebras -maxdepth 1 -type d $(EXCLUDE_ALGEBRA_DIRS) ! -name "Algebras" ! -name "Management" -printf "%f ")
export ALL_ALGEBRA_DIRS
endif
ifndef ALL_ALGEBRA_DIR_INCLUDE_FLAGS
ALL_ALGEBRA_DIR_INCLUDE_FLAGS := $(shell find $(BUILDDIR)/Algebras -maxdepth 1 -type d $(EXCLUDE_ALGEBRA_DIRS) ! -name "Algebras" ! -name "Management" -printf "-I%p ")
export ALL_ALGEBRA_DIR_INCLUDE_FLAGS
endif
ifndef SPECFILES
SPECFILES := $(shell find $(BUILDDIR)/Algebras -maxdepth 2 -mindepth 2 -type f -iname "*.spec" -printf "%p ")
export SPECFILES
endif