summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-26 22:10:36 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-26 22:14:53 +0200
commit76375e277603bc144ea1c572ec273bd3f3a79dcb (patch)
treeafeed68e1594e28f4d273435a812dd482376093b /Makefile
parentc2df9cc16c98db5286509e2bf6deef028b111fac (diff)
download1989-dawn-of-freedom-76375e277603bc144ea1c572ec273bd3f3a79dcb.tar.gz
Generate space and card name constants for code.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 20 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index daa5c21..fc78fed 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,21 @@
default: rules.js play.js
-rules.js: events.txt
- sed '/const CODE /,$$d' < rules.js > /tmp/rules.js
- node tools/gencode.js >> /tmp/rules.js
- cp /tmp/rules.js rules.js
-play.js: tools/layout.svg
- sed '/var LAYOUT /,$$d' < play.js > /tmp/play.js
- node tools/genlayout.js >> /tmp/play.js
- cp /tmp/play.js play.js
+
+rules.js: events.txt data.js
+ node tools/gencode.js > /tmp/events.inc
+ node tools/genconst.js > /tmp/const.inc
+ sed -i \
+ -e '/BEGIN CONST/,/END CONST/{//!d}' \
+ -e '/BEGIN CONST/r /tmp/const.inc' \
+ -e '/BEGIN EVENTS/,/END EVENTS/{//!d}' \
+ -e '/BEGIN EVENTS/r /tmp/events.inc' \
+ rules.js
+
+play.js: tools/layout.svg data.js
+ node tools/genlayout.js > /tmp/layout.inc
+ node tools/genconst.js > /tmp/const.inc
+ sed -i \
+ -e '/BEGIN CONST/,/END CONST/{//!d}' \
+ -e '/BEGIN CONST/r /tmp/const.inc' \
+ -e '/BEGIN LAYOUT/,/END LAYOUT/{//!d}' \
+ -e '/BEGIN LAYOUT/r /tmp/layout.inc' \
+ play.js