Commit df311203 authored by Alexander Alashkin's avatar Alexander Alashkin Committed by Marko Mikulicic

Fix mongoose/examples compilation with mingw

    PUBLISHED_FROM=46800f43ba03082cc589d70e6118d754f4cdc9d0
parent 4927195e
......@@ -2,7 +2,10 @@
# All rights reserved
SUBDIRS = $(sort $(dir $(wildcard */)))
X = $(SUBDIRS)
ifeq ($(OS), Windows_NT)
SUBDIRS:=$(filter-out load_balancer/ netcat/ raspberry_pi_mjpeg_led/, $(SUBDIRS))
endif
.PHONY: $(SUBDIRS)
......
PROG = api_server
SOURCES = $(PROG).c sqlite3.c db_plugin_sqlite.c ../../mongoose.c
CFLAGS = -W -Wall -pthread $(CFLAGS_EXTRA)
CFLAGS = -W -Wall $(CFLAGS_EXTRA)
ifeq ($(OS), Windows_NT)
CFLAGS += -lws2_32 -D_MG_PROVIDE_STRNLEN
CC = mingw32-gcc
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
CFLAGS += -ldl -lm
CFLAGS += -ldl -lm -pthread
endif
endif
......
PROG = captive_dns_server
MODULE_CFLAGS=-DMG_ENABLE_DNS_SERVER
include ../rules.mk
MODULE_CFLAGS=-DMG_ENABLE_DNS_SERVER -DMG_ENABLE_IPV6
SSL_LIB=openssl
include ../examples.mk
PROG = coap_client
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. $(CFLAGS_EXTRA) -DMG_ENABLE_COAP
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
MODULE_CFLAGS = -DMG_ENABLE_COAP
include ../examples.mk
PROG = coap_server
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. $(CFLAGS_EXTRA) -DMG_ENABLE_COAP
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
MODULE_CFLAGS = -DMG_ENABLE_COAP
include ../examples.mk
......@@ -3,6 +3,24 @@ CFLAGS = -g -W -Wall -I../.. -Wno-unused-function $(CFLAGS_EXTRA) $(MODULE_CFLAG
all: $(PROG)
ifeq ($(OS), Windows_NT)
# TODO(alashkin): enable SSL in Windows
CFLAGS += -lws2_32 -D_MG_PROVIDE_STRNLEN
CC = mingw32-gcc
else
ifeq ($(SSL_LIB),openssl)
CFLAGS += -DMG_ENABLE_SSL -lssl -lcrypto
else ifeq ($(SSL_LIB), krypton)
CFLAGS += -DMG_ENABLE_SSL ../../../krypton/krypton.c
endif
CFLAGS += -lpthread
endif
ifeq ($(JS), yes)
V7_PATH = ../../deps/v7
CFLAGS_EXTRA += -DMG_ENABLE_JAVASCRIPT -I $(V7_PATH) $(V7_PATH)/v7.c
endif
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
......
PROG = http_client
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -DMG_ENABLE_SSL -lssl -lcrypto -pthread $(CFLAGS_EXTRA)
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
SSL_LIB=open_ssl
include ../examples.mk
PROG = json_rpc_server
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -pthread $(CFLAGS_EXTRA)
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
include ../examples.mk
PROG = mqtt_broker
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -pthread -DMG_ENABLE_SSL -DMG_ENABLE_MQTT_BROKER -lssl -lcrypto $(CFLAGS_EXTRA)
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /DMG_ENABLE_SSL /DMG_ENABLE_MQTT_BROKER /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
MODULE_CFLAGS = -DMG_ENABLE_MQTT_BROKER
SSL_LIB=open_ssl
include ../examples.mk
PROG = mqtt_client
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -pthread -DMG_ENABLE_SSL -lssl -lcrypto $(CFLAGS_EXTRA)
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /DMG_ENABLE_SSL /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
MODULE_CFLAGS = -DMG_ENABLE_MQTT_BROKER
SSL_LIB=open_ssl
include ../examples.mk
PROG = multithreaded_restful_server
SOURCES = $(PROG).c ../../mongoose.c
APP_FLAGS = -DMG_ENABLE_THREADS $(CFLAGS_EXTRA)
ifeq ($(OS), Windows_NT)
APP_FLAGS += advapi32.lib
endif
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ -W -Wall -I../.. -pthread $(APP_FLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /Fe$@ $(APP_FLAGS)
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
MODULE_CFLAGS = -DMG_ENABLE_THREADS
SSL_LIB=open_ssl
include ../examples.mk
PROG = nc
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -pthread -DMG_ENABLE_SSL -DMG_ENABLE_THREADS -lssl -lcrypto $(CFLAGS_EXTRA)
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /DMG_ENABLE_SSL /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
MODULE_CFLAGS=-DMG_ENABLE_THREADS
SSL_LIB=open_ssl
include ../examples.mk
PROG = publish_subscribe
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -DMG_ENABLE_THREADS -pthread $(CFLAGS_EXTRA)
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
MODULE_CFLAGS=-DMG_ENABLE_THREADS
include ../examples.mk
PROG = restful_client
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -pthread $(CFLAGS_EXTRA)
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
include ../examples.mk
PROG = restful_server
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. $(CFLAGS_EXTRA)
ifeq ($(SSL), openssl)
CFLAGS += -DMG_ENABLE_SSL -lssl -lcrypto -lcrypto
else ifeq ($(SSL), krypton)
CFLAGS += -DMG_ENABLE_SSL ../../../krypton/krypton.c
endif
ifeq ($(JS), yes)
V7_PATH = ../../deps/v7
CFLAGS_EXTRA += -DMG_ENABLE_JAVASCRIPT -I $(V7_PATH) $(V7_PATH)/v7.c
endif
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /DMG_ENABLE_THREADS /Fe$@ advapi32.lib
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
include ../examples.mk
PROG = restful_server_s3
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. $(CFLAGS_EXTRA)
SSL_LIB=open_ssl
include ../examples.mk
ifeq ($(SSL), openssl)
CFLAGS += -DMG_ENABLE_SSL -lssl -lcrypto -lcrypto
else ifeq ($(SSL), krypton)
CFLAGS += -DMG_ENABLE_SSL ../../../krypton/krypton.c
endif
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /DMG_ENABLE_THREADS /Fe$@ advapi32.lib
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -pthread -DMG_ENABLE_SSL -DMG_ENABLE_IPV6 -DMG_ENABLE_THREADS -lssl -lcrypto $(CFLAGS_EXTRA) $(MODULE_CFLAGS)
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -g -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /DMG_ENABLE_SSL /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
PROG = settings_panel
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -DMG_ENABLE_SSL -lssl -lcrypto $(CFLAGS_EXTRA)
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
SSL_LIB=openssl
include ../examples.mk
PROG = simplest_web_server
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. $(CFLAGS_EXTRA) -DMG_DISABLE_DAV_AUTH \
-DMG_ENABLE_FAKE_DAVLOCK
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
MODULE_CFLAGS=-DMG_DISABLE_DAV_AUTH -DMG_ENABLE_FAKE_DAVLOCK
include ../examples.mk
PROG = echo_server
SOURCES = $(PROG).c ../../mongoose.c
CFLAGS = -W -Wall -I../.. -pthread $(CFLAGS_EXTRA)
all: $(PROG)
$(PROG): $(SOURCES)
$(CC) $(SOURCES) -o $@ $(CFLAGS)
$(PROG).exe: $(SOURCES)
cl $(SOURCES) /I../.. /MD /Fe$@
clean:
rm -rf *.gc* *.dSYM *.exe *.obj *.o a.out $(PROG)
include ../examples.mk
# Copyright (c) 2014 Cesanta Software
# All rights reserved
PROG = websocket_chat
CFLAGS = -W -Wall -I../.. -pthread -g -O0 $(CFLAGS_EXTRA)
SOURCES = $(PROG).c ../../mongoose.c
$(PROG): $(SOURCES)
$(CC) -o $(PROG) $(SOURCES) $(CFLAGS)
clean:
rm -rf $(PROG) *.exe *.dSYM *.obj *.exp .*o *.lib
include ../examples.mk
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment