aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile34
-rw-r--r--plugins/log/main.c11
2 files changed, 45 insertions, 0 deletions
diff --git a/plugins/Makefile b/plugins/Makefile
new file mode 100644
index 0000000..0824f2e
--- /dev/null
+++ b/plugins/Makefile
@@ -0,0 +1,34 @@
+CC = gcc
+CFLAGS = -Wall -Wextra -std=c11 -g -fwrapv -I.. -fPIC
+
+ifeq ($(shell uname),Darwin)
+ SO_EXT = dylib
+ SO_FLAGS = -dynamiclib
+else
+ SO_EXT = so
+ SO_FLAGS = -shared
+endif
+SO_FLAGS += -fPIC
+
+TARGET = $(PLUGINNAME)/$(PLUGINNAME).$(SO_EXT)
+
+
+.PHONY: all clean remake warning
+
+all: warning $(TARGET)
+
+clean: warning
+ rm -rf $(TARGET) $(PLUGINNAME)/*.{o,dSYM}
+
+remake: clean all
+
+warning:
+ifndef PLUGINNAME
+ $(error "PLUGINNAME not set! Please run root Makefile instead.")
+endif
+
+
+.SECONDARY:
+
+$(PLUGINNAME)/%.$(SO_EXT): $(patsubst %.c,%.o,$(wildcard $(PLUGINNAME)/*.c)) $(wildcard ../*.h)
+ $(CC) $(SO_FLAGS) -o $@ $(filter %.o,$^)
diff --git a/plugins/log/main.c b/plugins/log/main.c
new file mode 100644
index 0000000..b931d12
--- /dev/null
+++ b/plugins/log/main.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include "plugin_client_header.h"
+
+
+static void eventfunc(const struct plugin_event *event){
+ printf("type = %d\n",event->type);
+}
+
+plugin_event_func_t* plugin_init_func(void){
+ return eventfunc;
+}