2023-02-17 03:50:06 +08:00
|
|
|
SOURCES = main.c mongoose.c # Source code files
|
|
|
|
CFLAGS = -W -Wall -Wextra -g -I. # Build options
|
|
|
|
|
|
|
|
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
|
|
|
CFLAGS_MONGOOSE += -DMG_ENABLE_LINES=1
|
2020-12-10 21:26:05 +08:00
|
|
|
|
2023-02-17 03:50:06 +08:00
|
|
|
SSL = ?
|
2022-06-21 01:50:45 +08:00
|
|
|
ifeq "$(SSL)" "MBEDTLS"
|
2023-02-17 03:50:06 +08:00
|
|
|
CFLAGS += -lmbedtls -lmbedcrypto -lmbedx509
|
|
|
|
CFLAGS_MONGOOSE += -DMG_ENABLE_MBEDTLS=1
|
2020-12-10 21:26:05 +08:00
|
|
|
endif
|
2022-06-21 01:50:45 +08:00
|
|
|
ifeq "$(SSL)" "OPENSSL"
|
2023-02-17 03:50:06 +08:00
|
|
|
CFLAGS += -lssl -lcrypto
|
|
|
|
CFLAGS_MONGOOSE += -DMG_ENABLE_OPENSSL=1
|
|
|
|
endif
|
|
|
|
|
|
|
|
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
|
|
|
|
else
|
|
|
|
# Mac, Linux
|
|
|
|
PROG ?= example
|
|
|
|
DELETE = rm -rf
|
|
|
|
OUT ?= -o $(PROG)
|
2021-01-30 21:03:11 +08:00
|
|
|
endif
|
|
|
|
|
2020-12-10 21:26:05 +08:00
|
|
|
all: $(PROG)
|
2021-08-29 23:53:29 +08:00
|
|
|
$(RUN) ./$(PROG) $(ARGS)
|
2020-12-10 21:26:05 +08:00
|
|
|
|
2023-02-17 03:50:06 +08:00
|
|
|
$(PROG): $(SOURCES)
|
|
|
|
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
2022-03-21 22:38:42 +08:00
|
|
|
|
2020-12-10 21:26:05 +08:00
|
|
|
clean:
|
2023-02-17 03:50:06 +08:00
|
|
|
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM
|