ant-http/Makefile

67 lines
1.5 KiB
Makefile
Raw Normal View History

2015-10-22 11:39:11 +02:00
CC=gcc
EXT=dylib
SERVER=plugin_manager.o \
plugins/ini.o \
http_server.o \
plugins/dictionary.o \
plugins/base64.o \
plugins/sha1.o \
plugins/ws.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)
2016-12-12 20:17:05 +01:00
BUILDIRD=/opt/www
2016-11-01 18:30:45 +01:00
PF_FLAG=-D_GNU_SOURCE -DLINUX
2015-12-02 11:42:40 +01:00
endif
ifeq ($(UNAME_S),Darwin)
2016-10-31 17:34:20 +01:00
BUILDIRD=../ant-build
2016-11-01 18:30:45 +01:00
PF_FLAG= -DMACOS
2015-12-02 11:42:40 +01:00
endif
2016-03-04 11:44:13 +01:00
CFLAGS=-W -Wall -g -std=c99 -D DEBUG -D USE_DB $(PF_FLAG)
2015-10-22 11:39:11 +02:00
#-lsocket
PLUGINS= dummy.$(EXT) fileman.$(EXT) pluginsman.$(EXT) wterm.$(EXT) nodedaemon.$(EXT) cookiex.$(EXT) wsimg.$(EXT)
2015-10-22 11:39:11 +02:00
PLUGINSDEP = plugins/ini.o \
plugins/plugin.o \
plugins/dbhelper.o \
plugins/dictionary.o \
plugins/base64.o \
plugins/utils.o \
plugins/ws.o \
plugins/sha1.o \
plugins/list.o
2015-10-22 11:39:11 +02:00
PLUGINLIBS = -lsqlite3
main: httpd plugins
2015-10-22 11:39:11 +02:00
httpd:$(SERVER)
$(CC) $(CFLAGS) $(SERVERLIB) $(SERVER) -o $(BUILDIRD)/httpd httpd.c
2016-10-31 20:59:27 +01:00
cp antd $(BUILDIRD)
2015-10-22 11:39:11 +02:00
%.o: %.c
2016-11-23 23:33:49 +01:00
$(CC) -fPIC $(CFLAGS) -c $< -o $@
2015-10-22 11:39:11 +02:00
plugins: $(PLUGINS)
%.$(EXT): $(PLUGINSDEP)
for file in $(wildcard plugins/$(basename $@)/*.c) ; do\
2016-11-01 12:33:18 +01:00
$(CC) -fPIC $(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 $(BUILDIRD)/httpd
2015-10-22 11:39:11 +02:00
pclean:
2016-03-04 11:38:08 +01:00
rm -rf $(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
2016-12-12 20:17:05 +01:00
.PRECIOUS: %.o