From ae703db6eef47c80df5c4e5954b25df89eaea5cb Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Wed, 15 Feb 2023 14:22:48 -0300 Subject: [PATCH] captive-dns --- examples/captive-dns-server/Makefile | 27 ++++++++++++++++++++------ examples/captive-dns-server/README.md | 2 +- examples/captive-dns-server/mongoose.c | 1 + examples/captive-dns-server/mongoose.h | 1 + 4 files changed, 24 insertions(+), 7 deletions(-) create mode 120000 examples/captive-dns-server/mongoose.c create mode 120000 examples/captive-dns-server/mongoose.h diff --git a/examples/captive-dns-server/Makefile b/examples/captive-dns-server/Makefile index 7e1e7fe2..2be9594e 100644 --- a/examples/captive-dns-server/Makefile +++ b/examples/captive-dns-server/Makefile @@ -1,11 +1,26 @@ -PROG ?= example -CFLAGS ?= -DMG_IO_SIZE=8192 -DMG_ENABLE_LINES +SOURCES = mongoose.c main.c +CFLAGS = -W -Wall -Wextra -g + +# Mongoose build options. See https://mongoose.ws/documentation/#build-options +CFLAGS += -DMG_IO_SIZE=8192 -DMG_ENABLE_LINES + +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) - $(DEBUGGER) ./$(PROG) $(ARGS) + $(RUN) ./$(PROG) $(ARGS) -$(PROG): main.c - $(CC) ../../mongoose.c -I../.. -W -Wall $(CFLAGS) -o $(PROG) main.c +$(PROG): $(SOURCES) + $(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_EXTRA) -o $@ clean: - rm -rf $(PROG) *.o *.dSYM *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb + $(DELETE) $(PROG) *.dSYM pack tmp diff --git a/examples/captive-dns-server/README.md b/examples/captive-dns-server/README.md index 376b6b32..ae860fb6 100644 --- a/examples/captive-dns-server/README.md +++ b/examples/captive-dns-server/README.md @@ -1 +1 @@ -See detailed tutorial at https://mongoose.ws/tutorials/captive-dns-portal/ +See detailed tutorial at https://mongoose.ws/tutorials/captive-dns-server/ diff --git a/examples/captive-dns-server/mongoose.c b/examples/captive-dns-server/mongoose.c new file mode 120000 index 00000000..8ef6e62d --- /dev/null +++ b/examples/captive-dns-server/mongoose.c @@ -0,0 +1 @@ +../../mongoose.c \ No newline at end of file diff --git a/examples/captive-dns-server/mongoose.h b/examples/captive-dns-server/mongoose.h new file mode 120000 index 00000000..488ef358 --- /dev/null +++ b/examples/captive-dns-server/mongoose.h @@ -0,0 +1 @@ +../../mongoose.h \ No newline at end of file