mirror of
https://github.com/cesanta/mongoose.git
synced 2025-07-30 17:36:14 +08:00
commit
59013e62d3
@ -1,26 +1,28 @@
|
|||||||
SOURCES = mongoose.c main.c
|
SOURCES = main.c mongoose.c # Source code files
|
||||||
CFLAGS = -W -Wall -Wextra -g
|
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
||||||
|
|
||||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
||||||
CFLAGS += -DMG_IO_SIZE=8192 -DMG_ENABLE_LINES
|
CFLAGS_MONGOOSE += -DMG_IO_SIZE=8192 -DMG_ENABLE_LINES
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
# Windows settings. Assume MinGW compiler
|
# Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
||||||
PROG ?= example.exe # Use .exe suffix for the binary
|
PROG ?= example.exe # Use .exe suffix for the binary
|
||||||
CC = gcc # Use MinGW gcc compiler
|
CC = gcc # Use MinGW gcc compiler
|
||||||
CFLAGS += -lws2_32 # Link against Winsock library
|
CFLAGS += -lws2_32 # Link against Winsock library
|
||||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
||||||
|
OUT ?= -o $(PROG) # Build output
|
||||||
else
|
else
|
||||||
# Mac, Linux
|
# Mac, Linux
|
||||||
PROG ?= example
|
PROG ?= example
|
||||||
DELETE = rm -rf
|
DELETE = rm -rf
|
||||||
|
OUT ?= -o $(PROG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: $(PROG)
|
all: $(PROG)
|
||||||
$(RUN) ./$(PROG) $(ARGS)
|
$(RUN) ./$(PROG) $(ARGS)
|
||||||
|
|
||||||
$(PROG): $(SOURCES)
|
$(PROG): $(SOURCES)
|
||||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_EXTRA) -o $@
|
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(DELETE) $(PROG) *.dSYM pack tmp
|
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
SOURCES = ../../mongoose.c main.c net.c packed_fs.c
|
SOURCES = mongoose.c main.c net.c packed_fs.c # Source code files
|
||||||
CFLAGS = -W -Wall -Wextra -g
|
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
||||||
|
|
||||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
||||||
CFLAGS += -I ../.. -DMG_ENABLE_PACKED_FS=1
|
CFLAGS_MONGOOSE += -DMG_ENABLE_PACKED_FS=1
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
# Windows settings. Assume MinGW compiler
|
# Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
||||||
PROG ?= example.exe # Use .exe suffix for the binary
|
PROG ?= example.exe # Use .exe suffix for the binary
|
||||||
CC = gcc # Use MinGW gcc compiler
|
CC = gcc # Use MinGW gcc compiler
|
||||||
CFLAGS += -lws2_32 # Link against Winsock library
|
CFLAGS += -lws2_32 # Link against Winsock library
|
||||||
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
||||||
|
OUT ?= -o $(PROG) # Build output
|
||||||
else
|
else
|
||||||
# Mac, Linux
|
# Mac, Linux
|
||||||
PROG ?= example
|
PROG ?= example
|
||||||
DELETE = rm -rf
|
DELETE = rm -rf
|
||||||
|
OUT ?= -o $(PROG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: $(PROG)
|
all: $(PROG)
|
||||||
@ -27,7 +29,7 @@ packed_fs.c: $(shell find web_root -type f) Makefile
|
|||||||
cd tmp && ../pack `find web_root -type f` > ../$@
|
cd tmp && ../pack `find web_root -type f` > ../$@
|
||||||
|
|
||||||
$(PROG): $(SOURCES)
|
$(PROG): $(SOURCES)
|
||||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_EXTRA) -o $@
|
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(DELETE) $(PROG) *.dSYM pack tmp
|
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM pack tmp
|
||||||
|
1
examples/device-dashboard/mongoose.c
Symbolic link
1
examples/device-dashboard/mongoose.c
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../mongoose.c
|
1
examples/device-dashboard/mongoose.h
Symbolic link
1
examples/device-dashboard/mongoose.h
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../mongoose.h
|
@ -1,38 +1,39 @@
|
|||||||
PROG ?= example
|
SOURCES = mongoose.c main.c packed_fs.c # Source code files
|
||||||
SOURCES ?= ../../mongoose.c main.c packed_fs.c
|
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
||||||
CFLAGS ?= -I../.. -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_LINES=1 $(EXTRA)
|
|
||||||
|
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
||||||
|
CFLAGS_MONGOOSE += -DMG_ENABLE_PACKED_FS=1
|
||||||
|
|
||||||
FILES_TO_EMBED ?= $(wildcard web_root/*)
|
FILES_TO_EMBED ?= $(wildcard web_root/*)
|
||||||
ROOT ?= $(realpath $(CURDIR)/../../..)
|
|
||||||
DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(ROOT):$(ROOT) -w $(CURDIR)
|
ifeq ($(OS),Windows_NT)
|
||||||
VC98 ?= $(DOCKER) mdashnet/vc98 wine
|
# Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
|
||||||
MINGW ?= $(DOCKER) mdashnet/mingw
|
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
|
||||||
|
OUT ?= -o $(PROG) # Build output
|
||||||
|
else
|
||||||
|
# Mac, Linux
|
||||||
|
PROG ?= example
|
||||||
|
DELETE = rm -rf
|
||||||
|
OUT ?= -o $(PROG)
|
||||||
|
endif
|
||||||
|
|
||||||
all: $(PROG)
|
all: $(PROG)
|
||||||
$(RUN) ./$(PROG)
|
$(RUN) ./$(PROG) $(ARGS)
|
||||||
|
|
||||||
$(PROG): $(SOURCES) $(FILES_TO_EMBED)
|
$(PROG): $(SOURCES) $(FILES_TO_EMBED)
|
||||||
$(CC) ../../test/pack.c -o pack
|
$(CC) ../../test/pack.c -o pack
|
||||||
./pack $(FILES_TO_EMBED) > packed_fs.c
|
./pack $(FILES_TO_EMBED) > packed_fs.c
|
||||||
$(CC) -W -Wall -Wextra -O0 -g3 $(CFLAGS) -o $(PROG) $(SOURCES)
|
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
||||||
|
|
||||||
|
|
||||||
mingw: $(SOURCES) $(FILES_TO_EMBED)
|
|
||||||
$(MINGW) i686-w64-mingw32-gcc $(CFLAGS) ../../test/pack.c -o pack.exe
|
|
||||||
$(MINGW) wine cmd /c 'pack.exe $(FILES_TO_EMBED) > packed_fs.c'
|
|
||||||
$(MINGW) i686-w64-mingw32-gcc $(CFLAGS) $(SOURCES) -lws2_32 -o $(PROG).exe
|
|
||||||
$(MINGW) wine $(PROG).exe
|
|
||||||
|
|
||||||
vc98: $(SOURCES) $(FILES_TO_EMBED)
|
|
||||||
$(VC98) cl.exe /nologo $(CFLAGS) ../../test/pack.c /Fepack.exe
|
|
||||||
$(VC98) cmd /c 'pack.exe $(FILES_TO_EMBED) > packed_fs.c'
|
|
||||||
$(VC98) cl.exe /nologo /O2 $(CFLAGS) $(SOURCES) /Fe$(PROG).exe
|
|
||||||
$(VC98) $(PROG).exe
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(PROG) *.o *.dSYM *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb log.txt pack
|
$(DELETE) $(PROG) *.dSYM pack
|
||||||
|
|
||||||
.PHONY: compress expand gzipped plain all
|
.PHONY: compress expand gzipped plain all
|
||||||
|
|
||||||
|
# See tutorial
|
||||||
gzipped: compress
|
gzipped: compress
|
||||||
$(MAKE) all
|
$(MAKE) all
|
||||||
|
|
||||||
|
1
examples/embedded-filesystem/README.md
Normal file
1
examples/embedded-filesystem/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
See detailed tutorial at https://mongoose.ws/tutorials/embedded-filesystem/
|
1
examples/embedded-filesystem/mongoose.c
Symbolic link
1
examples/embedded-filesystem/mongoose.c
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../mongoose.c
|
1
examples/embedded-filesystem/mongoose.h
Symbolic link
1
examples/embedded-filesystem/mongoose.h
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../mongoose.h
|
Loading…
Reference in New Issue
Block a user