aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLia Lenckowski <lialenck@protonmail.com>2023-10-25 17:24:14 +0200
committerLia Lenckowski <lialenck@protonmail.com>2023-10-25 17:24:14 +0200
commit78fd3c5c4c3f601219669dd335220441e82c8e96 (patch)
tree37f140298f005e310a9b4fcf055e94010239ea25
parent74dceb0a62758ddd409fdbb9e3fd8860a232d738 (diff)
downloadfastbangs-78fd3c5c4c3f601219669dd335220441e82c8e96.tar
fastbangs-78fd3c5c4c3f601219669dd335220441e82c8e96.tar.bz2
fastbangs-78fd3c5c4c3f601219669dd335220441e82c8e96.tar.zst
hopefully simplify makefile
-rw-r--r--.gitignore2
-rw-r--r--build/.gitignore2
-rw-r--r--deploy/.gitignore2
-rw-r--r--makefile45
4 files changed, 25 insertions, 26 deletions
diff --git a/.gitignore b/.gitignore
index 17fbd50..c8c3790 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,2 @@
.stack-work
-/deploy
-/build
frontend/fuzzysort.js
diff --git a/build/.gitignore b/build/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/build/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/deploy/.gitignore b/deploy/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/deploy/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/makefile b/makefile
index 779b17c..970217b 100644
--- a/makefile
+++ b/makefile
@@ -1,38 +1,35 @@
ESFLAGS = --target=esnext --format=esm
+.PHONY: watch-script watch-style clean all
-deploy-dir: deploy deploy/fastbangs deploy/fastbangs.yaml
+all: deploy/fastbangs deploy/fastbangs.yaml
+
+deploy/fastbangs.yaml: fastbangs.yaml
+ cp --no-clobber $< $@; true
+deploy/fastbangs: $(shell find src -name '*.hs') build/bundle.js build/index.html build/style.css
+ stack install --local-bin-path deploy
+
+build/index.html: frontend/index.html
+ cp $< $@
+build/bundle.js: $(shell find frontend -name '*.ts') frontend/fuzzysort.js
+ esbuild frontend/main.ts --bundle --outfile=build/bundle.js $(ESFLAGS)
+build/style.css: frontend/style.sass
+ sassc $< $@
+
+frontend/fuzzysort.js:
+ curl -s 'https://cdn.jsdelivr.net/npm/fuzzysort@2.0.4/fuzzysort.min.js' -o $@
-.PHONY: watch-script watch-style clean deploy-dir build-dir
watch-script: frontend/fuzzysort.js
esbuild frontend/main.ts --bundle --outfile=deploy/bundle.js $(ESFLAGS) --watch
watch-style:
while true; do make deploy/style.css; inotifywait -e modify -e move frontend/style.sass; done
+deploy.zip: all
+ zip deploy.zip -r deploy
+
clean:
stack clean --full
rm -f deploy.zip
rm -f frontend/fuzzysort.js
- rm -rf build
+ rm -rf build/*
# This leaves the deploy directory, which is intentional, as it may contain
# user data
-
-build-dir:
- mkdir -p build
-build/index.html: frontend/index.html build-dir
- cp $< $@
-build/bundle.js: $(shell find frontend -name '*.ts') frontend/fuzzysort.js build-dir
- esbuild frontend/main.ts --bundle --outfile=build/bundle.js $(ESFLAGS)
-build/style.css: frontend/style.sass build-dir
- sassc $< $@
-
-deploy.zip: deploy-dir
- zip deploy.zip -r deploy
-deploy:
- mkdir -p deploy
-deploy/fastbangs.yaml: fastbangs.yaml
- cp --no-clobber $< $@; true
-deploy/fastbangs: $(shell find src -name '*.hs') build/bundle.js build/index.html build/style.css
- stack install --local-bin-path deploy
-
-frontend/fuzzysort.js:
- curl -s 'https://cdn.jsdelivr.net/npm/fuzzysort@2.0.4/fuzzysort.min.js' -o $@