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