Makefile 2.17 KB
Newer Older
Sergey Lyubka's avatar
Sergey Lyubka committed
1 2 3 4 5
# Copyright (c) 2014 Cesanta Software
# All rights reserved
#
# Makefile for Mongoose web server examples

6 7 8
CFLAGS = -W -Wall -I.. -pthread -g -pipe $(CFLAGS_EXTRA)
RM = rm -rf
OUT = -o $@
Sergey Lyubka's avatar
Sergey Lyubka committed
9 10 11
ALL_PROGS = hello websocket server post multi_threaded upload auth pubsub
NS = ../../net_skeleton
SW = ../../ssl_wrapper
12

13
ifeq ($(OS),Windows_NT)
14 15 16 17 18 19 20 21 22 23 24 25
  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
26 27
else
  UNAME_S := $(shell uname -s)
28 29
  CC = g++
  CFLAGS += -lssl -g -O0
30

31 32 33
  ifeq ($(UNAME_S),Linux)
    CFLAGS += -ldl
  endif
34

35 36 37 38
  ifeq ($(UNAME_S),Darwin)
  endif
endif

Sergey Lyubka's avatar
Sergey Lyubka committed
39
all: $(ALL_PROGS)
40

Sergey Lyubka's avatar
Sergey Lyubka committed
41 42
# To enable Lua in a server, uncomment following lines
LUA    = ../lua-5.2.3/src
43
#CFLAGS += -I$(LUA) -L$(LUA) -llua -DMONGOOSE_USE_LUA
Sergey Lyubka's avatar
Sergey Lyubka committed
44

45 46 47
server: server.c ../mongoose.c
	$(CC) server.c ../mongoose.c $(OUT)  $(CFLAGS)

48
hello: hello.c ../mongoose.c
49
	$(CC) hello.c ../mongoose.c $(OUT) $(CFLAGS)
50 51

websocket: websocket_html.c websocket.c ../mongoose.c
52
	$(CC) websocket.c websocket_html.c ../mongoose.c $(OUT)  $(CFLAGS)
53 54

post: post.c ../mongoose.c
55
	$(CC) post.c ../mongoose.c $(OUT) $(CFLAGS)
56 57

multi_threaded: multi_threaded.c ../mongoose.c
58
	$(CC) multi_threaded.c ../mongoose.c $(OUT) $(CFLAGS)
59 60

upload: upload.c ../mongoose.c
61
	$(CC) upload.c ../mongoose.c $(OUT) $(CFLAGS)
62 63

auth: auth.c ../mongoose.c
64
	$(CC) auth.c ../mongoose.c $(OUT) $(CFLAGS)
65

66 67 68
file: file.c ../mongoose.c
	$(CC) file.c ../mongoose.c $(OUT) $(CFLAGS)

Sergey Lyubka's avatar
Sergey Lyubka committed
69 70 71
form: form.c ../mongoose.c
	$(CC) form.c ../mongoose.c $(OUT) $(CFLAGS)

Sergey Lyubka's avatar
Sergey Lyubka committed
72 73 74
mjpg: mjpg.c ../mongoose.c
	$(CC) mjpg.c ../mongoose.c $(OUT) $(CFLAGS)

Sergey Lyubka's avatar
Sergey Lyubka committed
75 76 77
pubsub: websocket2.c ../mongoose.c
	$(CC) websocket2.c ../mongoose.c $(OUT) $(CFLAGS)

Sergey Lyubka's avatar
Sergey Lyubka committed
78
proxy: proxy.c ../mongoose.c
Sergey Lyubka's avatar
Sergey Lyubka committed
79
	$(CC) proxy.c ../mongoose.c $(OUT) -I$(NS) -DNS_ENABLE_SSL -lssl $(CFLAGS)
Sergey Lyubka's avatar
Sergey Lyubka committed
80

81 82
websocket_html.c: websocket.html
	perl mkdata.pl $< > $@
83

84
u:
85 86
	$(CC) unit_test.c $(OUT) $(CFLAGS)
	./$@
87

Sergey Lyubka's avatar
Sergey Lyubka committed
88
clean:
Sergey Lyubka's avatar
Sergey Lyubka committed
89
	-@$(RM) $(ALL_PROGS) websocket_html.c *.exe *.dSYM *.obj *.exp .*o *.lib u