mongoose/tutorials/mqtt/mqtt-client-aws-iot/Makefile

42 lines
1.4 KiB
Makefile
Raw Normal View History

PROG ?= client # Program we are building
2023-02-22 03:05:25 +08:00
DELETE = rm -rf # Command to remove files
OUT ?= -o $(PROG) # Compiler argument for output file
CFLAGS = -W -Wall -Wextra -g -I. # Build options
2024-11-10 16:45:34 +08:00
SOURCES = main.c mongoose.c mongoose_fs.c
CFLAGS_EXTRA ?= -DMG_TLS=MG_TLS_BUILTIN
2023-02-22 03:05:25 +08:00
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
2024-11-10 16:45:34 +08:00
CFLAGS_MONGOOSE += -DMG_ENABLE_PACKED_FS=1
2023-02-22 03:05:25 +08:00
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
PROG ?= client.exe # Use .exe suffix for the binary
2023-02-22 03:05:25 +08:00
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)
endif
2024-11-10 16:45:34 +08:00
all: $(PROG)
2023-02-22 03:05:25 +08:00
$(RUN) ./$(PROG) $(ARGS)
2024-11-10 16:45:34 +08:00
$(PROG): $(SOURCES) Makefile
2023-02-22 03:05:25 +08:00
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
csr: FORCE
2024-11-10 16:45:34 +08:00
openssl ecparam -noout -name prime256v1 -genkey -out key.pem
openssl req -new -key key.pem -subj /CN=Mongoose -out crt.csr
2024-11-10 16:45:34 +08:00
mongoose_fs.c: ca.pem crt.pem key.pem
node ../../../test/pack.js ca.pem crt.pem key.pem > $@
2024-11-10 16:45:34 +08:00
clean:
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM mbedtls
# For automated test purposes only
example: FORCE
touch mongoose_fs.c
FORCE: