diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-05-09 22:39:16 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-05-09 22:39:16 +0200 |
commit | 24de2cd600a4e108c24f6f77a5a4d30111fd9918 (patch) | |
tree | b27f97f511fb3d6fd5ce7f8a3fad9687867dbfda /plugins/Makefile | |
parent | a7a0ce278e661bf5d3f2b47556d8c30469d2bd6c (diff) |
server: Add plugin framework
Diffstat (limited to 'plugins/Makefile')
-rw-r--r-- | plugins/Makefile | 34 |
1 files changed, 34 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,$^) |