summaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
authorJulien Dessaux2016-08-11 13:20:39 +0200
committerJulien Dessaux2016-08-11 19:46:59 +0200
commitcffeb8a3552d33e7e3de3fb6370881bfe6bcee9e (patch)
tree75552ded0d5d95770d03095065830b7b69b07087 /GNUmakefile
parentInitial commit (diff)
downloadb98-cffeb8a3552d33e7e3de3fb6370881bfe6bcee9e.tar.gz
b98-cffeb8a3552d33e7e3de3fb6370881bfe6bcee9e.tar.bz2
b98-cffeb8a3552d33e7e3de3fb6370881bfe6bcee9e.zip
Working bot answering PING, and its C wrapper.
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile62
1 files changed, 62 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 0000000..69a7d90
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,62 @@
+# Common
+prefix= /usr/local
+
+CC=clang
+CFLAGS= -Wall -Werror -Wextra
+#CFLAGS+= -std=c99
+CFLAGS+= -std=gnu99
+#CFLAGS+= -Os
+CFLAGS+= -g
+
+LDFLAGS= -lgnutls -lpthread -ldl -rdynamic
+LDFLAGS+= -g
+#LDFLAGS+= -Os
+
+# Target: cbot
+cbot_BIN= cbot
+cbot_OBJ= $(subst .c,.o,$(wildcard src/*.c))
+
+# Targets: plugins
+plugins_SO= $(subst .c,.so,$(wildcard src/plugin/*.c))
+
+# Rules
+all: $(cbot_BIN) $(plugins_SO)
+
+$(cbot_BIN): $(cbot_OBJ)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $(cbot_BIN) $(cbot_OBJ)
+
+%.so: %.c
+ $(CC) -shared -nostartfiles -fPIC $(CFLAGS) $*.c -o $*.so
+ $(CC) -MM $(CFLAGS) $*.c > $*.d
+ @mv -f $*.d $*.d.tmp
+ @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
+ @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
+ @rm -f $*.d.tmp
+
+-include $(cbot_OBJ:.o=.d)
+
+%.o: %.c
+ $(CC) -c $(CFLAGS) $*.c -o $*.o
+ $(CC) -MM $(CFLAGS) $*.c > $*.d
+ @mv -f $*.d $*.d.tmp
+ @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
+ @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
+ @rm -f $*.d.tmp
+
+clean:
+ $(RM) */*.o */*.d */*/*.o */*/*.d */*/*.so
+ $(RM) $(cbot_BIN) AllTests
+ $(RM) -rf clang-analyzer
+
+check:
+ scan-build -o clang-analyzer make
+ clang -o AllTests $(wildcard tests/*.c)
+ ./AllTests
+
+tags:
+ ctags -o .tags -a $(wildcard src/*.[hc])
+
+.PHONY: all clean install uninstall tags
+
+start:
+ ./cbot