-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (30 loc) · 804 Bytes
/
Makefile
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
OUTDIR = docs
DIST = dist
sources := $(wildcard Challenge??/index.html)
inter_dist := $(sources:%/index.html=%/$(DIST))
targets := $(sources:%=$(OUTDIR)/%)
all: $(targets) $(OUTDIR)/index.html
.SUFFIXES:
.SECONDEXPANSION:
$(inter_dist): %/$(DIST): $$(wildcard %/*.js) %/index.html
@echo "Intermediate target: $@ prereq: $^"
$(eval $@_wd := $(@:%/$(DIST)=%))
@echo Working directory: $($@_wd)
cd $($@_wd); \
pwd; \
npm install; \
npx vite build --base ./
$(targets): $(OUTDIR)/%/index.html: %/$(DIST)
@echo "Output target: $@ prereq: $^"
@echo Target directory: $(dir $@)
rm -rf $(dir $@)
cp -av $< $(dir $@)
touch $@
$(OUTDIR)/index.html: GHPageIndex/index.html
cp -av $< $@
touch $@
clean-dist:
rm -rvf $(inter_dist)
clean: clean-dist
rm -rvf $(targets:%/index.html=%)
FORCE: