From ed2b3a38ec05c566c645dc2aabfd513edff8d63b Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sun, 25 Dec 2016 22:55:21 +0100 Subject: Plugins --- plugins/Makefile | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 plugins/Makefile (limited to 'plugins/Makefile') diff --git a/plugins/Makefile b/plugins/Makefile new file mode 100644 index 0000000..145500c --- /dev/null +++ b/plugins/Makefile @@ -0,0 +1,39 @@ +CC = gcc +CFLAGS = -Wall -Wextra -std=c11 -fwrapv -I.. +ifneq ($(DEBUG),) + CFLAGS += -g +else + CFLAGS += -O2 +endif + +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: + 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 ../*.o ../*.h) + $(CC) $(SO_FLAGS) -o $@ $(filter %.o,$^) -- cgit v1.2.3-70-g09d2