mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-30 12:50:58 +00:00
update Makefiles and symlinks
This commit is contained in:
1 parent
d0e5690bfd
commit
5b46986628
30 files changed
+921
-1892
No files matched your search
@@ -1,19 +1,36 @@
|
||||
PROG ?= example
|
||||
SOURCES ?= ../../mongoose.c main.c net.c packed_fs.c
|
||||
CFLAGS ?= -I../.. -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_LINES=1 $(EXTRA_CFLAGS)
|
||||
FILES_TO_EMBED ?= $(wildcard web_root/*)
|
||||
ROOT ?= $(realpath $(CURDIR)/../../..)
|
||||
DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(ROOT):$(ROOT) -w $(CURDIR)
|
||||
VC98 ?= $(DOCKER) mdashnet/vc98 wine
|
||||
MINGW ?= $(DOCKER) mdashnet/mingw
|
||||
PROG ?= example # Program we are building
|
||||
DELETE = rm -rf # Command to remove files
|
||||
OUT ?= -o $(PROG) # Compiler argument for output file
|
||||
SOURCES = main.c mongoose.c net.c packed_fs.c # Source code files
|
||||
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
||||
|
||||
all: $(PROG)
|
||||
$(RUN) ./$(PROG)
|
||||
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
||||
CFLAGS_MONGOOSE += -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_LINES=1
|
||||
|
||||
$(PROG): $(SOURCES) $(FILES_TO_EMBED)
|
||||
ifeq ($(OS),Windows_NT) # 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
|
||||
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
|
||||
endif
|
||||
|
||||
all: $(PROG) # Default target. Build and run program
|
||||
$(RUN) ./$(PROG) $(ARGS)
|
||||
|
||||
ifneq ($(OS),Windows_NT)
|
||||
# Before embedding files, gzip them to save space
|
||||
packed_fs.c: $(shell find web_root -type f) Makefile
|
||||
rm -rf tmp/web_root && mkdir tmp && cp -r web_root tmp/
|
||||
find tmp -type f | xargs -n1 gzip
|
||||
$(CC) ../../test/pack.c -o pack
|
||||
./pack $(FILES_TO_EMBED) > packed_fs.c
|
||||
$(CC) -W -Wall -Wextra -O0 -g3 $(CFLAGS) -o $(PROG) $(SOURCES)
|
||||
cd tmp && ../pack `find web_root -type f` > ../$@
|
||||
endif
|
||||
|
||||
$(PROG): $(SOURCES) # Build program from sources
|
||||
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
||||
|
||||
clean: # Cleanup. Delete built program and all build artifacts
|
||||
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM pack tmp
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf $(PROG) *.o *.dSYM *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb log.txt pack config.json
|
||||
@@ -3,14 +3,14 @@
|
||||
This example is a demonstration of how Mongoose Library could be integrated
|
||||
into an embedded device and provide a UART-to-Network bridge capability:
|
||||
|
||||
- A device opens listening TCP port and Websocket port and waits for connections
|
||||
- The device opens listening TCP and Websocket ports and waits for connections
|
||||
- When a client connects, data is exchanged with the device's UART
|
||||
- Everything that client send, is sent to the UART
|
||||
- Everything the client sends, is sent to the UART
|
||||
- Everything that is read from the UART, gets sent to the client
|
||||
- Multiple clients are allowed
|
||||
- Live UART console allows to talk to the UART from the web page
|
||||
- Web UI is hardcoded into the binary and does not need a filesystem
|
||||
|
||||
# Screenshots
|
||||
|
||||

|
||||
|
||||
See a detailed tutorial at https://mongoose.ws/tutorials/uart-bridge/
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../mongoose.c
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../mongoose.h
|
||||
@@ -202,7 +202,8 @@ void uart_bridge_fn(struct mg_connection *c, int ev, void *ev_data,
|
||||
s_state.mqtt.enable ? "true" : "false", "rx", s_state.rx,
|
||||
"tx", s_state.tx, "baud", s_state.baud);
|
||||
} else {
|
||||
struct mg_http_serve_opts opts = {0};
|
||||
struct mg_http_serve_opts opts;
|
||||
memset(&opts, 0, sizeof(opts));
|
||||
#if 1
|
||||
opts.root_dir = "/web_root";
|
||||
opts.fs = &mg_fs_packed;
|
||||
|
||||
+705
-1799
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user