2020-12-05 19:26:32 +08:00
|
|
|
PROG ?= example
|
2022-06-09 04:44:01 +08:00
|
|
|
SOURCES ?= ../../mongoose.c main.c net.c packed_fs.c
|
2022-06-05 21:59:59 +08:00
|
|
|
CFLAGS ?= -I../.. -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_LINES=1 $(EXTRA)
|
2022-05-13 23:47:10 +08:00
|
|
|
FILES_TO_EMBED ?= $(wildcard web_root/*)
|
2022-04-20 01:46:14 +08:00
|
|
|
ROOT ?= $(realpath $(CURDIR)/../../..)
|
|
|
|
DOCKER ?= docker run --rm -e Tmp=. -e WINEDEBUG=-all -v $(ROOT):$(ROOT) -w $(CURDIR)
|
|
|
|
VC98 ?= $(DOCKER) mdashnet/vc98 wine
|
|
|
|
MINGW ?= $(DOCKER) mdashnet/mingw
|
2020-12-05 19:26:32 +08:00
|
|
|
|
2022-08-26 21:20:29 +08:00
|
|
|
ifeq "$(SSL)" "MBEDTLS"
|
|
|
|
CFLAGS += -DMG_ENABLE_MBEDTLS=1 -I$(MBEDTLS)/include -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq "$(SSL)" "OPENSSL"
|
|
|
|
CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSL)/include -L$(OPENSSL)/lib -lssl -lcrypto
|
|
|
|
endif
|
|
|
|
|
2020-12-05 19:26:32 +08:00
|
|
|
all: $(PROG)
|
2021-07-25 17:22:56 +08:00
|
|
|
$(RUN) ./$(PROG)
|
2020-12-05 19:26:32 +08:00
|
|
|
|
2022-05-20 16:45:17 +08:00
|
|
|
$(PROG): $(SOURCES) $(FILES_TO_EMBED)
|
2021-07-30 20:19:20 +08:00
|
|
|
$(CC) ../../test/pack.c -o pack
|
2021-07-26 16:05:34 +08:00
|
|
|
./pack $(FILES_TO_EMBED) > packed_fs.c
|
2022-05-13 23:47:10 +08:00
|
|
|
$(CC) -W -Wall -Wextra -O0 -g3 $(CFLAGS) -o $(PROG) $(SOURCES)
|
2021-07-25 17:22:56 +08:00
|
|
|
|
2022-04-20 01:46:14 +08:00
|
|
|
|
2022-05-20 16:45:17 +08:00
|
|
|
mingw: $(SOURCES) $(FILES_TO_EMBED)
|
2022-04-20 01:46:14 +08:00
|
|
|
$(MINGW) i686-w64-mingw32-gcc $(CFLAGS) ../../test/pack.c -o pack.exe
|
|
|
|
$(MINGW) wine cmd /c 'pack.exe $(FILES_TO_EMBED) > packed_fs.c'
|
|
|
|
$(MINGW) i686-w64-mingw32-gcc $(CFLAGS) $(SOURCES) -lws2_32 -o $(PROG).exe
|
|
|
|
$(MINGW) wine $(PROG).exe
|
|
|
|
|
2022-05-20 16:45:17 +08:00
|
|
|
vc98: $(SOURCES) $(FILES_TO_EMBED)
|
2022-04-20 01:46:14 +08:00
|
|
|
$(VC98) cl.exe /nologo $(CFLAGS) ../../test/pack.c /Fepack.exe
|
|
|
|
$(VC98) cmd /c 'pack.exe $(FILES_TO_EMBED) > packed_fs.c'
|
2022-04-20 01:51:28 +08:00
|
|
|
$(VC98) cl.exe /nologo /O2 $(CFLAGS) $(SOURCES) /Fe$(PROG).exe
|
2022-04-20 01:46:14 +08:00
|
|
|
$(VC98) $(PROG).exe
|
2020-12-05 19:26:32 +08:00
|
|
|
|
|
|
|
clean:
|
2022-05-13 23:47:10 +08:00
|
|
|
rm -rf $(PROG) *.o *.dSYM *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb log.txt pack
|