2014-08-05 23:40:51 +08:00
|
|
|
# Copyright (c) 2014 Cesanta Software
|
|
|
|
# All rights reserved
|
|
|
|
#
|
|
|
|
# Makefile for Mongoose web server examples
|
|
|
|
|
2014-03-02 20:23:53 +08:00
|
|
|
CFLAGS = -W -Wall -I.. -pthread -g -pipe $(CFLAGS_EXTRA)
|
|
|
|
RM = rm -rf
|
|
|
|
OUT = -o $@
|
2014-08-05 23:40:51 +08:00
|
|
|
ALL_PROGS = hello websocket server post multi_threaded upload auth pubsub
|
|
|
|
NS = ../../net_skeleton
|
|
|
|
SW = ../../ssl_wrapper
|
2010-05-04 04:46:42 +08:00
|
|
|
|
2013-08-16 18:17:15 +08:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2014-08-11 21:27:23 +08:00
|
|
|
ifndef MINGW
|
|
|
|
MSVC = ../../vc6
|
|
|
|
RM = del /q /f
|
|
|
|
OUT =
|
|
|
|
CC = $(MSVC)/bin/cl
|
|
|
|
CFLAGS = /MD /TC /nologo /W3 /I$(MSVC)/include /I..
|
|
|
|
CFLAGS += /link /incremental:no /libpath:$(MSVC)/lib /machine:IX86
|
|
|
|
CFLAGS += $(CFLAGS_EXTRA)
|
|
|
|
else
|
|
|
|
CC = g++
|
|
|
|
CFLAGS = -W -Wall -Wno-unused-parameter -I.. -O0 -g -pipe $(CFLAGS_EXTRA) -lwsock32
|
|
|
|
endif
|
2013-08-16 18:17:15 +08:00
|
|
|
else
|
|
|
|
UNAME_S := $(shell uname -s)
|
2014-04-08 02:07:41 +08:00
|
|
|
CC = g++
|
|
|
|
CFLAGS += -lssl -g -O0
|
2012-09-25 04:25:06 +08:00
|
|
|
|
2013-08-16 18:17:15 +08:00
|
|
|
ifeq ($(UNAME_S),Linux)
|
|
|
|
CFLAGS += -ldl
|
|
|
|
endif
|
2012-09-25 04:25:06 +08:00
|
|
|
|
2013-08-16 18:17:15 +08:00
|
|
|
ifeq ($(UNAME_S),Darwin)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2014-08-05 23:40:51 +08:00
|
|
|
all: $(ALL_PROGS)
|
2014-03-02 20:16:09 +08:00
|
|
|
|
2014-02-07 21:03:11 +08:00
|
|
|
# To enable Lua in a server, uncomment following lines
|
|
|
|
LUA = ../lua-5.2.3/src
|
2014-03-09 21:12:49 +08:00
|
|
|
#CFLAGS += -I$(LUA) -L$(LUA) -llua -DMONGOOSE_USE_LUA
|
2014-02-07 21:03:11 +08:00
|
|
|
|
2014-03-02 20:23:53 +08:00
|
|
|
server: server.c ../mongoose.c
|
|
|
|
$(CC) server.c ../mongoose.c $(OUT) $(CFLAGS)
|
|
|
|
|
2014-03-02 20:16:09 +08:00
|
|
|
hello: hello.c ../mongoose.c
|
2014-03-02 20:23:53 +08:00
|
|
|
$(CC) hello.c ../mongoose.c $(OUT) $(CFLAGS)
|
2014-03-02 20:16:09 +08:00
|
|
|
|
|
|
|
websocket: websocket_html.c websocket.c ../mongoose.c
|
2014-03-02 20:23:53 +08:00
|
|
|
$(CC) websocket.c websocket_html.c ../mongoose.c $(OUT) $(CFLAGS)
|
2014-03-02 20:16:09 +08:00
|
|
|
|
|
|
|
post: post.c ../mongoose.c
|
2014-03-02 20:23:53 +08:00
|
|
|
$(CC) post.c ../mongoose.c $(OUT) $(CFLAGS)
|
2014-03-02 20:16:09 +08:00
|
|
|
|
|
|
|
multi_threaded: multi_threaded.c ../mongoose.c
|
2014-03-02 20:23:53 +08:00
|
|
|
$(CC) multi_threaded.c ../mongoose.c $(OUT) $(CFLAGS)
|
2014-03-02 20:16:09 +08:00
|
|
|
|
|
|
|
upload: upload.c ../mongoose.c
|
2014-03-02 20:23:53 +08:00
|
|
|
$(CC) upload.c ../mongoose.c $(OUT) $(CFLAGS)
|
2014-03-02 20:16:09 +08:00
|
|
|
|
|
|
|
auth: auth.c ../mongoose.c
|
2014-03-02 20:23:53 +08:00
|
|
|
$(CC) auth.c ../mongoose.c $(OUT) $(CFLAGS)
|
2013-12-16 21:33:50 +08:00
|
|
|
|
2014-06-04 01:03:13 +08:00
|
|
|
file: file.c ../mongoose.c
|
|
|
|
$(CC) file.c ../mongoose.c $(OUT) $(CFLAGS)
|
|
|
|
|
2014-04-11 05:18:01 +08:00
|
|
|
form: form.c ../mongoose.c
|
|
|
|
$(CC) form.c ../mongoose.c $(OUT) $(CFLAGS)
|
|
|
|
|
2014-03-05 04:22:46 +08:00
|
|
|
mjpg: mjpg.c ../mongoose.c
|
|
|
|
$(CC) mjpg.c ../mongoose.c $(OUT) $(CFLAGS)
|
|
|
|
|
2014-06-10 00:26:22 +08:00
|
|
|
pubsub: websocket2.c ../mongoose.c
|
|
|
|
$(CC) websocket2.c ../mongoose.c $(OUT) $(CFLAGS)
|
|
|
|
|
2014-05-12 17:47:08 +08:00
|
|
|
proxy: proxy.c ../mongoose.c
|
2014-08-05 23:40:51 +08:00
|
|
|
$(CC) proxy.c ../mongoose.c $(OUT) -I$(NS) -DNS_ENABLE_SSL -lssl $(CFLAGS)
|
2014-03-05 04:22:46 +08:00
|
|
|
|
2014-01-17 18:17:15 +08:00
|
|
|
websocket_html.c: websocket.html
|
|
|
|
perl mkdata.pl $< > $@
|
2013-08-16 18:17:15 +08:00
|
|
|
|
2014-02-20 20:13:59 +08:00
|
|
|
u:
|
2014-04-08 02:07:41 +08:00
|
|
|
$(CC) unit_test.c $(OUT) $(CFLAGS)
|
|
|
|
./$@
|
2014-02-20 20:13:59 +08:00
|
|
|
|
2012-10-14 22:00:04 +08:00
|
|
|
clean:
|
2014-08-05 23:40:51 +08:00
|
|
|
-@$(RM) $(ALL_PROGS) websocket_html.c *.exe *.dSYM *.obj *.exp .*o *.lib u
|