forked from DCMX-Protocol/retro-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
138 lines (106 loc) · 5.15 KB
/
Makefile
File metadata and controls
138 lines (106 loc) · 5.15 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
SHELL := bash
NIX := nix --extra-experimental-features 'nix-command flakes'
RUN := $(NIX) develop --command
# Repos
SPACE_DIR := ../retro-sync-space
GH_REMOTE := meta-introspector
# Source inputs
LY := fixtures/lilypond/h6_west.ly
SRC := fixtures/data/hurrian_h6.txt
# Generated outputs
OUT := fixtures/output
WAV := $(OUT)/h6_west.wav
MIDI := $(OUT)/h6_west.midi
PDF := $(OUT)/h6_west.pdf
SVG_DIR := $(OUT)/nft71_svg
PNG_DIR := $(OUT)/nft71_stego_png
WASM := docs/pkg/stego_bg.wasm
.PHONY: all dev test test-stego render render-all svg stego wasm build \
witness notes erdfa pipeline deploy deploy-hf-space deploy-hf-data deploy-gh clean
all: pipeline
dev:
$(NIX) develop
# ── Tests ──────────────────────────────────────────────────────────
test:
$(RUN) cargo test -p stego
test-stego:
$(RUN) cargo test -p stego -- --nocapture
# ── Step 0: Witness + archive all sources ─────────────────────────
SOURCES_DIR := $(OUT)/sources
witness:
$(RUN) bash fixtures/scripts/witness_sources.sh $(SOURCES_DIR)
# ── Step 0b: Extract notes from witnessed audio ──────────────────
notes: witness
$(RUN) bash fixtures/scripts/extract_notes.sh $(SOURCES_DIR)/audio $(SOURCES_DIR)/analysis
# ── Step 0c: Convert all note extractions to lilypond → MIDI → WAV
ANALYSIS_DIR := $(SOURCES_DIR)/analysis
render-all: notes
@for f in $(ANALYSIS_DIR)/yt_*.notes; do \
base=$$(basename "$$f" .notes); \
python3 fixtures/scripts/notes_to_ly.py "$$f" "fixtures/lilypond/$${base}.ly"; \
done
@for ly in fixtures/lilypond/yt_*.ly; do \
base=$$(basename "$$ly" .ly); \
$(RUN) bash fixtures/scripts/render.sh "$$ly" $(OUT); \
done
# ── Step 1: LilyPond → MIDI + PDF, FluidSynth → WAV ──────────────
$(MIDI) $(PDF): $(LY)
$(RUN) bash fixtures/scripts/render.sh $(LY) $(OUT)
$(WAV): $(MIDI)
render: $(WAV)
# ── Step 2: SVG tiles ─────────────────────────────────────────────
$(SVG_DIR)/01.svg: $(SRC)
$(RUN) cargo run -p fixtures --example nft71_svg
svg: $(SVG_DIR)/01.svg
@echo "→ Open $(SVG_DIR)/gallery.html to inspect"
# ── Step 3: Stego embed → PNG ─────────────────────────────────────
$(PNG_DIR)/01.png: $(SVG_DIR)/01.svg $(WAV) $(MIDI) $(PDF)
$(RUN) cargo run -p fixtures --example nft71_stego_svg
stego: $(PNG_DIR)/01.png
# ── Step 4: WASM ──────────────────────────────────────────────────
$(WASM): libs/stego/src/lib.rs libs/stego/Cargo.toml
$(RUN) bash -c '\
cargo build -p stego --target wasm32-unknown-unknown --release --features wasm && \
wasm-bindgen target/wasm32-unknown-unknown/release/stego.wasm \
--out-dir docs/pkg --target web --no-typescript'
wasm: $(WASM)
# ── Step 5: Backend ───────────────────────────────────────────────
build:
$(RUN) cargo build --release -p backend
# ── Step 0c: Encode all artifacts as DA51 CBOR shards ────────────
erdfa: stego notes
$(RUN) cargo run --example nft71_erdfa -p fixtures
# ── Verify stego round-trip ──────────────────────────────────────
verify: stego
$(RUN) cargo run --example verify_stego -p fixtures
# ── Pipeline (test + build all artifacts) ─────────────────────────
pipeline: test stego wasm erdfa
@echo "=== pipeline complete ==="
@echo " tiles: $(PNG_DIR)/"
@echo " wasm: docs/pkg/"
@echo " svg: $(SVG_DIR)/"
@echo "Run 'make deploy' to publish"
# ── Deploy ────────────────────────────────────────────────────────
# HF Space: viewer HTML via git, binaries (tiles, wasm) via API
deploy-hf-space: pipeline
cp docs/index.html $(SPACE_DIR)/index.html
cd $(SPACE_DIR) && git add index.html && \
git commit -m "deploy: viewer $$(date -u +%Y%m%dT%H%M%SZ)" && \
git push origin main
python3 tools/upload_hf.py space
# HF Dataset: tiles via API
deploy-hf-data: pipeline
python3 tools/upload_hf.py dataset
# GitHub: commit source + docs
deploy-gh: pipeline
git add libs/stego docs/ Makefile flake.nix fixtures/examples/ fixtures/Cargo.toml tools/
git commit -m "deploy: pipeline $$(date -u +%Y%m%dT%H%M%SZ)" || true
git push $(GH_REMOTE) main
# All targets
deploy: deploy-hf-space deploy-hf-data deploy-gh
@echo "=== deployed to HF Space + Dataset + GitHub ==="
# ── Nix build ─────────────────────────────────────────────────────
nix-build:
$(NIX) build
clean:
$(RUN) cargo clean