mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-24 15:26:43 +00:00
a79156c4d0
The daemon API is built as a Swift module called ServalDNA. The new CliContext class allows easy implementation of CLI output using Swift code. The new CliContextFile subclass is the obvious first implementation, equivalent to cli_stdio.c. The 'servaldswift' executable now uses CliContextFile to print its CLI output to standard output. The new delegated log output support constructs each log line in a buffer and prints it by calling the delegate's 'print' function at end-of-line. The 'servaldswift' executable now provides a log output delegate in Swift that simply prints to standard error, replacing log_output_console.o, which is omitted from its link.
61 lines
1.8 KiB
Makefile
61 lines
1.8 KiB
Makefile
# Makefile.in for Serval DNA Swift API
|
|
# vim: noet ts=8 sts=0 sw=8
|
|
prefix=@prefix@
|
|
exec_prefix=@exec_prefix@
|
|
bindir=@bindir@
|
|
sbindir=@sbindir@
|
|
sysconfdir=@sysconfdir@
|
|
localstatedir=@localstatedir@
|
|
srcdir=@srcdir@
|
|
abs_builddir=@abs_builddir@
|
|
|
|
SWIFT_MODULE_NAME= ServalClient
|
|
SWIFT_PACKAGE_DIR= $(srcdir)/package
|
|
SWIFT_BUILD_DIR= $(abs_builddir)/build
|
|
|
|
SWIFTC= @SWIFTC@
|
|
SWIFTCFLAGS= @SWIFTCFLAGS@
|
|
SWIFTCFLAGS+= -I $(srcdir)
|
|
|
|
SWIFT_BUILD= @SWIFT_BUILD@
|
|
SWIFT_BUILD_FLAGS= $(addprefix -Xswiftc , $(SWIFTCFLAGS))
|
|
|
|
DEFS= @DEFS@
|
|
SWIFTDEFS= $(addprefix -Xcc , $(DEFS))
|
|
|
|
.PHONY: all
|
|
all: check package swift-client-util
|
|
|
|
.PHONY: check
|
|
check: check_swiftc check_swift_build
|
|
|
|
.PHONY: check_swiftc
|
|
check_swiftc:
|
|
@if [ -z "$(SWIFTC)" ]; then echo "No swift compiler configured" >&2; exit 1; fi
|
|
@if ! $(SWIFTC) -version >/dev/null; then echo "Swift compiler not executable" >&2; exit 1; fi
|
|
|
|
.PHONY: check_swift_build
|
|
check_swift_build:
|
|
@if [ -z "$(SWIFT_BUILD)" ]; then echo "No swift package manager configured" >&2; exit 1; fi
|
|
@if ! $(SWIFT_BUILD) -h >/dev/null; then echo "Swift package manager not executable" >&2; exit 1; fi
|
|
|
|
# The Swift 3 package manager --chdir option was replaced with --package-path
|
|
# in Swift 4, so to support both, avoid the options altogether and use "cd
|
|
# package-dir && swift build" instead.
|
|
.PHONY: package
|
|
package:
|
|
mkdir -p $(SWIFT_BUILD_DIR) && \
|
|
cd $(SWIFT_PACKAGE_DIR) && \
|
|
$(SWIFT_BUILD) --build-path $(SWIFT_BUILD_DIR) $(SWIFT_BUILD_FLAGS) $(SWIFTDEFS)
|
|
|
|
$(SWIFT_BUILD_DIR)/debug/libServalClient.a: package
|
|
|
|
swift-client-util: $(srcdir)/client_util.swift $(SWIFT_BUILD_DIR)/debug/libServalClient.a
|
|
@echo SWIFT $@
|
|
@$(SWIFTC) -emit-executable $(SWIFTCFLAGS) $(SWIFTDEFS) -I $(SWIFT_BUILD_DIR)/debug -o $@ $^
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
$(RM) -r $(SWIFT_BUILD_DIR)
|
|
$(RM) swift-client-util
|