1
1
PROG ?= ./example # Program we are building
2
- PACK ?= ./pack # Packing executable
3
2
DELETE = rm -rf # Command to remove files
4
- GZIP ?= gzip # For compressing files in web_root/
5
3
OUT ?= -o $(PROG ) # Compiler argument for output file
6
4
SOURCES = main.c mongoose.c net.c packed_fs.c # Source code files
7
5
CFLAGS = -W -Wall -Wextra -g -I. # Build options
6
+ NPX ?= npx
8
7
9
8
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
10
9
CFLAGS_MONGOOSE += -DMG_ENABLE_PACKED_FS=1
11
10
12
11
ifeq ($(OS ) ,Windows_NT) # Windows settings. Assume MinGW compiler. To use VC : make CC=cl CFLAGS=/MD OUT=/Feprog.exe
13
12
PROG = example.exe # Use .exe suffix for the binary
14
- PACK = pack.exe # Packing executable
15
13
CC = gcc # Use MinGW gcc compiler
16
14
CFLAGS += -lws2_32 # Link against Winsock library
17
15
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
18
- GZIP = echo # No gzip on Windows
19
16
endif
20
17
21
18
# Default target. Build and run program
@@ -32,14 +29,11 @@ web_root/bundle.js:
32
29
33
30
# Create optimised CSS. Prerequisite: npm -g i tailwindcss tailwindcss-font-inter
34
31
web_root/main.css : web_root/index.html $(wildcard web_root/* .js)
35
- npx tailwindcss -o $@ --minify
32
+ $( NPX ) tailwindcss -o $@ --minify
36
33
37
34
# Generate packed filesystem for serving Web UI
38
35
packed_fs.c : $(wildcard web_root/* ) $(wildcard certs/* ) Makefile web_root/main.css web_root/bundle.js
39
- $(GZIP ) web_root/*
40
- $(CC ) ../../../test/pack.c -o $(PACK )
41
- $(PACK ) web_root/* certs/* > $@
42
- $(GZIP ) -d web_root/*
36
+ node pack.js $(addsuffix ::gzip, $(wildcard web_root/* ) ) certs/* > $@
43
37
44
38
mbedtls :
45
39
git clone --depth 1 -b v2.28.2 https://github.com/mbed-tls/mbedtls $@
0 commit comments