2015-10-22 11:39:11 +02:00
|
|
|
CC=gcc
|
|
|
|
EXT=dylib
|
2016-02-29 22:50:10 +01:00
|
|
|
SERVER=plugin_manager.o plugins/ini.o http_server.o plugins/dictionary.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-10-31 18:32:25 +01:00
|
|
|
BUILDIRD=/root/www
|
2016-03-04 11:44:13 +01:00
|
|
|
PF_FLAG=-D_GNU_SOURCE
|
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-03-04 11:44:13 +01:00
|
|
|
PF_FLAG=
|
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
|
2016-10-30 16:14:04 +01:00
|
|
|
PLUGINS= dummy.$(EXT) fileman.$(EXT) pluginsman.$(EXT) wterm.$(EXT) nodedaemon.$(EXT) cookiex.$(EXT)
|
2015-10-22 11:39:11 +02:00
|
|
|
|
2016-03-04 11:38:08 +01:00
|
|
|
PLUGINSDEP = plugins/ini.o plugins/plugin.o plugins/dbhelper.o plugins/dictionary.o plugins/utils.o plugins/list.o
|
2015-10-22 11:39:11 +02:00
|
|
|
PLUGINLIBS = -lsqlite3
|
|
|
|
|
2016-02-26 14:32:13 +01:00
|
|
|
main: httpd plugins
|
2015-10-22 11:39:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
httpd:$(SERVER)
|
|
|
|
$(CC) $(CFLAGS) $(SERVERLIB) $(SERVER) -o $(BUILDIRD)/httpd httpd.c
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
plugins: $(PLUGINS)
|
|
|
|
|
|
|
|
%.$(EXT): $(PLUGINSDEP)
|
|
|
|
for file in $(wildcard plugins/$(basename $@)/*.c) ; do\
|
2016-02-26 14:32:13 +01:00
|
|
|
$(CC) $(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 build/httpd
|
|
|
|
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
|
|
|
|
.PRECIOUS: %.o
|