[package] uhttpd: support building against openssl instead of cyassl, minor cleanups...
[openwrt.git] / package / uhttpd / src / Makefile
1 CGI_SUPPORT ?= 1
2 LUA_SUPPORT ?= 1
3 TLS_SUPPORT ?= 1
4 UHTTPD_TLS ?= cyassl
5
6 CFLAGS ?= -I./lua-5.1.4/src -I$(TLS_INCLUDE_DIR) -O0 -ggdb3
7 LDFLAGS ?= -L./lua-5.1.4/src -L$(TLS_LIB_DIR)
8
9 CFLAGS += -Wall --std=gnu99
10
11 ifeq ($(UHTTPD_TLS),openssl)
12 TLS_LDFLAGS := -lssl
13 TLS_INCLUDE_DIR := ./openssl-0.9.8m/include
14 TLS_LIB_DIR := ./openssl-0.9.8m
15 else
16 TLS_LDFLAGS := -lcyassl
17 TLS_INCLUDE_DIR := ./cyassl-1.4.0/include
18 TLS_LIB_DIR := ./cyassl-1.4.0/src/.libs
19 endif
20
21 OBJ := uhttpd.o uhttpd-file.o uhttpd-utils.o
22 LIB := -Wl,--export-dynamic -lcrypt -ldl
23
24 TLSLIB :=
25 LUALIB :=
26
27 HAVE_SHADOW=$(shell echo 'int main(void){ return !getspnam("root"); }' | \
28 $(CC) -include shadow.h -xc -o/dev/null - 2>/dev/null && echo yes)
29
30 ifeq ($(HAVE_SHADOW),yes)
31 CFLAGS += -DHAVE_SHADOW
32 endif
33
34 world: compile
35
36 ifeq ($(CGI_SUPPORT),1)
37 OBJ += uhttpd-cgi.o
38 CFLAGS += -DHAVE_CGI
39 endif
40
41 ifeq ($(LUA_SUPPORT),1)
42 CFLAGS += -DHAVE_LUA
43 LUALIB := uhttpd_lua.so
44
45 $(LUALIB): uhttpd-lua.c
46 $(CC) $(CFLAGS) $(LDFLAGS) $(FPIC) \
47 -shared -lm -llua -ldl \
48 -o $(LUALIB) uhttpd-lua.c
49 endif
50
51 ifeq ($(TLS_SUPPORT),1)
52 CFLAGS += -DHAVE_TLS
53 TLSLIB := uhttpd_tls.so
54
55 $(TLSLIB): uhttpd-tls.c
56 $(CC) $(CFLAGS) $(LDFLAGS) $(FPIC) \
57 -shared $(TLS_LDFLAGS) \
58 -o $(TLSLIB) uhttpd-tls.c
59 endif
60
61 %.o: %.c
62 $(CC) $(CFLAGS) -c -o $@ $<
63
64 compile: $(OBJ) $(TLSLIB) $(LUALIB)
65 $(CC) -o uhttpd $(LDFLAGS) $(LIB) $(OBJ)
66
67 clean:
68 rm -f *.o *.so uhttpd
This page took 0.043925 seconds and 5 git commands to generate.