mirror of
https://github.com/lxsang/ant-http
synced 2024-12-25 16:28:21 +01:00
91 lines
2.1 KiB
Makefile
91 lines
2.1 KiB
Makefile
include var.mk
|
|
LIB_PATH=$(BUILDIRD)/plugins
|
|
LIB_NAME=libantd
|
|
LIB_FLAG= $(LIB_NAME).$(EXT)
|
|
SERVERLIB= -ldl $(LIB_FLAG) $(DB_LIB) $(SSL_LIB) -lpthread
|
|
|
|
SERVER_O=plugin_manager.o \
|
|
http_server.o
|
|
#-lsocket
|
|
|
|
LIBOBJS = libs/ini.o \
|
|
libs/handle.o \
|
|
$(DB_OBJ) \
|
|
libs/dictionary.o \
|
|
libs/base64.o \
|
|
libs/utils.o \
|
|
libs/ws.o \
|
|
libs/sha1.o \
|
|
libs/list.o \
|
|
libs/scheduler.o
|
|
|
|
PLUGINSDEP = libs/plugin.o
|
|
|
|
|
|
main: initd httpd antd_plugins
|
|
|
|
initd:
|
|
-mkdir -p $(LIB_PATH)
|
|
|
|
httpd: lib $(SERVER_O)
|
|
$(CC) $(CFLAGS) $(SERVER_O) -o $(BUILDIRD)/httpd httpd.c $(SERVERLIB)
|
|
cp antd $(BUILDIRD)
|
|
|
|
relay: lib $(SERVER_O)
|
|
$(CC) $(CFLAGS) $(SERVER_O) -o $(BUILDIRD)/relay relay.c $(SERVERLIB)
|
|
cp forward $(BUILDIRD)
|
|
lib: $(LIBOBJS)
|
|
$(CC) $(CFLAGS) $(DB_LIB) $(SSL_LIB) -shared -o $(LIB_NAME).$(EXT) $(LIBOBJS)
|
|
cp $(LIB_NAME).$(EXT) $(LIB_PATH$)/
|
|
%.o: %.c
|
|
$(CC) -fPIC $(CFLAGS) -c $< -o $@
|
|
|
|
antd_plugins:
|
|
- echo "make plugin"
|
|
-for file in plugins/* ; do\
|
|
echo $$file;\
|
|
if [ -d "$$file" ]; then \
|
|
make -C "$$file" clean; \
|
|
make -C "$$file" main; \
|
|
fi \
|
|
done
|
|
|
|
plugin:
|
|
read -r -p "Enter package name: " PKG;\
|
|
cd plugins/$$PKG && make clean && make\
|
|
|
|
clean: sclean pclean
|
|
|
|
deb:
|
|
-rm -r package
|
|
-rm *.deb
|
|
mkdir -p package/opt/www/htdocs
|
|
mkdir package/opt/www/plugins
|
|
mkdir package/opt/www/database package/opt/www/tmp
|
|
mkdir package/DEBIAN
|
|
cp $(BUILDIRD)/httpd package/opt/www
|
|
chmod a+x package/opt/www/httpd
|
|
cp -rf $(BUILDIRD)/plugins/* package/opt/www/plugins
|
|
cp antd package/opt/www
|
|
chmod a+x package/opt/www/antd
|
|
cp config.ini.tpl package/opt/www/config.ini
|
|
echo "Package: antd" > package/DEBIAN/control
|
|
echo "Version: 1.0.0" >> package/DEBIAN/control
|
|
echo "Maintainer: Xuan Sang LE" >> package/DEBIAN/control
|
|
echo "Architecture: all" >> package/DEBIAN/control
|
|
echo "Description: Lighweight HTTP/HTTPs server" >> package/DEBIAN/control
|
|
dpkg-deb --build package
|
|
-rm -r package
|
|
|
|
sclean:
|
|
-rm -f *.o $(BUILDIRD)/httpd
|
|
-rm *.$(EXT)
|
|
pclean:
|
|
-rm -rf $(BUILDIRD)/plugins/* libs/*.o
|
|
-for file in plugins/* ;do \
|
|
if [ -d "$$file" ]; then \
|
|
make -C "$$file" clean; \
|
|
fi \
|
|
done
|
|
.PRECIOUS: %.o
|