Skip to content
Snippets Groups Projects
Makefile 2.03 KiB
Newer Older
Sergey Lyubka's avatar
Sergey Lyubka committed
# Copyright (c) 2014 Cesanta Software
# All rights reserved
#
# Makefile for Mongoose web server examples

CFLAGS = -W -Wall -I.. -pthread -g -pipe $(CFLAGS_EXTRA)
RM = rm -rf
OUT = -o $@
Sergey Lyubka's avatar
Sergey Lyubka committed
ALL_PROGS = hello websocket server post multi_threaded upload auth pubsub
NS = ../../net_skeleton
SW = ../../ssl_wrapper
ifeq ($(OS),Windows_NT)
  MSVC = ../../vc6
Sergey Lyubka's avatar
Sergey Lyubka committed
  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
  UNAME_S := $(shell uname -s)
  CC = g++
  CFLAGS += -lssl -g -O0
  ifeq ($(UNAME_S),Linux)
    CFLAGS += -ldl
  endif
  ifeq ($(UNAME_S),Darwin)
  endif
endif

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

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

hello: hello.c ../mongoose.c
	$(CC) hello.c ../mongoose.c $(OUT) $(CFLAGS)

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

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

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

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

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

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

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

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

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

websocket_html.c: websocket.html
	perl mkdata.pl $< > $@
	$(CC) unit_test.c $(OUT) $(CFLAGS)
	./$@
Sergey Lyubka's avatar
Sergey Lyubka committed
clean:
Sergey Lyubka's avatar
Sergey Lyubka committed
	-@$(RM) $(ALL_PROGS) websocket_html.c *.exe *.dSYM *.obj *.exp .*o *.lib u