aboutsummaryrefslogtreecommitdiff
path: root/weechat/Makefile
diff options
context:
space:
mode:
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 $@ $^