aboutsummaryrefslogtreecommitdiff
path: root/weechat/Makefile
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-04-07 23:59:03 +0200
committertomsmeding <tom.smeding@gmail.com>2017-04-07 23:59:03 +0200
commit2b86c851562f86f69acbf4b773107077680d5068 (patch)
tree170e3e3305ac41b366d20ae8988489b7bc7f0395 /weechat/Makefile
parenta75b3f7b47c074f2191a33c1f14ad4148754ed80 (diff)
Push weechat plugin
Diffstat (limited to 'weechat/Makefile')
-rw-r--r--weechat/Makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/weechat/Makefile b/weechat/Makefile
new file mode 100644
index 0000000..0973efe
--- /dev/null
+++ b/weechat/Makefile
@@ -0,0 +1,40 @@
+CC = gcc
+CFLAGS = -Wall -Wextra -std=c11 -fwrapv -g -O2 -fPIC
+
+SRC_FILES = $(wildcard *.c)
+HEADER_FILES = $(wildcard *.h)
+OBJECT_FILES = $(patsubst %.c,%.o,$(SRC_FILES))
+
+UNAME = $(shell uname)
+
+ifeq ($(UNAME),Darwin)
+ DYLIB_EXT = so # should really be .dylib, but weechat seems to expect 'so'
+ DYLIB_FLAGS = -dynamiclib
+else
+ DYLIB_EXT = so
+ DYLIB_FLAGS = -shared
+endif
+
+
+# Don't remove intermediate files
+.SECONDARY:
+
+
+.PHONY: all clean remake dynamiclib
+
+all: dynamiclib
+
+clean:
+ rm -f *.$(DYLIB_EXT) *.o
+
+remake: clean
+ $(MAKE) all
+
+dynamiclib: tomsg.$(DYLIB_EXT)
+
+
+%.o: %.c $(HEADER_FILES)
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+%.$(DYLIB_EXT): $(OBJECT_FILES)
+ $(CC) $(CFLAGS) $(DYLIB_FLAGS) -o $@ $^