2017-07-29 22:00:34 +02:00
|
|
|
USE_DB=TRUE
|
2015-10-22 11:39:11 +02:00
|
|
|
CC=gcc
|
|
|
|
EXT=dylib
|
2017-07-29 22:00:34 +02:00
|
|
|
|
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
|
2017-07-29 22:00:34 +02:00
|
|
|
|
|
|
|
ifeq ($(USE_DB),TRUE)
|
|
|
|
DB_OBJ=plugins/dbhelper.o
|
|
|
|
DB_LIB=-lsqlite3
|
|
|
|
DB_FLAG=-D USE_DB
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(USE_DB),FALSE)
|
|
|
|
DB_OBJ=
|
|
|
|
DB_LIB=
|
|
|
|
DB_FLAG=
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
CFLAGS= -W -Wall -g -std=c99 -D DEBUG $(DB_FLAG) $(PF_FLAG)
|
|
|
|
|
|
|
|
LIB_PATH=$(BUILDIRD)/plugins
|
|
|
|
LIB_NAME=libantd
|
2017-06-11 16:33:48 +02:00
|
|
|
LIB_FLAG= $(LIB_NAME).$(EXT)
|
2018-01-22 15:48:20 +01:00
|
|
|
SERVERLIB= -ldl $(LIB_FLAG) $(DB_LIB) -l pthread
|
2017-07-29 22:00:34 +02:00
|
|
|
|
|
|
|
SERVER_O=plugin_manager.o \
|
2017-07-30 01:00:36 +02:00
|
|
|
http_server.o
|
2015-10-22 11:39:11 +02:00
|
|
|
#-lsocket
|
2016-12-13 16:34:03 +01:00
|
|
|
PLUGINS= dummy.$(EXT) fileman.$(EXT) pluginsman.$(EXT) wterm.$(EXT) nodedaemon.$(EXT) cookiex.$(EXT) wsimg.$(EXT)
|
2015-10-22 11:39:11 +02:00
|
|
|
|
2017-07-29 22:00:34 +02:00
|
|
|
LIBOBJS = plugins/ini.o \
|
|
|
|
plugins/handle.o \
|
|
|
|
$(DB_OBJ) \
|
|
|
|
plugins/dictionary.o \
|
|
|
|
plugins/base64.o \
|
|
|
|
plugins/utils.o \
|
|
|
|
plugins/ws.o \
|
|
|
|
plugins/sha1.o \
|
|
|
|
plugins/list.o
|
|
|
|
|
|
|
|
PLUGINSDEP = plugins/plugin.o
|
|
|
|
|
2015-10-22 11:39:11 +02:00
|
|
|
|
2016-02-26 14:32:13 +01:00
|
|
|
main: httpd plugins
|
2015-10-22 11:39:11 +02:00
|
|
|
|
|
|
|
|
2017-07-29 22:00:34 +02:00
|
|
|
httpd: lib $(SERVER_O)
|
2017-07-30 01:00:36 +02:00
|
|
|
$(CC) $(CFLAGS) $(SERVER_O) $(SERVERLIB) -o $(BUILDIRD)/httpd httpd.c
|
2016-10-31 20:59:27 +01:00
|
|
|
cp antd $(BUILDIRD)
|
2015-10-22 11:39:11 +02:00
|
|
|
|
2017-07-29 22:00:34 +02:00
|
|
|
lib: $(LIBOBJS)
|
2017-06-11 16:33:48 +02:00
|
|
|
$(CC) $(CFLAGS) $(DB_LIB) -shared -o $(LIB_NAME).$(EXT) $(LIBOBJS)
|
|
|
|
cp $(LIB_NAME).$(EXT) $(LIB_PATH$)/
|
2015-10-22 11:39:11 +02:00
|
|
|
%.o: %.c
|
2016-11-23 23:33:49 +01:00
|
|
|
$(CC) -fPIC $(CFLAGS) -c $< -o $@
|
2017-07-29 22:00:34 +02:00
|
|
|
|
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
|
2017-07-29 22:00:34 +02:00
|
|
|
$(CC) $(CFLAGS) $(PLUGINLIBS) $(LIB_FLAG) -shared -o $(BUILDIRD)/plugins/$(basename $@).$(EXT) \
|
|
|
|
$(PLUGINSDEP) plugins/$(basename $@)/*.c.o
|
2015-10-22 11:39:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
clean: sclean pclean
|
|
|
|
|
|
|
|
sclean:
|
2017-07-29 22:00:34 +02:00
|
|
|
-rm -f *.o $(BUILDIRD)/httpd
|
|
|
|
-rm *.$(EXT)
|
2015-10-22 11:39:11 +02:00
|
|
|
pclean:
|
2017-07-29 22:00:34 +02: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
|