2010-03-25 17:46:16 +02:00
|
|
|
CGI_SUPPORT ?= 1
|
|
|
|
LUA_SUPPORT ?= 1
|
|
|
|
TLS_SUPPORT ?= 1
|
2011-07-18 17:18:31 +03:00
|
|
|
UHTTPD_TLS ?= cyassl
|
2010-03-25 17:46:16 +02:00
|
|
|
|
2011-11-05 05:19:07 +02:00
|
|
|
CFLAGS ?= -I./lua-5.1.4/src $(TLS_CFLAGS) -O0 -ggdb3
|
2011-11-05 19:36:47 +02:00
|
|
|
LDFLAGS ?= -L./lua-5.1.4/src
|
2010-03-25 17:46:16 +02:00
|
|
|
|
|
|
|
CFLAGS += -Wall --std=gnu99
|
|
|
|
|
2011-07-18 17:18:31 +03:00
|
|
|
ifeq ($(UHTTPD_TLS),openssl)
|
2011-11-05 19:36:47 +02:00
|
|
|
TLS_LDFLAGS ?= -L./openssl-0.9.8m -lssl
|
|
|
|
TLS_CFLAGS ?= -I./openssl-0.9.8m/include -DTLS_IS_OPENSSL
|
2011-07-18 17:18:31 +03:00
|
|
|
else
|
2011-11-05 19:36:47 +02:00
|
|
|
TLS_LDFLAGS ?= -L./cyassl-1.4.0/src/.libs -lcyassl
|
|
|
|
TLS_CFLAGS ?= -I./cyassl-1.4.0/include -DTLS_IS_CYASSL
|
2011-07-18 17:18:31 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
OBJ := uhttpd.o uhttpd-file.o uhttpd-utils.o
|
|
|
|
LIB := -Wl,--export-dynamic -lcrypt -ldl
|
2010-03-25 17:46:16 +02:00
|
|
|
|
2011-07-18 17:18:31 +03:00
|
|
|
TLSLIB :=
|
|
|
|
LUALIB :=
|
2010-03-25 17:46:16 +02:00
|
|
|
|
2010-11-06 18:19:04 +02:00
|
|
|
HAVE_SHADOW=$(shell echo 'int main(void){ return !getspnam("root"); }' | \
|
|
|
|
$(CC) -include shadow.h -xc -o/dev/null - 2>/dev/null && echo yes)
|
|
|
|
|
|
|
|
ifeq ($(HAVE_SHADOW),yes)
|
|
|
|
CFLAGS += -DHAVE_SHADOW
|
|
|
|
endif
|
2010-03-25 17:46:16 +02:00
|
|
|
|
2011-11-05 05:19:07 +02:00
|
|
|
ifeq ($(TLS_SUPPORT),1)
|
|
|
|
CFLAGS += -DHAVE_TLS
|
|
|
|
endif
|
2010-03-25 17:46:16 +02:00
|
|
|
|
|
|
|
ifeq ($(CGI_SUPPORT),1)
|
|
|
|
CFLAGS += -DHAVE_CGI
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(LUA_SUPPORT),1)
|
|
|
|
CFLAGS += -DHAVE_LUA
|
2011-11-05 05:19:07 +02:00
|
|
|
endif
|
|
|
|
|
2012-05-28 03:52:24 +03:00
|
|
|
ifeq ($(UBUS_SUPPORT),1)
|
|
|
|
CFLAGS += -DHAVE_UBUS
|
|
|
|
endif
|
|
|
|
|
2011-11-05 05:19:07 +02:00
|
|
|
|
|
|
|
world: compile
|
|
|
|
|
|
|
|
ifeq ($(CGI_SUPPORT),1)
|
|
|
|
OBJ += uhttpd-cgi.o
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(LUA_SUPPORT),1)
|
2011-07-18 17:18:31 +03:00
|
|
|
LUALIB := uhttpd_lua.so
|
2010-03-25 17:46:16 +02:00
|
|
|
|
|
|
|
$(LUALIB): uhttpd-lua.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(FPIC) \
|
|
|
|
-shared -lm -llua -ldl \
|
|
|
|
-o $(LUALIB) uhttpd-lua.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TLS_SUPPORT),1)
|
2011-07-18 17:18:31 +03:00
|
|
|
TLSLIB := uhttpd_tls.so
|
2010-03-25 17:46:16 +02:00
|
|
|
|
|
|
|
$(TLSLIB): uhttpd-tls.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(FPIC) \
|
2011-11-05 19:36:47 +02:00
|
|
|
-shared $(TLS_LDFLAGS) \
|
2010-03-25 17:46:16 +02:00
|
|
|
-o $(TLSLIB) uhttpd-tls.c
|
|
|
|
endif
|
|
|
|
|
2012-05-28 03:52:24 +03:00
|
|
|
ifeq ($(UBUS_SUPPORT),1)
|
|
|
|
UBUSLIB := uhttpd_ubus.so
|
|
|
|
|
|
|
|
$(UBUSLIB): uhttpd-ubus.c
|
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) $(FPIC) \
|
|
|
|
-shared -lubus -ljson -lblobmsg_json \
|
|
|
|
-o $(UBUSLIB) uhttpd-ubus.c
|
|
|
|
endif
|
|
|
|
|
2010-03-25 17:46:16 +02:00
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
2012-05-28 03:52:24 +03:00
|
|
|
compile: $(OBJ) $(TLSLIB) $(LUALIB) $(UBUSLIB)
|
2012-03-13 22:41:31 +02:00
|
|
|
$(CC) -o uhttpd $(LDFLAGS) $(OBJ) $(LIB)
|
2010-03-25 17:46:16 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f *.o *.so uhttpd
|