Add support for MS Azure MQTT

This commit is contained in:
cpq committed 2026-10-05 12:41:56 +01:00
1 parent da82df2041
commit cf9d56be79
10 files changed
+381 -145

No files matched your search

+21 -16
View File
@@ -1,27 +1,32 @@
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 mongoose_mqtt.c packed_fs.c # Source code files, packed_fs.c contains ca.pem, which contains CA certs for TLS
CFLAGS = -W -Wall -Wextra -g -I. # Build options
REPO_ROOT ?= ../../..
PROG ?= example
DELETE = rm -rf
OUT ?= -o $(PROG)
CFLAGS = -W -Wall -Wextra -g -I. -I$(REPO_ROOT)
SOURCES = main.c mongoose_mqtt.c $(REPO_ROOT)/mongoose.c
# Mongoose build options. See https://mongoose.ws/docs/getting-started/build-options/
CFLAGS_EXTRA ?= -DMG_TLS=MG_TLS_BUILTIN
CFLAGS_MONGOOSE += -DMG_TLS=MG_TLS_BUILTIN
CFLAGS_MONGOOSE += -DMG_ENABLE_LINES=1
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
MAKE += WINDOWS=1 CC=$(CC)
# This is for Azure - it just cannot Chacha20
CFLAGS_MONGOOSE += -DMG_ENABLE_CHACHA20=0
# Windows settings. Assume MinGW compiler.
# To use VS compiler, run: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
ifeq ($(OS),Windows_NT)
PROG ?= example.exe
CC = gcc
CFLAGS += -lws2_32
DELETE = cmd /C del /Q /F /S
OUT ?= -o $(PROG)
endif
all: $(PROG) # Default target. Build and run program
all: $(PROG)
$(RUN) ./$(PROG) $(ARGS)
$(PROG): $(SOURCES) # Build program from sources
$(PROG): $(SOURCES)
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
clean: # Cleanup. Delete built program and all build artifacts
clean:
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM mbedtls