ant-http/Makefile

49 lines
1.1 KiB
Makefile
Raw Normal View History

2015-10-22 11:39:11 +02:00
CC=gcc
CFLAGS=-W -Wall -g -std=c99 -D DEBUG -D USE_DB
2015-10-22 11:39:11 +02:00
EXT=dylib
2016-02-29 22:50:10 +01:00
SERVER=plugin_manager.o plugins/ini.o http_server.o plugins/dictionary.o plugins/utils.o
2015-10-22 11:39:11 +02:00
SERVERLIB=-lpthread -ldl
2015-12-02 11:44:17 +01:00
UNAME_S := $(shell uname -s)
2015-12-02 11:42:40 +01:00
ifeq ($(UNAME_S),Linux)
BUILDIRD=/root/antd
endif
ifeq ($(UNAME_S),Darwin)
BUILDIRD=./build
2015-12-02 11:42:40 +01:00
endif
2015-10-22 11:39:11 +02:00
#-lsocket
2015-11-26 13:52:49 +01:00
PLUGINS= dummy.$(EXT) fileman.$(EXT) pluginsman.$(EXT) wterm.$(EXT)
2015-10-22 11:39:11 +02:00
PLUGINSDEP = plugins/plugin.o plugins/dbhelper.o plugins/dictionary.o plugins/utils.o plugins/list.o
PLUGINLIBS = -lsqlite3
main: httpd plugins
2015-10-22 11:39:11 +02:00
httpd:$(SERVER)
$(CC) $(CFLAGS) $(SERVERLIB) $(SERVER) -o $(BUILDIRD)/httpd httpd.c
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
plugins: $(PLUGINS)
%.$(EXT): $(PLUGINSDEP)
for file in $(wildcard plugins/$(basename $@)/*.c) ; do\
$(CC) $(CFLAGS) -c $$file -o $$file.o; \
2015-10-22 11:39:11 +02:00
done
$(CC) $(CFLAGS) $(PLUGINLIBS) -shared -o $(BUILDIRD)/plugins/$(basename $@).$(EXT) \
$(PLUGINSDEP) plugins/$(basename $@)/*.c.o
clean: sclean pclean
sclean:
rm -f *.o build/httpd
pclean:
2015-12-02 11:42:40 +01:00
rm -f $(BUILDIRD)/plugins/* plugins/*.o
2015-10-22 11:39:11 +02:00
-for file in plugins/* ;do \
if [ -d "$$file" ]; then \
rm "$$file"/*.o; \
fi \
done
.PRECIOUS: %.o