blob: f6bd7fe99ca5fdd20ac1624a845b0b78a75f0297 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
DEST=priv/static
NODE_ENV=production
JS_TARGETS=\
app.js
EDBUILD_FLAGS=--bundle --target=es2016 --minify
ESBUILD_WATCH_FLAGS=--bundle --target=es2016 --sourcemap=inline
CSS_TARGETS=\
app.css
TAILWINDCSS_FLAGS=--postcss --minify
TAILWINDCSS_WATCH_FLAGS=--postcss
DIR_TARGETS=\
assets/images:images
STATIC_TARGETS=\
assets/node_modules/@hpcc-js/wasm/dist/graphvizlib.wasm:graphvizlib.wasm\
assets/node_modules/@hpcc-js/wasm/dist/index.min.js:hpcc.wasm.min.js\
assets/images/favicon.ico:favicon.ico
.export NODE_ENV
TARGETS=
COMPRESS=
PHONIES=
.for _t in ${JS_TARGETS}
#.info "[JS] ${_t:S/^/assets\//} --> ${_t:S/^/${DEST}\//}"
${_t:S/^/${DEST}\//}: ${_t:S/^/assets\//} assets/lib
@mkdir -p ${_t:S/^/${DEST}\//:H}
cd assets; npx esbuild ${_t} ${ESBUILD_FLAGS} --outfile=../${_t:S/^/${DEST}\//}
COMPRESS+=${_t:S/^/${DEST}\//}
${_t:S/^/watch@/}:
@mkdir -p ${_t:S/^/${DEST}\//:H}
cd assets; npx esbuild ${_t:S/assets\//} --watch ${ESBUILD_WATCH_FLAGS} --outfile=../${_t:S/^/${DEST}\//}
PHONIES+=${_t:S/^/watch@/}
.endfor
.for _t in ${CSS_TARGETS}
#.info "[CSS] ${_t:S/^/assets\//} --> ${_t:S/^/${DEST}\//}"
${_t:S/^/${DEST}\//}: ${_t:S/^/assets\//} assets/css
@mkdir -p ${_t:S/^/${DEST}\//:H}
cd assets; npx tailwindcss ${TAILWINDCSS_FLAGS} -i ${_t} -o ${_t:S/^/${DEST}\//}
COMPRESS+=${_t:S/^/${DEST}\//}
${_t:S/^/watch@/}: ${_t:S/^/assets\//}
@mkdir -p ${_t:S/^/${DEST}\//:H}
cd assets; npx tailwindcss --watch ${TAILWINDCSS_WATCH_FLAGS} -i ${_t} -o ${_t:S/^/${DEST}\//}
PHONIES+=${_t:S/^/watch@/}
.endfor
.for _t in ${DIR_TARGETS}
#.info "[DIR] ${_t:C/\:.*$/\//} --> ${_t:C/^.*\:/${DEST}\//:S/$/\//}"
${_t:C/^.*\://:S/\//_/:S/^/_build\/.make-assets-dir_/}: ${_t:C/\:.*$/\//}
@mkdir -p ${_t:C/^.*\:/${DEST}\//:S/$/\//:H}
rsync --archive --delete ${_t:C/\:.*$/\//} ${_t:C/^.*\:/${DEST}\//:S/$/\//}
@touch ${_t:C/^.*\://:S/\//_/:S/^/_build\/.make-assets-dir_/}
TARGETS+=${_t:C/^.*\://:S/\//_/:S/^/_build\/.make-assets-dir_/}
.endfor
.for _t in ${STATIC_TARGETS}
#.info "[STATIC] ${_t:C/\:.*$//} -> ${_t:C/^.*\:/${DEST}\//}"
${_t:C/^.*\:/${DEST}\//}: ${_t:C/\:.*$//}
@mkdir -p ${_t:C/^.*\:/${DEST}\//:H}
cp ${_t:C/\:.*$//} ${_t:C/^.*\:/${DEST}\//}
TARGETS+=${_t:C/^.*\:/${DEST}\//}
.endfor
.for _c in ${COMPRESS}
#.info "[COMPRESS] ${_c}"
${_c:S/$/.gz/}: ${_c}
gzip --force --keep ${.ALLSRC}
TARGETS+=${_c:S/$/.gz/}
${_c:S/$/.br/}: ${_c}
brotli --force --keep ${.ALLSRC}
TARGETS+=${_c:S/$/.br/}
.endfor
#.info "Compressable: ${COMPRESS}"
#.info "Targets: ${TARGETS}"
all: ${TARGETS}
clean:
rm -r ${DEST}
.MAIN: all
.PHONY: all clean ${PHONIES}
|