mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-14 10:20:01 +00:00
Adopt Makefile for Windows. Update examples readme section
This commit is contained in:
1 parent
43e48d2ba6
commit
dc86c62d8b
2 files changed
+30
-39
No files matched your search
@@ -1,21 +1,28 @@
|
||||
PROG ?= example
|
||||
ROOT ?= $(realpath $(CURDIR)/../..)
|
||||
DEFS ?= -DMG_ENABLE_LINES=1 -DMG_ENABLE_IPV6=1 -DMG_ENABLE_SSI=1 -DMG_HTTP_DIRLIST_TIME=1
|
||||
CFLAGS ?= -I../.. -W -Wall $(DEFS) $(EXTRA)
|
||||
VCFLAGS = /nologo /W3 /O2 /I../.. $(DEFS) $(EXTRA) /link /incremental:no /machine:IX86
|
||||
VC98 = docker run -it --rm -e Tmp=. -v $(ROOT):$(ROOT) -w $(CURDIR) mdashnet/vc98
|
||||
SOURCES = main.c ../../mongoose.c # Source code files
|
||||
CFLAGS = -W -Wall -Wextra -g # Build options
|
||||
|
||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
||||
CFLAGS += -I ../..
|
||||
CFLAGS += -DMG_HTTP_DIRLIST_TIME=1 -DMG_ENABLE_SSI=1
|
||||
CFLAGS += -DMG_ENABLE_LINES=1 -DMG_ENABLE_IPV6=1
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
# Windows settings. Assume MinGW compiler
|
||||
PROG ?= example.exe # Use .exe suffix for the binary
|
||||
CC = gcc # Use MinGW gcc compiler
|
||||
CFLAGS += -lws2_32 # Link against Winsock library
|
||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
||||
else
|
||||
# Mac, Linux
|
||||
PROG ?= example
|
||||
DELETE = rm -rf
|
||||
endif
|
||||
|
||||
all: $(PROG)
|
||||
$(RUN) ./$(PROG) $(ARGS)
|
||||
|
||||
$(PROG): main.c Makefile
|
||||
$(CC) ../../mongoose.c main.c -I../.. $(CFLAGS) -o $@
|
||||
|
||||
mongoose.exe: main.c
|
||||
$(VC98) wine cl ../../mongoose.c main.c $(VCFLAGS) ws2_32.lib /out:$@
|
||||
|
||||
mingw:
|
||||
gcc ../../mongoose.c main.c -I../.. -W -Wall $(DEFS) -D_POSIX_C_SOURCE=200000L -lws2_32 -o mongoose.exe
|
||||
$(PROG): $(SOURCES)
|
||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_EXTRA) -o $@
|
||||
|
||||
clean:
|
||||
rm -rf $(PROG) *.o *.dSYM *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb mongoose mongoose_* mongoose.*
|
||||
$(DELETE) $(PROG) *.o *.dSYM
|
||||
Reference in new issue
Block a user