diff --git a/GNUmakefile b/GNUmakefile index 7427b7d..ce1e81e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -12,6 +12,7 @@ RANLIB := ranlib CFLAGS += -pipe -Wall USE_SSL ?= NO USE_BIGENDIAN ?= AUTO +USE_PLUGINS ?= YES BITS ?= AUTO SILENT ?= YES TERSE ?= NO @@ -42,6 +43,7 @@ UHUB_PREFIX ?= c:/uhub/ CFLAGS += -mno-cygwin LDFLAGS += -mno-cygwin BIN_EXT ?= .exe +USE_PLUGINS := NO else DESTDIR ?= / UHUB_CONF_DIR ?= $(DESTDIR)/etc/uhub @@ -118,6 +120,12 @@ CFLAGS += -DSSL_SUPPORT LDLIBS += -lssl endif +ifeq ($(USE_PLUGINS),YES) +CFLAGS += -DPLUGIN_SUPPORT +LDLIBS += -ldl +endif + + GIT_VERSION=$(shell git describe --tags 2>/dev/null || echo "") GIT_REVISION=$(shell git show --abbrev-commit 2>/dev/null | head -n 1 | cut -f 2 -d " " || echo "") OLD_REVISION=$(shell grep GIT_REVISION revision.h 2>/dev/null | cut -f 3 -d " " | tr -d "\"") @@ -138,6 +146,7 @@ libuhub_SOURCES := \ src/core/route.c \ src/core/user.c \ src/core/usermanager.c \ + src/core/pluginloader.c \ src/network/backend.c \ src/network/connection.c \ src/network/epoll.c \ @@ -183,6 +192,10 @@ autotest_SOURCES := \ autotest_OBJECTS = autotest.o +plugin_example_SOURCES := src/plugins/mod_example.c +plugin_example_TARGET := $(plugin_example_SOURCES:.c=.so) + + # Source to objects libuhub_OBJECTS := $(libuhub_SOURCES:.c=.o) libadc_client_OBJECTS := $(libadc_client_SOURCES:.c=.o) @@ -193,14 +206,23 @@ adcrush_OBJECTS := $(adcrush_SOURCES:.c=.o) admin_OBJECTS := $(admin_SOURCES:.c=.o) all_OBJECTS := $(libuhub_OBJECTS) $(uhub_OBJECTS) $(adcrush_OBJECTS) $(autotest_OBJECTS) $(admin_OBJECTS) $(libadc_common_OBJECTS) $(libadc_client_OBJECTS) +all_plugins := $(plugin_example_TARGET) uhub_BINARY=uhub$(BIN_EXT) adcrush_BINARY=adcrush$(BIN_EXT) admin_BINARY=uhub-admin$(BIN_EXT) autotest_BINARY=autotest/test$(BIN_EXT) +ifeq ($(USE_PLUGINS),YES) +all_OBJECTS += $(plugins) +endif + + .PHONY: revision.h.tmp +%.so: %.c + $(MSG_CC) $(CC) -shared -fPIC -o $@ $< $(CFLAGS) + %.o: %.c version.h revision.h $(MSG_CC) $(CC) -c $(CFLAGS) -o $@ $< diff --git a/src/core/config.xml b/src/core/config.xml index 2b8b0b8..b8066ea 100644 --- a/src/core/config.xml +++ b/src/core/config.xml @@ -490,6 +490,19 @@ ]]> + +