ant-http/Makefile

91 lines
2.1 KiB
Makefile
Raw Normal View History

include var.mk
2017-07-29 22:00:34 +02:00
LIB_PATH=$(BUILDIRD)/plugins
LIB_NAME=libantd
2017-06-11 16:33:48 +02:00
LIB_FLAG= $(LIB_NAME).$(EXT)
2018-02-10 17:02:17 +01:00
SERVERLIB= -ldl $(LIB_FLAG) $(DB_LIB) $(SSL_LIB) -lpthread
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
2018-02-09 13:13:11 +01:00
LIBOBJS = libs/ini.o \
libs/handle.o \
2017-07-29 22:00:34 +02:00
$(DB_OBJ) \
2018-02-09 13:13:11 +01:00
libs/dictionary.o \
libs/base64.o \
libs/utils.o \
libs/ws.o \
libs/sha1.o \
2018-09-25 17:51:56 +02:00
libs/list.o \
libs/scheduler.o
2017-07-29 22:00:34 +02:00
2018-02-09 13:13:11 +01:00
PLUGINSDEP = libs/plugin.o
2017-07-29 22:00:34 +02:00
2015-10-22 11:39:11 +02:00
main: initd httpd antd_plugins
2015-10-22 11:39:11 +02:00
2018-03-19 11:32:10 +01:00
initd:
2018-03-19 11:35:56 +01:00
-mkdir -p $(LIB_PATH)
2015-10-22 11:39:11 +02:00
2017-07-29 22:00:34 +02:00
httpd: lib $(SERVER_O)
2018-02-10 17:07:19 +01:00
$(CC) $(CFLAGS) $(SERVER_O) -o $(BUILDIRD)/httpd httpd.c $(SERVERLIB)
2016-10-31 20:59:27 +01:00
cp antd $(BUILDIRD)
2015-10-22 11:39:11 +02:00
2018-09-25 17:51:56 +02:00
relay: lib $(SERVER_O)
$(CC) $(CFLAGS) $(SERVER_O) -o $(BUILDIRD)/relay relay.c $(SERVERLIB)
2018-09-26 10:30:04 +02:00
cp forward $(BUILDIRD)
2017-07-29 22:00:34 +02:00
lib: $(LIBOBJS)
2018-02-10 11:22:41 +01:00
$(CC) $(CFLAGS) $(DB_LIB) $(SSL_LIB) -shared -o $(LIB_NAME).$(EXT) $(LIBOBJS)
2017-06-11 16:33:48 +02:00
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
antd_plugins:
- echo "make plugin"
-for file in plugins/* ; do\
echo $$file;\
if [ -d "$$file" ]; then \
2018-10-09 10:53:36 +02:00
make -C "$$file" clean; \
make -C "$$file" main; \
fi \
2015-10-22 11:39:11 +02:00
done
2018-09-20 00:02:53 +02:00
plugin:
read -r -p "Enter package name: " PKG;\
cd plugins/$$PKG && make clean && make\
2015-10-22 11:39:11 +02:00
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
2015-10-22 11:39:11 +02:00
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:
2018-02-10 11:22:41 +01:00
-rm -rf $(BUILDIRD)/plugins/* libs/*.o
-for file in plugins/* ;do \
2015-10-22 11:39:11 +02:00
if [ -d "$$file" ]; then \
make -C "$$file" clean; \
2015-10-22 11:39:11 +02:00
fi \
done
2016-12-12 20:17:05 +01:00
.PRECIOUS: %.o