-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (35 loc) · 1.4 KB
/
Makefile
File metadata and controls
45 lines (35 loc) · 1.4 KB
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
LIBRARIES = elm/core/1.0.5 elmcraft/core-extra/2.2.0
.PHONY: all
all: generated/Core/Basics.elm
KERNEL_PATH = build/src/elm/kernel/0.0.0
generated/Core/Basics.elm: codegen/Gen/Basics.elm codegen/Generate.elm node_modules/elm-codegen/bin/elm-codegen $(patsubst %,build/src/%/elm.json,$(LIBRARIES)) $(KERNEL_PATH)/src/Elm/Kernel/List.elm
yarn elm-codegen run --flags-from build/src
codegen/Gen/Basics.elm: codegen/elm.codegen.json node_modules/elm-codegen/bin/elm-codegen $(wildcard helpers/*.elm)
yarn elm-codegen install
node_modules/elm-codegen/bin/elm-codegen: package.json yarn.lock
yarn install
touch -c $@
.PRECIOUS: build/%.tar.gz
build/%.tar.gz:
set -e &&\
NAME=$$(echo $* | cut -d/ -f1,2) &&\
VERSION=$$(echo $* | cut -d/ -f3) &&\
mkdir -p $(dir $@) &&\
curl -sSL https://github.com/$$NAME/archive/refs/tags/$$VERSION.tar.gz -o $@
build/src/%/elm.json: build/%.tar.gz
mkdir -p $(@D)
tar -xf $< --strip-components=1 -C $(@D) -m
$(KERNEL_PATH)/src/Elm/Kernel/List.elm: $(wildcard codegen/Elm/Kernel/*.elm)
mkdir -p $(KERNEL_PATH)/src
cp -r codegen/Elm $(KERNEL_PATH)/src
ALL_GENERATED = $(shell find generated -type f -name '*.elm')
ALL_SRC = $(shell find src -type f -name '*.elm')
dist/ui.js: src/UI.elm $(ALL_SRC) generated/Core/Basics.elm $(ALL_GENERATED)
elm make $< --output $@
.PHONY: measure
measure: dist/ui.js
du -sh $^
gzip -9 $^
du -sh $^.gz
gunzip $^
npx elmjs-inspect $^ | head -10