1
0
mirror of https://github.com/lxsang/ant-http synced 2024-07-06 06:29:46 +02:00
ant-http/Makefile

89 lines
1.7 KiB
Makefile
Raw Normal View History

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
LIB_FLAG= $(LIB_PATH$)/$(LIB_NAME).$(EXT)
SERVERLIB=-lpthread -ldl $(LIB_FLAG)
SERVER_O=plugin_manager.o \
http_server.o \
httpd.o
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
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
main: httpd plugins
2015-10-22 11:39:11 +02:00
2017-07-29 22:00:34 +02:00
httpd: lib $(SERVER_O)
$(CC) $(CFLAGS) $(SERVER_O) $(SERVERLIB) -o $(BUILDIRD)/httpd
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)
$(CC) $(CFLAGS) $(DB_LIB) -shared -o $(LIB_PATH$)/$(LIB_NAME).$(EXT) $(LIBOBJS)
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