mongoose/examples/http-client/Makefile

42 lines
1.3 KiB
Makefile
Raw Normal View History

2020-12-10 21:26:05 +08:00
PROG ?= example
2021-03-24 23:49:35 +08:00
ROOT ?= $(realpath $(CURDIR)/../..)
CFLAGS ?= -DMG_ENABLE_LINES $(EXTRA_CFLAGS)
2021-03-24 23:49:35 +08:00
LIN = docker run -it --rm -v $(ROOT):$(ROOT) -w $(CURDIR) mdashnet/cc2
SSL = ?
2020-12-10 21:26:05 +08:00
ifeq "$(SSL)" "MBEDTLS"
CFLAGS += -DMG_ENABLE_MBEDTLS=1 -lmbedtls -lmbedcrypto -lmbedx509
2020-12-10 21:26:05 +08:00
endif
ifeq "$(SSL)" "OPENSSL"
CFLAGS += -DMG_ENABLE_OPENSSL=1 -lssl -lcrypto
2021-01-30 21:03:11 +08:00
endif
2020-12-10 21:26:05 +08:00
all: $(PROG)
$(RUN) ./$(PROG) $(ARGS)
2020-12-10 21:26:05 +08:00
$(PROG): main.c
$(CC) ../../mongoose.c -I../.. -W -Wall $(CFLAGS) -o $(PROG) main.c
2021-03-24 23:49:35 +08:00
linux: all
linux: CFLAGS += -O2 -g -fsanitize=address,undefined,shift,null,return,bounds,alignment,object-size,bool,enum -static-libasan
linux: CC = $(LIN) cc
linux: RUN = $(LIN)
2021-03-24 23:49:35 +08:00
2022-03-21 22:38:42 +08:00
ROOT ?= $(realpath $(CURDIR)/../..)
DOCKER = docker run -it --rm -e Tmp=. -e WINEDEBUG=-all -v $(ROOT):$(ROOT) -w $(CURDIR)
WDEFS = -DMG_ENABLE_MBEDTLS -DMG_ENABLE_LINES -Imbedtls/include -Imbedtls/library $(EXTRA)
WFLAGS = /nologo -O2 -I. -I../.. ws2_32.lib advapi32.lib /link /out:$(PROG).exe
WSRCS = ../../mongoose.c main.c mbedtls/library/*.c
$(PROG).exe: main.c mbedtls
$(DOCKER) mdashnet/vc2017 wine cl $(WSRCS) $(WDEFS) $(WFLAGS)
2022-04-03 07:04:58 +08:00
vc2017: ARGS = https://cesanta.com
2022-03-21 22:38:42 +08:00
vc2017: $(PROG).exe
$(DOCKER) mdashnet/vc2017 wine $(PROG).exe $(ARGS)
mbedtls:
git clone --depth 1 -b v3.1.0 https://github.com/ARMmbed/mbedtls
2020-12-10 21:26:05 +08:00
clean:
2022-04-03 07:04:58 +08:00
rm -rf $(PROG) _CL* *.o *.dSYM *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb mbedtls