Win friendly #2047

This commit is contained in:
Sergio R. Caprile 2023-02-15 18:23:52 -03:00
parent 68750f3455
commit ca256b9949
2 changed files with 7 additions and 3 deletions

View File

@ -21,12 +21,14 @@ endif
all: $(PROG)
$(RUN) ./$(PROG) $(ARGS)
ifneq ($(OS),Windows_NT)
# Before embedding files, gzip them to save space
packed_fs.c: $(shell find web_root -type f) Makefile
rm -rf tmp/web_root && mkdir tmp && cp -r web_root tmp/
find tmp -type f | xargs -n1 gzip
$(CC) ../../test/pack.c -o pack
cd tmp && ../pack `find web_root -type f` > ../$@
endif
$(PROG): $(SOURCES)
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)

View File

@ -13,23 +13,25 @@ ifeq ($(OS),Windows_NT)
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
PACK = pack.exe
else
# Mac, Linux
PROG ?= example
DELETE = rm -rf
OUT ?= -o $(PROG)
PACK = ./pack
endif
all: $(PROG)
$(RUN) ./$(PROG) $(ARGS)
$(PROG): $(SOURCES) $(FILES_TO_EMBED)
$(CC) ../../test/pack.c -o pack
./pack $(FILES_TO_EMBED) > packed_fs.c
$(CC) ../../test/pack.c -o $(PACK)
$(PACK) $(FILES_TO_EMBED) > packed_fs.c
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
clean:
$(DELETE) $(PROG) *.dSYM pack
$(DELETE) $(PROG) *.dSYM $(PACK)
.PHONY: compress expand gzipped plain all