From bd4273050c1ca97619a78459d6f43c4587197f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilja=20Karta=C5=A1ov?= Date: Fri, 5 Apr 2019 16:18:13 +0200 Subject: [PATCH] Cleanup and add visibility to missing functions --- .gitignore | 1 - Makefile | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++ project.mk | 4 +-- src/client.c | 2 -- src/server.c | 7 +++-- 5 files changed, 91 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 3e3ff88..5289e73 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ demo/* bin/* obj/* webstuff-* -Makefile tmp tmp/* *.tar.gz diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7dd28d6 --- /dev/null +++ b/Makefile @@ -0,0 +1,84 @@ +# +# Makefile +# Ilja Kartašov, 2019-03-02 17:32 +# +.POSIX: + +# Project directories +SRC_DIR ?= src +SDK_DIR ?= sdk +OUT_DIR ?= ./build + +# Project definition +include project.mk + +# Examples submodule +include examples.mk + +# CFLAGS + +CFLAGS := \ + $(PROJECT_INCLUDES) \ + -std=c99 \ + -pedantic \ + -Wall \ + -Wmissing-prototypes \ + -Wstrict-prototypes \ + -Wold-style-definition \ + -O2 \ + -s \ + -fvisibility=hidden \ + -DVERSION_MAJOR=$(PROJECT_VERSION_MAJOR) \ + -DVERSION_MINOR=$(PROJECT_VERSION_MINOR) \ + -DVERSION_TWEAK=$(PROJECT_VERSION_TWEAK) \ + -DVERSION_LABEL=$(PROJECT_VERSION_LABEL) \ + $(CPPFLAGS) \ + $(CFLAGS) \ + $(PROJECT_CFLAGS) \ + + +LDFLAGS := \ + $(PROJECT_LIBRARIES) \ + $(LDFLAGS) \ + $(PROJECT_LDFLAGS) \ + + +SOURCE_LIST := $(wildcard $(PROJECT_SOURCES)) +OBJECT_FILES := $(addprefix $(OUT_DIR)/o_, ${SOURCE_LIST:.c=.o}) + + +library: dirs $(OBJECT_FILES) + $(info linking target: $@) + @$(CC) -shared -o $(OUT_DIR)/lib$(PROJECT_NAME).so $(OBJECT_FILES) $(LDFLAGS) + $(info done: $@) + + +build/o_%.o: %.c + $(info compiling file: $<) + @$(CC) $(CFLAGS) -fpic -c $< -o $@ + +dirs: + $(info preparing: build folders) + @mkdir -p $(OUT_DIR)/o_$(SRC_DIR) + @mkdir -p $(OUT_DIR)/o_$(SDK_DIR) + + +clean: + $(info cleaning: build files) + @rm -Rf $(OUT_DIR) + @rm -Rf ./vgcore.* + +doc: + doxygen doc/api-reference.conf + +all: library examples doc + +default: library +.PHONY: all dirs clean doc install + +install: library + cp $(OUT_DIR)/lib$(PROJECT_NAME).so $(PREFIX)/lib64/ + cp -R include/aisl $(PREFIX)/include/ + +# vim:ft=make +# diff --git a/project.mk b/project.mk index 4e31450..2a723f8 100644 --- a/project.mk +++ b/project.mk @@ -3,7 +3,7 @@ # Löwenware Makefile Config, 2019-03-02 17:35 # -PREFIX = /usr/ +PREFIX = /usr/local PKG_CONFIG = pkg-config PROJECT_NAME = aisl @@ -52,7 +52,7 @@ PROJECT_LIBRARIES = \ # flags PROJECT_CFLAGS = -D_POSIX_C_SOURCE=200809L PROJECT_CFLAGS += -DDEBUG -PROJECT_CFLAGS += -DAISL_WITHOUT_SSL +#PROJECT_CFLAGS += -DAISL_WITHOUT_SSL #PROJECT_CFLAGS += -DAISL_WITHOUT_STRINGIFIERS diff --git a/src/client.c b/src/client.c index 863ef37..886e48f 100644 --- a/src/client.c +++ b/src/client.c @@ -151,8 +151,6 @@ aisl_client_input(aisl_client_t client) char * data = &client->in.data[ client->in.used ]; int32_t size = client->in.size - client->in.used; - DPRINTF("Buffer: %p, %d", data, size); - #ifndef AISL_WITHOUT_SSL if (client->ssl) { diff --git a/src/server.c b/src/server.c index a5a336d..8e4e411 100644 --- a/src/server.c +++ b/src/server.c @@ -137,8 +137,6 @@ aisl_server_get_socket( aisl_server_t server ) } -/* API Level ---------------------------------------------------------------- */ - aisl_server_t aisl_server_new(aisl_cfg_srv_t const cfg_srv, aisl_t instance) { @@ -174,6 +172,10 @@ aisl_server_free(aisl_server_t server) } +/* API Level ---------------------------------------------------------------- */ + + +__attribute__ ((visibility ("default") )) void aisl_server_get_address( aisl_server_t server, struct sockaddr_in * address) { @@ -183,6 +185,7 @@ aisl_server_get_address( aisl_server_t server, struct sockaddr_in * address) #ifndef AISL_WITHOUT_SSL +__attribute__ ((visibility ("default") )) bool aisl_server_get_ssl( aisl_server_t server ) {