diff --git a/examples/complete/Makefile b/examples/complete/Makefile index 0994721b..fcd52d6c 100644 --- a/examples/complete/Makefile +++ b/examples/complete/Makefile @@ -2,6 +2,10 @@ PROG ?= example SOURCES ?= ../../mongoose.c main.c mjson.c packed_fs.c CFLAGS ?= -I../.. -DMG_ENABLE_PACKED_FS=1 $(EXTRA) FILES_TO_EMBED ?= $(wildcard web_root/*.js) $(wildcard web_root/*.css) $(wildcard web_root/*.html) $(wildcard web_root/images/*.png) $(wildcard images/*.jpg) +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 all: $(PROG) $(RUN) ./$(PROG) @@ -11,13 +15,18 @@ $(PROG): ./pack $(FILES_TO_EMBED) > packed_fs.c $(CC) -W -Wall -Wextra -Os -g3 $(CFLAGS) -o $(PROG) $(SOURCES) -ROOT ?= $(realpath $(CURDIR)/../..) -DOCKER ?= docker run -it --rm -e Tmp=. -e WINEDEBUG=-all -v $(ROOT):$(ROOT) -w $(CURDIR) mdashnet/vc98 wine -windows: - $(DOCKER) cl.exe /nologo $(CFLAGS) ../../test/pack.c /Fepack.exe - $(DOCKER) cmd /c 'pack.exe $(FILES_TO_EMBED) > packed_fs.c' - $(DOCKER) cl.exe /nologo /O2 $(CFLAGS) $(SOURCES) ws2_32.lib /Fe$(PROG).exe - $(DOCKER) $(PROG).exe + +mingw: + $(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 + +vc98: + $(VC98) cl.exe /nologo $(CFLAGS) ../../test/pack.c /Fepack.exe + $(VC98) cmd /c 'pack.exe $(FILES_TO_EMBED) > packed_fs.c' + $(VC98) cl.exe /nologo /O2 $(CFLAGS) $(SOURCES) ws2_32.lib -o $(PROG).exe + $(VC98) $(PROG).exe clean: rm -rf $(PROG) *.o *.dSYM *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb log.txt packed_fs.c pack diff --git a/test/pack.c b/test/pack.c index 225da46b..312e7f37 100644 --- a/test/pack.c +++ b/test/pack.c @@ -24,6 +24,15 @@ #include #include +#if defined(_WIN32) +#undef popen +#undef pclose +#undef snprintf +#define snprintf _snprintf +#define popen(a, b) _popen((a), (b)) +#define pclose(a) _pclose(a) +#endif + static const char *code = "const char *mg_unpack(const char *path, size_t *size, time_t *mtime);\n" "const char *mg_unlist(size_t no);\n"