2017-05-26 04:48:44 +08:00
|
|
|
#
|
|
|
|
# local.mk
|
|
|
|
#
|
|
|
|
# This source file is part of the FoundationDB open source project
|
|
|
|
#
|
|
|
|
# Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
2018-02-22 02:25:11 +08:00
|
|
|
#
|
2017-05-26 04:48:44 +08:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
2018-02-22 02:25:11 +08:00
|
|
|
#
|
2017-05-26 04:48:44 +08:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2018-02-22 02:25:11 +08:00
|
|
|
#
|
2017-05-26 04:48:44 +08:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
# -*- mode: makefile; -*-
|
|
|
|
|
|
|
|
fdb_c_CFLAGS := $(fdbclient_CFLAGS)
|
|
|
|
fdb_c_LDFLAGS := $(fdbrpc_LDFLAGS)
|
2018-07-06 04:21:10 +08:00
|
|
|
fdb_c_LIBS := lib/libfdbclient.a lib/libfdbrpc.a lib/libflow.a $(FDB_TLS_LIB)
|
2018-07-04 15:25:18 +08:00
|
|
|
fdb_c_STATIC_LIBS := $(TLS_LIBS)
|
2019-05-14 14:16:58 +08:00
|
|
|
fdb_c_tests_LIBS := -Llib -lfdb_c -lstdc++
|
2017-08-01 09:08:13 +08:00
|
|
|
fdb_c_tests_HEADERS := -Ibindings/c
|
2017-05-26 04:48:44 +08:00
|
|
|
|
2018-03-21 06:43:14 +08:00
|
|
|
CLEAN_TARGETS += fdb_c_tests_clean
|
|
|
|
|
2017-05-26 04:48:44 +08:00
|
|
|
ifeq ($(PLATFORM),linux)
|
2019-02-28 07:38:45 +08:00
|
|
|
fdb_c_LDFLAGS += -Wl,--version-script=bindings/c/fdb_c.map -static-libgcc -Wl,-z,nodelete -lm -lpthread -lrt -ldl
|
2019-05-15 17:37:16 +08:00
|
|
|
# Link our custom libstdc++ statically in Ubuntu, if hacking
|
|
|
|
ifeq ("$(wildcard /etc/centos-release)", "")
|
|
|
|
ifeq ($(LIBSTDCPP_HACK),1)
|
|
|
|
fdb_c_LIBS += lib/libstdc++.a
|
|
|
|
endif
|
|
|
|
# Link stdc++ statically in Centos, if not hacking
|
|
|
|
else
|
|
|
|
fdb_c_STATIC_LIBS += -static-libstdc++
|
2019-02-28 07:39:47 +08:00
|
|
|
endif
|
2017-08-01 09:08:13 +08:00
|
|
|
fdb_c_tests_LIBS += -lpthread
|
2017-05-26 04:48:44 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(PLATFORM),osx)
|
|
|
|
fdb_c_LDFLAGS += -lc++ -Xlinker -exported_symbols_list -Xlinker bindings/c/fdb_c.symbols
|
2017-08-01 09:08:13 +08:00
|
|
|
fdb_c_tests_LIBS += -lpthread
|
2017-05-26 04:48:44 +08:00
|
|
|
|
|
|
|
lib/libfdb_c.dylib: bindings/c/fdb_c.symbols
|
|
|
|
|
|
|
|
bindings/c/fdb_c.symbols: bindings/c/foundationdb/fdb_c.h $(ALL_MAKEFILES)
|
|
|
|
@awk '{sub(/^[ \t]+/, "");} /^#/ {next;} /DLLEXPORT\ .*[^ ]\(/ {sub(/\(.*/, ""); print "_" $$NF; next;} /DLLEXPORT/ { DLLEXPORT=1; next;} DLLEXPORT==1 {sub(/\(.*/, ""); print "_" $$0; DLLEXPORT=0}' $< | sort | uniq > $@
|
|
|
|
|
|
|
|
fdb_c_clean: fdb_c_symbols_clean
|
|
|
|
|
|
|
|
fdb_c_symbols_clean:
|
|
|
|
@rm -f bindings/c/fdb_c.symbols
|
|
|
|
|
|
|
|
fdb_javac_release: lib/libfdb_c.$(DLEXT)
|
|
|
|
mkdir -p lib
|
|
|
|
rm -f lib/libfdb_c.$(java_DLEXT)-*
|
|
|
|
cp lib/libfdb_c.$(DLEXT) lib/libfdb_c.$(DLEXT)-$(VERSION_ID)
|
|
|
|
cp lib/libfdb_c.$(DLEXT)-debug lib/libfdb_c.$(DLEXT)-debug-$(VERSION_ID)
|
|
|
|
|
|
|
|
fdb_javac_release_clean:
|
|
|
|
rm -f lib/libfdb_c.$(DLEXT)-*
|
|
|
|
rm -f lib/libfdb_c.$(javac_DLEXT)-*
|
|
|
|
|
|
|
|
# OS X needs to put its java lib in packages
|
|
|
|
packages: fdb_javac_lib_package
|
|
|
|
|
|
|
|
fdb_javac_lib_package: lib/libfdb_c.dylib
|
|
|
|
mkdir -p packages
|
|
|
|
cp lib/libfdb_c.$(DLEXT) packages/libfdb_c.$(DLEXT)-$(VERSION_ID)
|
|
|
|
cp lib/libfdb_c.$(DLEXT)-debug packages/libfdb_c.$(DLEXT)-debug-$(VERSION_ID)
|
|
|
|
endif
|
|
|
|
|
|
|
|
fdb_c_GENERATED_SOURCES += bindings/c/foundationdb/fdb_c_options.g.h bindings/c/fdb_c.g.S bindings/c/fdb_c_function_pointers.g.h
|
|
|
|
|
|
|
|
bindings/c/%.g.S bindings/c/%_function_pointers.g.h: bindings/c/%.cpp bindings/c/generate_asm.py $(ALL_MAKEFILES)
|
|
|
|
@echo "Scanning $<"
|
|
|
|
@bindings/c/generate_asm.py $(PLATFORM) bindings/c/fdb_c.cpp bindings/c/fdb_c.g.S bindings/c/fdb_c_function_pointers.g.h
|
|
|
|
|
|
|
|
.PRECIOUS: bindings/c/fdb_c_function_pointers.g.h
|
|
|
|
|
|
|
|
fdb_c_BUILD_SOURCES += bindings/c/fdb_c.g.S
|
|
|
|
|
|
|
|
bindings/c/foundationdb/fdb_c_options.g.h: bin/vexillographer.exe fdbclient/vexillographer/fdb.options $(ALL_MAKEFILES)
|
|
|
|
@echo "Building $@"
|
|
|
|
@$(MONO) bin/vexillographer.exe fdbclient/vexillographer/fdb.options c $@
|
2017-08-01 09:08:13 +08:00
|
|
|
|
|
|
|
bin/fdb_c_performance_test: bindings/c/test/performance_test.c bindings/c/test/test.h fdb_c
|
|
|
|
@echo "Compiling fdb_c_performance_test"
|
2019-09-12 00:16:20 +08:00
|
|
|
@$(CC) $(CFLAGS) $(fdb_c_tests_HEADERS) -o $@ -c bindings/c/test/performance_test.c
|
2017-08-01 09:08:13 +08:00
|
|
|
|
|
|
|
bin/fdb_c_ryw_benchmark: bindings/c/test/ryw_benchmark.c bindings/c/test/test.h fdb_c
|
|
|
|
@echo "Compiling fdb_c_ryw_benchmark"
|
2019-09-12 00:16:20 +08:00
|
|
|
@$(CC) $(CFLAGS) $(fdb_c_tests_HEADERS) -o $@ -c bindings/c/test/ryw_benchmark.c
|
2017-08-01 09:08:13 +08:00
|
|
|
|
|
|
|
packages/fdb-c-tests-$(VERSION)-$(PLATFORM).tar.gz: bin/fdb_c_performance_test bin/fdb_c_ryw_benchmark
|
|
|
|
@echo "Packaging $@"
|
|
|
|
@rm -rf packages/fdb-c-tests-$(VERSION)-$(PLATFORM)
|
|
|
|
@mkdir -p packages/fdb-c-tests-$(VERSION)-$(PLATFORM)/bin
|
|
|
|
@cp bin/fdb_c_performance_test packages/fdb-c-tests-$(VERSION)-$(PLATFORM)/bin
|
|
|
|
@cp bin/fdb_c_ryw_benchmark packages/fdb-c-tests-$(VERSION)-$(PLATFORM)/bin
|
|
|
|
@tar -C packages -czvf $@ fdb-c-tests-$(VERSION)-$(PLATFORM) > /dev/null
|
|
|
|
@rm -rf packages/fdb-c-tests-$(VERSION)-$(PLATFORM)
|
|
|
|
|
|
|
|
fdb_c_tests: packages/fdb-c-tests-$(VERSION)-$(PLATFORM).tar.gz
|
|
|
|
|
2018-03-21 06:43:14 +08:00
|
|
|
fdb_c_tests_clean:
|
|
|
|
@rm -f packages/fdb-c-tests-$(VERSION)-$(PLATFORM).tar.gz
|