source: trunk/package/uhttpd/src/Makefile @ 28769

Last change on this file since 28769 was 28769, checked in by jow, 5 years ago

[package] uhttpd: fix Makefiles and linking of tls plugin

File size: 1.5 KB
Line 
1CGI_SUPPORT ?= 1
2LUA_SUPPORT ?= 1
3TLS_SUPPORT ?= 1
4UHTTPD_TLS ?= cyassl
5
6CFLAGS ?= -I./lua-5.1.4/src $(TLS_CFLAGS) -O0 -ggdb3
7LDFLAGS ?= -L./lua-5.1.4/src
8
9CFLAGS += -Wall --std=gnu99
10
11ifeq ($(UHTTPD_TLS),openssl)
12  TLS_LDFLAGS ?= -L./openssl-0.9.8m -lssl
13  TLS_CFLAGS ?= -I./openssl-0.9.8m/include -DTLS_IS_OPENSSL
14else
15  TLS_LDFLAGS ?= -L./cyassl-1.4.0/src/.libs -lcyassl
16  TLS_CFLAGS ?= -I./cyassl-1.4.0/include -DTLS_IS_CYASSL
17endif
18
19OBJ := uhttpd.o uhttpd-file.o uhttpd-utils.o
20LIB := -Wl,--export-dynamic -lcrypt -ldl
21
22TLSLIB :=
23LUALIB :=
24
25HAVE_SHADOW=$(shell echo 'int main(void){ return !getspnam("root"); }' | \
26        $(CC) -include shadow.h -xc -o/dev/null - 2>/dev/null && echo yes)
27
28ifeq ($(HAVE_SHADOW),yes)
29  CFLAGS += -DHAVE_SHADOW
30endif
31
32ifeq ($(TLS_SUPPORT),1)
33  CFLAGS += -DHAVE_TLS
34endif
35
36ifeq ($(CGI_SUPPORT),1)
37  CFLAGS += -DHAVE_CGI
38endif
39
40ifeq ($(LUA_SUPPORT),1)
41  CFLAGS += -DHAVE_LUA
42endif
43
44
45world: compile
46
47ifeq ($(CGI_SUPPORT),1)
48  OBJ += uhttpd-cgi.o
49endif
50
51ifeq ($(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
58endif
59
60ifeq ($(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
67endif
68
69%.o: %.c
70        $(CC) $(CFLAGS) -c -o $@ $<
71
72compile: $(OBJ) $(TLSLIB) $(LUALIB)
73        $(CC) -o uhttpd $(LDFLAGS) $(LIB) $(OBJ)
74
75clean:
76        rm -f *.o *.so uhttpd
Note: See TracBrowser for help on using the repository browser.