Add struct mg_queue and API, change examples/multi-threaded, add tests

This commit is contained in:
cpq committed 2023-02-11 13:24:26 +00:00
1 parent c0f4bde5fc
commit bf9d69ab56
20 files changed
+427 -94

No files matched your search

+21 -12
View File
@@ -1,17 +1,26 @@
PROG ?= example
ROOT ?= $(realpath $(CURDIR)/../..)
CWD ?= $(realpath $(CURDIR))
DOCKER ?= docker run --rm -it -e Tmp=. -e WINEDEBUG=-all -v $(ROOT):$(ROOT) -w $(CWD)
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_ATOMIC=1
ifeq ($(OS),Windows_NT)
# Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD
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 /f /q /s # Command prompt command to delete files
else
# Mac, Linux
PROG ?= example
DELETE = rm -rf
endif
all: $(PROG)
$(RUN) ./$(PROG)
$(RUN) ./$(PROG) $(ARGS)
$(PROG):
$(CC) ../../mongoose.c -I../.. -pthread $(CFLAGS) -o $(PROG) main.c
$(PROG).exe:
$(DOCKER) mdashnet/vc98 wine cl ../../mongoose.c main.c -I../.. /MD ws2_32.lib /Fe$@
$(DOCKER) mdashnet/vc98 wine $@
$(PROG): $(SOURCES)
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) -o $@
clean:
rm -rf $(PROG) *.o *.dSYM *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb log.txt
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM