Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·374 lines (332 loc) · 21 KB
/
Copy pathMakefile
File metadata and controls
executable file
·374 lines (332 loc) · 21 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# Makefile for writhdeck modular build
# Concatenates source modules to generate standalone script files
#
# Usage:
# make # Build GUI with all (languages, schemes), CLI with en+fr, default+alt01
# make LANGUAGES="fr" # GUI: French only (English always included)
# make LANGUAGES="en fr de es" # GUI: specific languages
# make CLI_LANGUAGES="en fr de es ko no" # CLI: specific languages (by default: en fr)
# make SCHEMES="default solarized gruvbox" # GUI: specific schemes (by default: all)
# make GUI_CONFIG=no # GUI: omit config dialog (~700 lines saved)
# make GUI_SPLIT=no # GUI: omit split view / WS2 right pane (~290 lines)
# make GUI_TOC_PANEL=no # GUI: omit pinned TOC panel (~150 lines)
# make CLI_SCHEMES="default alt01" # CLI: specific schemes (by default: default alt01)
# make ANALYSIS_TOOLS=no # writhdeck.tcl/writhdeck-cli.tcl: omit analysis tools (structure, occurrences, repetitions)
# make mini MINI_ANALYSIS_TOOLS=yes # writhdeck-mini.tcl: include analysis tools (off by default)
# make jimtcl JIM_ANALYSIS_TOOLS=yes # writhdeck-jim.tcl: include analysis tools (off by default)
# make SUBDIRS_NAV=no # writhdeck.tcl/writhdeck-cli.tcl: omit subfolder navigation
# make mini MINI_SUBDIRS_NAV=yes # writhdeck-mini.tcl: include subfolder navigation (off by default)
# make TUI_THEME_EDITOR=no # writhdeck.tcl/writhdeck-cli.tcl: omit TUI theme editor (3rd tab in tui-config-dialog)
# make mini MINI_TUI_THEME_EDITOR=yes # writhdeck-mini.tcl: include TUI theme editor (off by default)
# make jimtcl JIM_TUI_THEME_EDITOR=yes # writhdeck-jim.tcl: include TUI theme editor (off by default)
# make dos # writhdeck-dos.tcl: JimTcl build with FreeDOS/NANSI.SYS display shim (see ../writhdeck-dos/NOTES.md)
# make selfx # writhdeck-selfx.tcl: self-extracting zlib build (~110 KB vs ~470 KB), Tcl/Tk 8.6+
# make reconcile-tool # writhdeck-reconcile.tcl: standalone tool to merge two .writhdeck.json files
# make GUI_RECONCILE=no # GUI: omit the --reconcile state-file-merge dialog from writhdeck.tcl
#
# Typical builds:
# make # Standard: full GUI, minimal CLI
# make mini # Compact GUI-only, en, no config dialog -> writhdeck-mini.tcl
# make LANGUAGES="en" SCHEMES="default" # Minimal: GUI en + default scheme only
# make CLI_LANGUAGES="en fr de es" CLI_SCHEMES="default solarized gruvbox everforest nord alt01" # Full CLI
AVAILABLE_LANGS := $(patsubst src/i18n/%.tcl,%,$(wildcard src/i18n/*.tcl))
AVAILABLE_SCHEMES := $(patsubst src/schemes/%.tcl,%,$(wildcard src/schemes/*.tcl))
LANGUAGES ?= $(AVAILABLE_LANGS)
CLI_LANGUAGES ?= en fr
SCHEMES ?= $(AVAILABLE_SCHEMES)
CLI_SCHEMES ?= default alt01
GUI_LANGS := en $(filter-out en,$(LANGUAGES))
CLI_LANGS := en $(filter-out en,$(CLI_LANGUAGES))
GUI_I18N_FILES := $(patsubst %,src/i18n/%.tcl,$(GUI_LANGS))
CLI_I18N_FILES := $(patsubst %,src/i18n/%.tcl,$(CLI_LANGS))
GUI_SCHEME_FILES := $(patsubst %,src/schemes/%.tcl,$(SCHEMES))
CLI_SCHEME_FILES := $(patsubst %,src/schemes/%.tcl,$(CLI_SCHEMES))
SEP := ===========================================================================
GUI_CONFIG ?= yes
GUI_CONFIG_SRC := $(if $(filter yes,$(GUI_CONFIG)),src/gui-config.tcl,)
# Split view (F3 + WS2 right pane) and pinned TOC panel (Shift+Ctrl+F11):
# optional GUI modules following the gui-config.tcl pattern (wrapped in
# if {!$::no_gui}, loaded before gui.tcl, call sites guarded with
# [info procs ...] or gated by ::split_mode / ::toc_panel_open).
# On by default everywhere (mini keeps its historical feature set).
GUI_SPLIT ?= yes
GUI_TOC_PANEL ?= yes
MINI_GUI_SPLIT ?= yes
MINI_GUI_TOC_PANEL ?= yes
GUI_SPLIT_SRC := $(if $(filter yes,$(GUI_SPLIT)),src/gui-split.tcl,)
GUI_TOC_PANEL_SRC := $(if $(filter yes,$(GUI_TOC_PANEL)),src/gui-toc-panel.tcl,)
MINI_GUI_SPLIT_SRC := $(if $(filter yes,$(MINI_GUI_SPLIT)),src/gui-split.tcl,)
MINI_GUI_TOC_PANEL_SRC := $(if $(filter yes,$(MINI_GUI_TOC_PANEL)),src/gui-toc-panel.tcl,)
# Reconcile tool (merge two .writhdeck.json state files, --reconcile fileA
# fileB): same optional-module pattern, off by default for the mini build
# (maintenance tool, not part of its historical feature set). Also buildable
# standalone via `make reconcile-tool` - see CLAUDE.build.md.
GUI_RECONCILE ?= yes
MINI_GUI_RECONCILE ?= no
GUI_RECONCILE_SRC := $(if $(filter yes,$(GUI_RECONCILE)),src/gui-reconcile.tcl,)
MINI_GUI_RECONCILE_SRC := $(if $(filter yes,$(MINI_GUI_RECONCILE)),src/gui-reconcile.tcl,)
# Analysis tools (structure outline, word occurrences, repetitions): one
# all-or-nothing module, src/analysis.tcl. On by default for writhdeck.tcl
# and writhdeck-cli.tcl; off by default for writhdeck-mini.tcl and
# writhdeck-jim.tcl. Each target has its own override variable.
ANALYSIS_TOOLS ?= yes
MINI_ANALYSIS_TOOLS ?= no
JIM_ANALYSIS_TOOLS ?= no
ANALYSIS_SRC := $(if $(filter yes,$(ANALYSIS_TOOLS)),src/analysis.tcl,)
MINI_ANALYSIS_SRC := $(if $(filter yes,$(MINI_ANALYSIS_TOOLS)),src/analysis.tcl,)
JIM_ANALYSIS_SRC := $(if $(filter yes,$(JIM_ANALYSIS_TOOLS)),src/analysis.tcl,)
# Subfolder navigation (browse subdirectories inside document folders): one
# all-or-nothing module, src/subdirs.tcl. Same default pattern as analysis:
# on for writhdeck.tcl/writhdeck-cli.tcl, off for writhdeck-mini.tcl/writhdeck-jim.tcl.
SUBDIRS_NAV ?= yes
MINI_SUBDIRS_NAV ?= no
JIM_SUBDIRS_NAV ?= no
SUBDIRS_SRC := $(if $(filter yes,$(SUBDIRS_NAV)),src/subdirs.tcl,)
MINI_SUBDIRS_SRC := $(if $(filter yes,$(MINI_SUBDIRS_NAV)),src/subdirs.tcl,)
JIM_SUBDIRS_SRC := $(if $(filter yes,$(JIM_SUBDIRS_NAV)),src/subdirs.tcl,)
# TUI theme editor (pick tui_color_* dark/light values and the
# colors/256colors/truecolor toggles from a 3rd "Theme" tab in
# tui-config-dialog, instead of hand-editing the INI): one all-or-nothing
# module, src/tui-theme-editor.tcl. Same default pattern as analysis/subdirs:
# on for writhdeck.tcl/writhdeck-cli.tcl, off for writhdeck-mini.tcl/writhdeck-jim.tcl.
TUI_THEME_EDITOR ?= yes
MINI_TUI_THEME_EDITOR ?= no
JIM_TUI_THEME_EDITOR ?= no
TUI_THEME_SRC := $(if $(filter yes,$(TUI_THEME_EDITOR)),src/tui-theme-editor.tcl,)
MINI_TUI_THEME_SRC := $(if $(filter yes,$(MINI_TUI_THEME_EDITOR)),src/tui-theme-editor.tcl,)
JIM_TUI_THEME_SRC := $(if $(filter yes,$(JIM_TUI_THEME_EDITOR)),src/tui-theme-editor.tcl,)
GUI_SRCS := src/state.tcl src/config.tcl $(GUI_SCHEME_FILES) src/common.tcl $(ANALYSIS_SRC) $(SUBDIRS_SRC) $(TUI_THEME_SRC) $(GUI_TOC_PANEL_SRC) $(GUI_SPLIT_SRC) $(GUI_CONFIG_SRC) $(GUI_RECONCILE_SRC) src/gui.tcl src/tui.tcl src/main.tcl
MINI_SCHEME_FILES := $(patsubst %,src/schemes/%.tcl,$(AVAILABLE_SCHEMES))
CLI_SRCS := src/state.tcl src/config.tcl $(CLI_SCHEME_FILES) src/common.tcl $(ANALYSIS_SRC) $(SUBDIRS_SRC) $(TUI_THEME_SRC) src/tui.tcl src/main-cli.tcl
JIM_SRCS := src/compat-jim.tcl src/state.tcl src/config.tcl $(CLI_SCHEME_FILES) src/common.tcl $(JIM_ANALYSIS_SRC) $(JIM_SUBDIRS_SRC) $(JIM_TUI_THEME_SRC) src/tui.tcl src/main-cli.tcl
DOS_SRCS := src/compat-jim.tcl src/compat-dos.tcl src/state.tcl src/config.tcl $(CLI_SCHEME_FILES) src/common.tcl $(JIM_ANALYSIS_SRC) $(JIM_SUBDIRS_SRC) $(JIM_TUI_THEME_SRC) src/tui.tcl src/main-cli.tcl
COMPACT_SCRIPT := tools/tcl-compact.tcl
# DOS-specific code (the "msdosdjgpp" branches) is wrapped in
# '# >>> DOS-ONLY' / '# <<< DOS-ONLY' markers in src/state.tcl and src/tui.tcl.
# DOS_FILTER strips those blocks from every build; the writhdeck-dos.tcl target
# overrides it to 'cat' to keep them (it is the source for the ../writhdeck-dos
# project). See CLAUDE.build.md.
STRIP_DOS := sed '/>>> DOS-ONLY/,/<<< DOS-ONLY/d'
DOS_FILTER = $(STRIP_DOS)
.PHONY: all mini clean compact compact-cli jimtcl dos sfx selfx reconcile-tool diagrams .FORCE
# "diagrams" is defined before "all"; keep plain "make" building the app.
.DEFAULT_GOAL := all
# Render media/*.mmd Mermaid diagrams to PNG (see tools/render-diagrams.sh).
diagrams:
@sh tools/render-diagrams.sh
JIMSH ?= /opt/jimsh
all: compact jimtcl writhdeck.tcl writhdeck-cli.tcl writhdeck-mini.tcl
writhdeck.tcl: src/boot.tcl $(GUI_SRCS) $(GUI_I18N_FILES) Makefile
@rm -f $@
@cat src/boot.tcl > $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "state.tcl" "$(SEP)" >> $@
@$(DOS_FILTER) src/state.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "config.tcl" "$(SEP)" >> $@
@cat src/config.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "schemes ($(SCHEMES))" "$(SEP)" >> $@
@for f in $(GUI_SCHEME_FILES); do cat $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "i18n ($(LANGUAGES))" "$(SEP)" >> $@
@for f in $(GUI_I18N_FILES); do cat $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "common.tcl" "$(SEP)" >> $@
@cat src/common.tcl >> $@
@for f in $(ANALYSIS_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "analysis.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(SUBDIRS_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "subdirs.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(TUI_THEME_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "tui-theme-editor.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(GUI_TOC_PANEL_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "gui-toc-panel.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(GUI_SPLIT_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "gui-split.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(GUI_CONFIG_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "gui-config.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(GUI_RECONCILE_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "gui-reconcile.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "gui.tcl" "$(SEP)" >> $@
@cat src/gui.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "tui.tcl" "$(SEP)" >> $@
@$(DOS_FILTER) src/tui.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "main.tcl" "$(SEP)" >> $@
@cat src/main.tcl >> $@
@chmod +x $@
@echo "Built $@ (GUI+TUI, languages: $(GUI_LANGS), schemes: $(SCHEMES)$(if $(GUI_CONFIG_SRC),, no-config))"
writhdeck-cli.tcl: src/boot-cli.tcl $(CLI_SRCS) $(CLI_I18N_FILES) Makefile
@rm -f $@
@cat src/boot-cli.tcl > $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "state.tcl" "$(SEP)" >> $@
@$(DOS_FILTER) src/state.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "config.tcl" "$(SEP)" >> $@
@cat src/config.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "schemes ($(CLI_SCHEMES))" "$(SEP)" >> $@
@for f in $(CLI_SCHEME_FILES); do cat $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "i18n ($(CLI_LANGUAGES))" "$(SEP)" >> $@
@for f in $(CLI_I18N_FILES); do sed '/>>> GUI-ONLY/,/<<< GUI-ONLY/d' $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "common.tcl" "$(SEP)" >> $@
@cat src/common.tcl >> $@
@for f in $(ANALYSIS_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "analysis.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(SUBDIRS_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "subdirs.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(TUI_THEME_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "tui-theme-editor.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "tui.tcl" "$(SEP)" >> $@
@$(DOS_FILTER) src/tui.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "main-cli.tcl" "$(SEP)" >> $@
@cat src/main-cli.tcl >> $@
@chmod +x $@
@echo "Built $@ (TUI-only, languages: $(CLI_LANGS), schemes: $(CLI_SCHEMES))"
sfx: writhdeck-jim.tcl
python3 tools/make-sfx.py $(JIMSH) writhdeck-jim.tcl writhdeck-sfx
jimtcl: writhdeck-jim.tcl
# Standalone reconcile-only tool (merge two .writhdeck.json files, see
# CLAUDE.config.md). Own boot-reconcile.tcl/main-reconcile.tcl pair (same
# pattern as boot-cli.tcl/main-cli.tcl): always GUI, no TUI, no browser/editor
# - just state.tcl + config.tcl (for `t`/theme) + gui-reconcile.tcl. English +
# French only by default; override with RECONCILE_LANGUAGES.
RECONCILE_LANGUAGES ?= en fr
RECONCILE_LANGS := en $(filter-out en,$(RECONCILE_LANGUAGES))
RECONCILE_I18N_FILES := $(patsubst %,src/i18n/%.tcl,$(RECONCILE_LANGS))
RECONCILE_SCHEME_FILES := src/schemes/default.tcl
reconcile-tool: writhdeck-reconcile.tcl
writhdeck-reconcile.tcl: src/boot-reconcile.tcl src/state.tcl src/config.tcl \
$(RECONCILE_SCHEME_FILES) $(RECONCILE_I18N_FILES) src/common.tcl \
src/gui-reconcile.tcl src/main-reconcile.tcl Makefile
@rm -f $@
@cat src/boot-reconcile.tcl > $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "state.tcl" "$(SEP)" >> $@
@$(DOS_FILTER) src/state.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "config.tcl" "$(SEP)" >> $@
@cat src/config.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "schemes (default)" "$(SEP)" >> $@
@cat $(RECONCILE_SCHEME_FILES) >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "i18n ($(RECONCILE_LANGS))" "$(SEP)" >> $@
@for f in $(RECONCILE_I18N_FILES); do cat $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "common.tcl" "$(SEP)" >> $@
@cat src/common.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "gui-reconcile.tcl" "$(SEP)" >> $@
@cat src/gui-reconcile.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "main-reconcile.tcl" "$(SEP)" >> $@
@cat src/main-reconcile.tcl >> $@
@chmod +x $@
@echo "Built $@ (reconcile-only, languages: $(RECONCILE_LANGS))"
writhdeck-jim.tcl: src/boot-jim.tcl $(JIM_SRCS) $(CLI_I18N_FILES) Makefile
@rm -f $@
@cat src/boot-jim.tcl > $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "compat-jim.tcl" "$(SEP)" >> $@
@cat src/compat-jim.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "state.tcl" "$(SEP)" >> $@
@$(DOS_FILTER) src/state.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "config.tcl" "$(SEP)" >> $@
@cat src/config.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "schemes ($(CLI_SCHEMES))" "$(SEP)" >> $@
@for f in $(CLI_SCHEME_FILES); do cat $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "i18n ($(CLI_LANGUAGES))" "$(SEP)" >> $@
@for f in $(CLI_I18N_FILES); do sed '/>>> GUI-ONLY/,/<<< GUI-ONLY/d' $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "common.tcl" "$(SEP)" >> $@
@cat src/common.tcl >> $@
@for f in $(JIM_ANALYSIS_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "analysis.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(JIM_SUBDIRS_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "subdirs.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(JIM_TUI_THEME_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "tui-theme-editor.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "tui.tcl" "$(SEP)" >> $@
@$(DOS_FILTER) src/tui.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "main-cli.tcl" "$(SEP)" >> $@
@cat src/main-cli.tcl >> $@
@chmod +x $@
@echo "Built $@ (JimTcl TUI-only, languages: $(CLI_LANGS), schemes: $(CLI_SCHEMES))"
dos: writhdeck-dos.tcl
# The DOS build is the one place that keeps the DOS-ONLY code blocks.
writhdeck-dos.tcl: DOS_FILTER = cat
writhdeck-dos.tcl: src/boot-jim.tcl $(DOS_SRCS) $(CLI_I18N_FILES) Makefile
@rm -f $@
@cat src/boot-jim.tcl > $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "compat-jim.tcl" "$(SEP)" >> $@
@cat src/compat-jim.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "compat-dos.tcl" "$(SEP)" >> $@
@cat src/compat-dos.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "state.tcl" "$(SEP)" >> $@
@$(DOS_FILTER) src/state.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "config.tcl" "$(SEP)" >> $@
@cat src/config.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "schemes ($(CLI_SCHEMES))" "$(SEP)" >> $@
@for f in $(CLI_SCHEME_FILES); do cat $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "i18n ($(CLI_LANGUAGES))" "$(SEP)" >> $@
@for f in $(CLI_I18N_FILES); do sed '/>>> GUI-ONLY/,/<<< GUI-ONLY/d' $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "common.tcl" "$(SEP)" >> $@
@cat src/common.tcl >> $@
@for f in $(JIM_ANALYSIS_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "analysis.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(JIM_SUBDIRS_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "subdirs.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@for f in $(JIM_TUI_THEME_SRC); do printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "tui-theme-editor.tcl" "$(SEP)" >> $@; cat $$f >> $@; done
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "tui.tcl" "$(SEP)" >> $@
@$(DOS_FILTER) src/tui.tcl >> $@
@printf '\n# %s\n# %s\n# %s\n' "$(SEP)" "main-cli.tcl" "$(SEP)" >> $@
@cat src/main-cli.tcl >> $@
@chmod +x $@
@echo "Built $@ (FreeDOS/JimTcl TUI-only, languages: $(CLI_LANGS), schemes: $(CLI_SCHEMES))"
compact: writhdeck.tcl writhdeck-cli.tcl
@tclsh $(COMPACT_SCRIPT) writhdeck.tcl writhdeck-compact.tcl
@chmod +x writhdeck-compact.tcl
@tclsh $(COMPACT_SCRIPT) writhdeck-cli.tcl writhdeck-cli-compact.tcl
@chmod +x writhdeck-cli-compact.tcl
compact-cli: writhdeck-cli.tcl
@tclsh $(COMPACT_SCRIPT) writhdeck-cli.tcl writhdeck-cli-compact.tcl
@chmod +x writhdeck-cli-compact.tcl
# Self-extracting, zlib-compressed single-file build (Tcl/Tk 8.6+, no external
# deps): the compact build is gzipped + base64-embedded and inflated at startup.
selfx: writhdeck-selfx.tcl
writhdeck-selfx.tcl: writhdeck.tcl $(COMPACT_SCRIPT) tools/make-selfx.tcl
@tclsh $(COMPACT_SCRIPT) writhdeck.tcl writhdeck-selfx-raw.tcl
@tclsh tools/make-selfx.tcl writhdeck-selfx-raw.tcl $@
@rm -f writhdeck-selfx-raw.tcl
@chmod +x $@
mini: writhdeck-mini.tcl
writhdeck-mini.tcl: src/boot.tcl src/state.tcl src/config.tcl $(MINI_SCHEME_FILES) \
src/i18n/en.tcl src/common.tcl $(MINI_ANALYSIS_SRC) $(MINI_SUBDIRS_SRC) $(MINI_TUI_THEME_SRC) \
$(MINI_GUI_TOC_PANEL_SRC) $(MINI_GUI_SPLIT_SRC) $(MINI_GUI_RECONCILE_SRC) src/gui.tcl src/tui.tcl src/main.tcl \
$(COMPACT_SCRIPT) Makefile
@rm -f writhdeck-mini.tcl writhdeck-mini-raw.tcl
@cat src/boot.tcl > writhdeck-mini-raw.tcl
@$(DOS_FILTER) src/state.tcl >> writhdeck-mini-raw.tcl
@cat src/config.tcl >> writhdeck-mini-raw.tcl
@for f in $(MINI_SCHEME_FILES); do cat $$f >> writhdeck-mini-raw.tcl; done
@cat src/i18n/en.tcl src/common.tcl >> writhdeck-mini-raw.tcl
@for f in $(MINI_ANALYSIS_SRC); do cat $$f >> writhdeck-mini-raw.tcl; done
@for f in $(MINI_SUBDIRS_SRC); do cat $$f >> writhdeck-mini-raw.tcl; done
@for f in $(MINI_TUI_THEME_SRC); do cat $$f >> writhdeck-mini-raw.tcl; done
@for f in $(MINI_GUI_TOC_PANEL_SRC); do cat $$f >> writhdeck-mini-raw.tcl; done
@for f in $(MINI_GUI_SPLIT_SRC); do cat $$f >> writhdeck-mini-raw.tcl; done
@for f in $(MINI_GUI_RECONCILE_SRC); do cat $$f >> writhdeck-mini-raw.tcl; done
@cat src/gui.tcl >> writhdeck-mini-raw.tcl
@$(DOS_FILTER) src/tui.tcl >> writhdeck-mini-raw.tcl
@cat src/main.tcl >> writhdeck-mini-raw.tcl
@tclsh $(COMPACT_SCRIPT) writhdeck-mini-raw.tcl writhdeck-mini.tcl
@rm writhdeck-mini-raw.tcl
@chmod +x writhdeck-mini.tcl
@echo "Built writhdeck-mini.tcl (GUI+TUI compact, en only, no config dialog$(if $(MINI_ANALYSIS_SRC), + analysis tools,)$(if $(MINI_SUBDIRS_SRC), + subdir nav,)$(if $(MINI_TUI_THEME_SRC), + TUI theme editor,))"
clean:
rm -f writhdeck.tcl writhdeck-cli.tcl writhdeck-compact.tcl writhdeck-cli-compact.tcl writhdeck-jim.tcl writhdeck-dos.tcl writhdeck-sfx writhdeck-mini.tcl writhdeck-mini-raw.tcl writhdeck-selfx.tcl writhdeck-selfx-raw.tcl writhdeck-reconcile.tcl
@echo "Cleaned build artifacts"
.PHONY: test-gui test-cli test test-i18n test-syntax test-langs test-runtime test-units lint-doc
test-gui: writhdeck.tcl
@echo "Testing writhdeck.tcl (GUI mode)..."
@wish writhdeck.tcl --help > /dev/null && echo "✓ GUI version loads"
test-cli: writhdeck-cli.tcl
@echo "Testing writhdeck-cli.tcl (TUI mode)..."
@tclsh writhdeck-cli.tcl --help > /dev/null && echo "✓ CLI version loads"
test-i18n:
@echo "Testing i18n translations..."
@tclsh tests/test-i18n.tcl
test-syntax:
@echo "Checking Tcl syntax..."
@tclsh tests/test-syntax.tcl
test-runtime: writhdeck.tcl
@echo "Running runtime checks..."
@tclsh tests/test-runtime.tcl
test-units: writhdeck-cli.tcl
@echo "Running unit tests..."
@tclsh tests/test-units.tcl
test-langs:
@echo "Testing builds with different language combinations..."
@$(MAKE) clean > /dev/null && $(MAKE) LANGUAGES="fr" > /dev/null && echo "✓ LANGUAGES=fr (includes en automatically)"
@$(MAKE) clean > /dev/null && $(MAKE) LANGUAGES="de es" > /dev/null && echo "✓ LANGUAGES=de es"
@$(MAKE) clean > /dev/null && $(MAKE) > /dev/null && echo "✓ Default build (all languages)"
test: test-i18n test-syntax test-runtime test-units test-gui test-cli test-langs
@echo ""
@echo "✓ All regression tests passed"
lint-doc:
@echo "Aligning markdown table pipes..."
@tclsh tools/align-tables.tcl writhdeck_MANUAL.md --inplace
@tclsh tools/align-tables.tcl README.md --inplace
@tclsh tools/align-tables.tcl README.fr.md --inplace
@tclsh tools/align-tables.tcl CLAUDE.md --inplace
@echo "✓ Documentation tables aligned"