Skip to content

Commit b379816

Browse files
authored
Merge pull request #2210 from cesanta/devdash
run pack on Win
2 parents 923f2c7 + e435325 commit b379816

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

examples/device-dashboard/Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
PROG ?= example # Program we are building
2+
PACK ?= ./pack # Packing executable
23
DELETE = rm -rf # Command to remove files
34
OUT ?= -o $(PROG) # Compiler argument for output file
45
SOURCES = main.c mongoose.c net.c packed_fs.c # Source code files
@@ -7,8 +8,11 @@ CFLAGS = -W -Wall -Wextra -g -I. # Build options
78
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
89
CFLAGS_MONGOOSE += -DMG_ENABLE_PACKED_FS=1
910

11+
FILES_TO_EMBED ?= $(wildcard web_root/*)
12+
1013
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
1114
PROG ?= example.exe # Use .exe suffix for the binary
15+
PACK = pack.exe # Packing executable
1216
CC = gcc # Use MinGW gcc compiler
1317
CFLAGS += -lws2_32 # Link against Winsock library
1418
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
@@ -19,12 +23,14 @@ endif
1923
all: $(PROG) # Default target. Build and run program
2024
$(RUN) ./$(PROG) $(ARGS)
2125

22-
ifneq ($(OS),Windows_NT)
2326
# Before embedding files, gzip them to save space
24-
packed_fs.c: $(shell find web_root -type f) Makefile
27+
packed_fs.c: $(FILES_TO_EMBED) Makefile
28+
$(CC) ../../test/pack.c -o $(PACK)
29+
ifeq ($(OS),Windows_NT)
30+
$(PACK) $(FILES_TO_EMBED) > $@
31+
else
2532
rm -rf tmp/web_root && mkdir tmp && cp -r web_root tmp/
2633
find tmp -type f | xargs -n1 gzip
27-
$(CC) ../../test/pack.c -o pack
2834
cd tmp && ../pack `find web_root -type f` > ../$@
2935
endif
3036

0 commit comments

Comments
 (0)