-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
451 lines (381 loc) · 23.1 KB
/
Copy pathMakefile
File metadata and controls
451 lines (381 loc) · 23.1 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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# AmiAuth build.
#
# make test build and run the host-side vector/unit tests (default)
# make cli build the CLI natively (local dev convenience)
# make smoke build the CLI and run the end-to-end CLI smoke test
# make diff build and run the OpenSSL differential fuzz harness (opt-in)
# make m68k cross-build the Amiga binary (needs amiga-gcc on PATH)
# make m68k-docker cross-build inside the CI container (no local toolchain)
# make clean
#
# The core is portable C, so `test` and `cli` build with any host compiler.
# `diff` additionally needs OpenSSL (libcrypto) as a host test dependency.
# --- Host toolchain (tests + native CLI) ---
CC ?= cc
CFLAGS ?= -std=c99 -O2 -Wall -Wextra
CObjINC := -Isrc/core
# --- m68k cross toolchain (Amiga build) ---
M68K_CC ?= m68k-amigaos-gcc
M68K_CFLAGS ?= -std=c99 -O2 -Wall -Wextra -m68000 -noixemul $(CObjINC) -Isrc/amiga
# GUI window title shows the commit hash unless this build is exactly on a
# release tag (the tag-driven release workflow always builds from a `vX.Y`
# tag, so "on a tag at all" is a reliable proxy for "this is the release
# build" in this repo). Computed on the host so gui-docker doesn't need git
# inside the container - passed through as plain make variables instead.
GIT_HASH ?= $(shell git rev-parse --short HEAD 2>/dev/null)
GIT_ON_TAG ?= $(shell git describe --tags --exact-match >/dev/null 2>&1 && echo 1)
ifneq ($(GIT_ON_TAG),1)
VERSION_DEFS := -DAMIAUTH_BUILD_HASH=\"$(GIT_HASH)\"
endif
# Containerised cross-build: same image as CI, so local m68k builds match.
DOCKER ?= docker
AMIGA_GCC_IMAGE ?= ghcr.io/sidick/amiga-dev:1
# Run as the calling user, not root: the container bind-mounts $(CURDIR), and
# without this, files it creates (build/, the m68k binaries) come out root-
# owned on Linux hosts - breaking any later non-Docker step (e.g. `make dist`)
# that needs to write into the same build/ directory. Docker Desktop on macOS
# has more forgiving bind-mount semantics, so this doesn't reproduce locally
# on every platform - found via a real CI release-workflow rehearsal (#38).
DOCKER_USER := --user "$(shell id -u):$(shell id -g)"
CORE_SRCS := $(wildcard src/core/*.c)
TEST_SRCS := $(wildcard tests/*.c)
CLI_SRCS := src/cli/main.c
# Header dependencies for the whole-program link rules below. These compile
# all sources in one compiler invocation (no per-object .d files to -include),
# so without listing headers as prerequisites, editing vault.h or the
# generated catalog_strings.h rebuilt nothing and `make test` could pass
# against a stale binary. A wildcard over every project header is coarse but
# correct - a header touch rebuilds in seconds here.
CORE_HDRS := $(wildcard src/core/*.h src/*.h)
AMIGA_HDRS := $(wildcard src/amiga/*.h)
QR_HDRS := $(wildcard src/qr/*.h)
TEST_HDRS := $(wildcard tests/*.h)
ALL_HDRS := $(CORE_HDRS) $(AMIGA_HDRS) $(QR_HDRS) $(TEST_HDRS)
# Hand-written m68k asm for the crypto hot loops (#47) - m68k builds only,
# never the host (CORE_SRCS' *.c wildcard doesn't pick these up, so nothing
# extra is needed to keep them out of `make test`/`make cli`).
ASM_SRCS := $(wildcard src/core/*.s)
# --- Vendored QR decoder (quirc, ISC) + our portable wrapper -----------------
# quirc is third-party, so it's compiled to objects with warnings OFF (it isn't
# our lint to enforce); our qr.c wrapper builds under the normal warning set.
# QUIRC_FLOAT_TYPE=float matches the m68k build (no FPU), so the host test
# exercises the exact float path that ships on the Amiga.
QUIRC_SRCS := src/qr/quirc.c src/qr/decode.c src/qr/identify.c src/qr/version_db.c
QR_WRAP := src/qr/qr.c
# QUIRC_FLOAT_TYPE=float + QUIRC_USE_TGMATH: single-precision soft-float on the
# FPU-less 68000 (quirc's identify geometry is float-heavy; the pair is what its
# docs recommend, and avoids slow double soft-float via rintf/sqrtf/fabsf).
QR_CPPFLAGS := -Isrc/qr -DQUIRC_FLOAT_TYPE=float -DQUIRC_USE_TGMATH
# --- Vendored QR encoder (qrcodegen, MIT) + our portable wrapper ------------
# qrcodegen is third-party (warnings off, same reasoning as quirc above); it's
# integer-only so no float flags are needed. Reuses the qr-host/qr-m68k object
# pattern rules below (they match any src/qr/%.c, qrcodegen.c included).
QRENC_WRAP := src/qr/qrencode.c
DIFF_SRCS := tests/diff/diff_main.c
# AmigaOS-only front-end glue (bsdsocket SNTP, ...); m68k build only. qrimage.c
# and arexx.c are GUI-only (datatypes.library / the resident ARexx port -
# the CLI is a one-shot process, nothing to serve) so both are excluded here
# and added to GUI_SRCS instead.
AMIGA_SRCS := $(filter-out src/amiga/qrimage.c src/amiga/arexx.c,$(wildcard src/amiga/*.c))
# OpenSSL flags for the differential harness (pkg-config, with a plain fallback).
OPENSSL_CFLAGS ?= $(shell pkg-config --cflags libcrypto 2>/dev/null)
OPENSSL_LIBS ?= $(shell pkg-config --libs libcrypto 2>/dev/null || echo -lcrypto)
# Iterations/primitive for `make diff` (override: make diff DIFF_ITERS=20000).
DIFF_ITERS ?= 5000
BUILD := build
# Object paths for the vendored quirc decoder (needs $(BUILD), defined above).
QUIRC_HOST_OBJS := $(patsubst src/qr/%.c,$(BUILD)/qr-host/%.o,$(QUIRC_SRCS))
QUIRC_M68K_OBJS := $(patsubst src/qr/%.c,$(BUILD)/qr-m68k/%.o,$(QUIRC_SRCS))
# Object paths for the vendored qrcodegen encoder (same qr-host/qr-m68k rules).
QRCODEGEN_HOST_OBJ := $(BUILD)/qr-host/qrcodegen.o
QRCODEGEN_M68K_OBJ := $(BUILD)/qr-m68k/qrcodegen.o
.PHONY: all test cli smoke diff m68k m68k-docker gui gui-docker gui-smoke qr-onhw qr-onhw-docker qr-onhw-smoke arexx-onhw arexx-onhw-docker arexx-onhw-smoke serialtest-m68k serialtest-m68k-docker copperline-smoke pbkdf2-bench asm-bench amissl-bench flexcat flexcat-docker catalog-strings catalog-strings-docker check-catalog catalog-onhw-smoke catalog-nolib-onhw catalog-nolib-onhw-docker asm-tests asm-tests-docker guide dist movepointer movepointer-docker clean build test-host test-target lint
all: test cli
# --- Verb contract (sidick/amiga-workflows' build-test.yml) ---------------
# ci.yml calls these five names; each build-test.yml job is independent (no
# artifact-passing between them). The named targets below (test/cli/smoke/
# m68k/gui/copperline-smoke/check-catalog/...) stay as the documented local
# entry points - README.md/CLAUDE.md/userdocs/ reference them already, so
# this adds the contract's names rather than renaming what they point to.
build: m68k gui
# "Host-side tests: vectors, portable core, vamos runs" (the verb contract's
# own definition) maps onto three previously-separate things: RFC vector
# tests + native CLI + e2e CLI smoke (host-tests job), the m68k asm crypto
# tests built here and validated via vamos below (asm-crypto-tests job) -
# one verb, not two CI jobs, since build-test.yml's test-host job already
# runs inside the amiga-dev image (has cc, m68k-amigaos-gcc, and vamos all
# at once - no need for asm-tests-docker's nested container indirection).
test-host: test cli smoke asm-tests
for cpu in 000 020; do \
echo "--- CPU $$cpu ---"; \
vamos -C "$$cpu" $(BUILD)/asm-test-sha1 || exit 1; \
done
# Matches today's copperline-smoke job exactly (RFC 4226 HOTP core on real
# m68k) - not gui-smoke/qr-onhw-smoke/arexx-onhw-smoke/catalog-onhw-smoke,
# none of which run in CI today (dev-only Copperline checks, need more
# local setup than a fresh checkout provides). AMIGA_REAL_ROM, if the
# workflow decoded one from the optional AMIGA_REAL_ROM_B64 secret, becomes
# KICK=; unset (the common case), boots Copperline's bundled AROS instead.
test-target: serialtest-m68k
KICK="$${AMIGA_REAL_ROM:-}" sh tests/copperline/run.sh
# The only static/structural check this repo has today - catalog-lint's own
# job folds in here rather than staying separate, unlike sana2loop's
# docs-build (which had no verb-contract home at all).
lint: check-catalog
# --- Host: unit / RFC-vector tests ---
test: $(BUILD)/run-tests
VAULT_TEST_FILE=$(BUILD)/amiauth-test.vault \
AMIAUTH_PREFS_DIR=$(BUILD)/prefs-test $(BUILD)/run-tests
$(BUILD)/run-tests: $(CORE_SRCS) $(TEST_SRCS) $(QR_WRAP) $(QUIRC_HOST_OBJS) $(QRENC_WRAP) $(QRCODEGEN_HOST_OBJ) $(CORE_HDRS) $(QR_HDRS) $(TEST_HDRS) | $(BUILD)/.dir
$(CC) $(CFLAGS) $(CObjINC) $(QR_CPPFLAGS) -Itests \
$(CORE_SRCS) $(TEST_SRCS) $(QR_WRAP) $(QUIRC_HOST_OBJS) \
$(QRENC_WRAP) $(QRCODEGEN_HOST_OBJ) -o $@
# Vendored quirc objects — host toolchain, warnings suppressed (third-party).
$(BUILD)/qr-host/%.o: src/qr/%.c $(QR_HDRS) | $(BUILD)/.dir
@mkdir -p $(BUILD)/qr-host
$(CC) $(CFLAGS) -w $(QR_CPPFLAGS) -c $< -o $@
# --- Host: native CLI (for local development) ---
# Named distinctly from the m68k 'AmiAuth' binary so the two don't collide on a
# case-insensitive filesystem (macOS). Includes the QR encoder (#45's CLI QR
# command): our qrencode.c wrapper + the vendored qrcodegen object.
cli: $(BUILD)/amiauth-host
$(BUILD)/amiauth-host: $(CORE_SRCS) $(CLI_SRCS) $(QRENC_WRAP) $(QRCODEGEN_HOST_OBJ) $(CORE_HDRS) $(AMIGA_HDRS) $(QR_HDRS) | $(BUILD)/.dir
$(CC) $(CFLAGS) $(CObjINC) -Isrc/qr $(CORE_SRCS) $(CLI_SRCS) \
$(QRENC_WRAP) $(QRCODEGEN_HOST_OBJ) -o $@
# --- Host: end-to-end CLI smoke test (always-unlocked round trip) ---
smoke: $(BUILD)/amiauth-host
AMIAUTH_BIN=$(BUILD)/amiauth-host sh tests/cli/smoke.sh
# --- Host: differential fuzz harness vs OpenSSL (opt-in; needs libcrypto) ---
diff: $(BUILD)/run-diff
$(BUILD)/run-diff $(DIFF_ITERS)
$(BUILD)/run-diff: $(CORE_SRCS) $(DIFF_SRCS) $(CORE_HDRS) | $(BUILD)/.dir
$(CC) $(CFLAGS) $(CObjINC) $(OPENSSL_CFLAGS) $(CORE_SRCS) $(DIFF_SRCS) \
$(OPENSSL_LIBS) -o $@
# --- m68k: Amiga CLI binary (amiga-gcc on PATH) ---
# Includes the QR encoder (#45's CLI QR command): see the qr-m68k object rule
# below (shared with the GUI's decoder build).
m68k: $(QRCODEGEN_M68K_OBJ) | $(BUILD)/.dir
$(M68K_CC) $(M68K_CFLAGS) -Isrc/qr $(CORE_SRCS) $(ASM_SRCS) $(AMIGA_SRCS) $(CLI_SRCS) \
$(QRENC_WRAP) $(QRCODEGEN_M68K_OBJ) -o $(BUILD)/AmiAuth
# Test-only CLI variant (#67): built with a bogus locale.library name, so
# catalog_open()'s OpenLibrary() genuinely fails and the on-target catalog
# test can exercise the LocaleBase==NULL fallback path without deleting the
# real locale.library from a WB clone (which breaks unrelated boot
# components - see tests/gui/catalog-onhw.sh). Never shipped.
CATALOG_NOLIB_DEFS := -DAMIAUTH_LOCALE_LIBNAME='"locale.library.nonexistent"'
catalog-nolib-onhw: $(QRCODEGEN_M68K_OBJ) | $(BUILD)/.dir
$(M68K_CC) $(M68K_CFLAGS) $(CATALOG_NOLIB_DEFS) -Isrc/qr $(CORE_SRCS) $(ASM_SRCS) $(AMIGA_SRCS) $(CLI_SRCS) \
$(QRENC_WRAP) $(QRCODEGEN_M68K_OBJ) -o $(BUILD)/AmiAuth-nolib
catalog-nolib-onhw-docker:
$(DOCKER) run --rm --platform linux/amd64 $(DOCKER_USER) -v "$(CURDIR)":/work -w /work \
$(AMIGA_GCC_IMAGE) sh -lc 'PATH=/opt/amiga/bin:$$PATH make catalog-nolib-onhw'
# --- m68k: ReAction GUI binary (Amiga only; needs intuition + ReAction classes) ---
# Includes the QR decoder: qrimage.c (datatypes glue) + our qr.c wrapper + the
# vendored quirc objects (built -w for m68k). QUIRC_FLOAT_TYPE=float: no FPU.
# arexx.c (#46) is the ARexx port's RexxMsg glue - GUI-only, see AMIGA_SRCS.
GUI_SRCS := src/gui/main.c src/amiga/qrimage.c src/amiga/arexx.c
# Vendored quirc objects — m68k toolchain, warnings suppressed (third-party).
$(BUILD)/qr-m68k/%.o: src/qr/%.c $(QR_HDRS) | $(BUILD)/.dir
@mkdir -p $(BUILD)/qr-m68k
$(M68K_CC) $(M68K_CFLAGS) -w $(QR_CPPFLAGS) -c $< -o $@
gui: $(QUIRC_M68K_OBJS) $(QRCODEGEN_M68K_OBJ) | $(BUILD)/.dir
$(M68K_CC) $(M68K_CFLAGS) $(VERSION_DEFS) $(QR_CPPFLAGS) $(CORE_SRCS) $(ASM_SRCS) $(AMIGA_SRCS) $(GUI_SRCS) \
$(QR_WRAP) $(QUIRC_M68K_OBJS) $(QRENC_WRAP) $(QRCODEGEN_M68K_OBJ) -lm -lamiga -o $(BUILD)/AmiAuthGUI
gui-docker:
$(DOCKER) run --rm --platform linux/amd64 $(DOCKER_USER) -v "$(CURDIR)":/work -w /work \
$(AMIGA_GCC_IMAGE) sh -lc 'PATH=/opt/amiga/bin:$$PATH make gui GIT_HASH=$(GIT_HASH) GIT_ON_TAG=$(GIT_ON_TAG)'
# --- Localization (#67): FlexCat (github.com/adtools/flexcat) generates
# src/core/catalog_strings.h from locale/AmiAuth.cd. FlexCat itself is a
# host-only build tool (never ships, never touches the m68k cross-compiler -
# see tools/fetch-flexcat.sh) and the generated header is checked into git
# like any other source file, so ordinary `make test`/`cli`/`m68k`/`gui`
# builds need neither FlexCat nor network access. Only re-run `make
# catalog-strings` (regenerating + committing the header) after editing
# locale/AmiAuth.cd. Needs a native (non-cross) C compiler on PATH - macOS's
# clang chokes on FlexCat's own build flags, so use `flexcat-docker` there.
flexcat: $(BUILD)/flexcat
$(BUILD)/flexcat: | $(BUILD)/.dir
src=$$(bash tools/fetch-flexcat.sh) && \
cp "$$src" $(BUILD)/flexcat && chmod +x $(BUILD)/flexcat && \
cp "$$(dirname $$src)/../sd/CatComp_h.sd" $(BUILD)/CatComp_h.sd
flexcat-docker:
$(DOCKER) run --rm --platform linux/amd64 $(DOCKER_USER) -v "$(CURDIR)":/work -w /work \
$(AMIGA_GCC_IMAGE) sh -lc 'make flexcat'
catalog-strings: $(BUILD)/flexcat
$(BUILD)/flexcat locale/AmiAuth.cd src/core/catalog_strings.h=$(BUILD)/CatComp_h.sd
# $(BUILD)/flexcat is a Linux ELF binary (built inside the container) - won't
# run directly on a macOS host, so regenerating the header locally on macOS
# needs the whole step done inside the container, not just the build half.
catalog-strings-docker:
$(DOCKER) run --rm --platform linux/amd64 $(DOCKER_USER) -v "$(CURDIR)":/work -w /work \
$(AMIGA_GCC_IMAGE) sh -lc 'make catalog-strings'
# Structural sanity checks on locale/AmiAuth.cd and any .ct translation -
# placeholder consistency, button-mnemonic uniqueness, CLI re-key prompt
# markers (tools/check_catalog.py). Pure Python, no FlexCat/Docker needed.
# Runs against every .ct this repo has, including unreviewed locale/drafts/
# ones - these are purely structural checks, not a translation-quality
# review, so there's no reason to exempt a draft from them.
check-catalog:
python3 tools/check_catalog.py locale/AmiAuth.cd $(wildcard locale/*.ct) $(wildcard locale/drafts/*.ct)
# --- Headless GUI smoke test: boot WB 3.2 under Copperline, render AmiAuthGUI --
# Boots an A1200/OS 3.2 under native Copperline, auto-launches AmiAuthGUI, and
# asserts the ReAction window rendered (screenshot in build/gui-smoke/). No VNC
# or clicking. Needs `copperline` on PATH, the paths in tests/gui/.env, and a
# prebuilt build/AmiAuthGUI (make gui-docker). See tests/gui/gui-smoke.sh.
gui-smoke: $(BUILD)/amiauth-host
sh tests/gui/gui-smoke.sh
# --- Headless on-target QR pipeline test: boot WB 3.2, load a staged QR PNG via
# datatypes.library (src/amiga/qrimage.c) + decode it (src/qr), emit the URI over
# serial. Validates the datatypes glue on real picture.datatype. Build the v39
# fallback with: make qr-onhw-docker QR_ONHW_DEFS=-DQRIMAGE_FORCE_V39
QR_ONHW_DEFS ?=
QR_ONHW_SRCS := tests/gui/qr_onhw.c src/amiga/qrimage.c $(QR_WRAP)
qr-onhw: $(QUIRC_M68K_OBJS) | $(BUILD)/.dir
$(M68K_CC) $(M68K_CFLAGS) $(QR_CPPFLAGS) $(QR_ONHW_DEFS) $(QR_ONHW_SRCS) \
$(QUIRC_M68K_OBJS) -lm -lamiga -o $(BUILD)/qr-onhw
qr-onhw-docker:
$(DOCKER) run --rm --platform linux/amd64 $(DOCKER_USER) -v "$(CURDIR)":/work -w /work \
$(AMIGA_GCC_IMAGE) sh -lc 'PATH=/opt/amiga/bin:$$PATH make qr-onhw QR_ONHW_DEFS=$(QR_ONHW_DEFS)'
qr-onhw-smoke:
sh tests/gui/qr-onhw.sh
# --- m68k via the CI container: no local toolchain needed, matches CI exactly ---
m68k-docker:
$(DOCKER) run --rm --platform linux/amd64 $(DOCKER_USER) -v "$(CURDIR)":/work -w /work \
$(AMIGA_GCC_IMAGE) sh -lc 'PATH=/opt/amiga/bin:$$PATH make m68k'
# --- m68k asm crypto tests (#47): the hand-written SHA-1 hot loop, validated
# against every existing SHA-1/HMAC/PBKDF2 RFC vector by forcing the dispatch
# pointer onto the asm before running them (tests/asm/). ChaCha20 has no asm
# path - see src/core/crypto_dispatch.h. Run under amitools' vamos (a
# separate, optional install: pip install 'amitools[vamos]' - not needed for
# any other target here).
asm-tests: $(BUILD)/asm-test-sha1
$(BUILD)/asm-test-sha1: tests/asm/test_sha1_asm.c $(CORE_SRCS) $(ASM_SRCS) $(CORE_HDRS) $(TEST_HDRS) | $(BUILD)/.dir
$(M68K_CC) $(M68K_CFLAGS) -Itests tests/asm/test_sha1_asm.c \
tests/test_sha1.c tests/test_hmac.c tests/test_pbkdf2.c tests/test_kdf.c \
$(CORE_SRCS) $(ASM_SRCS) src/amiga/prefs.c -lamiga -o $@
asm-tests-docker:
$(DOCKER) run --rm --platform linux/amd64 $(DOCKER_USER) -v "$(CURDIR)":/work -w /work \
$(AMIGA_GCC_IMAGE) sh -lc 'PATH=/opt/amiga/bin:$$PATH make asm-tests'
# --- Copperline: headless on-target core smoke test (spike) ------------------
# Boots a stock A500/68000 under Copperline, runs the RFC 4226 HOTP vectors on
# real m68k, and checks the codes it emits over serial. See tests/copperline.
# OTP core chain (hotp_sha1 -> hmac -> sha1) + the DRBG; no vault/prefs/front-end.
SERIALTEST_SRCS := src/core/otp.c src/core/hmac.c src/core/sha1.c \
src/core/sha256.c src/core/sha512.c src/core/steamguard.c \
src/core/drbg.c tests/copperline/serialtest.c
serialtest-m68k: | $(BUILD)/.dir
$(M68K_CC) $(M68K_CFLAGS) $(SERIALTEST_SRCS) -o $(BUILD)/serialtest
serialtest-m68k-docker:
$(DOCKER) run --rm --platform linux/amd64 $(DOCKER_USER) -v "$(CURDIR)":/work -w /work \
$(AMIGA_GCC_IMAGE) sh -lc 'PATH=/opt/amiga/bin:$$PATH make serialtest-m68k'
copperline-smoke: serialtest-m68k-docker
sh tests/copperline/run.sh
# --- Headless on-target ARexx port test: boot WB 3.2, launch AmiAuthGUI
# resident, run a real ARexx script (tests/copperline/arexx-probe.rexx) via
# the WB image's resident RexxMast (`rx`) against AMIAUTH.1, then relay its
# redirected output back over serial with this small m68k program (arexxtest).
# See tests/gui/arexx-onhw.sh.
arexx-onhw: | $(BUILD)/.dir
$(M68K_CC) $(M68K_CFLAGS) tests/copperline/arexxtest.c -o $(BUILD)/arexxtest
arexx-onhw-docker:
$(DOCKER) run --rm --platform linux/amd64 $(DOCKER_USER) -v "$(CURDIR)":/work -w /work \
$(AMIGA_GCC_IMAGE) sh -lc 'PATH=/opt/amiga/bin:$$PATH make arexx-onhw'
arexx-onhw-smoke:
sh tests/gui/arexx-onhw.sh
# --- Headless on-target catalog test (#67): boot WB 3.2, run AmiAuth CLI
# commands whose output is routed through MSG()/catalog_get(), with
# locale.library both present (no matching catalog - the common case) and
# entirely absent, asserting the correct English default either way. See
# tests/gui/catalog-onhw.sh for what this does/doesn't cover.
catalog-onhw-smoke:
sh tests/gui/catalog-onhw.sh
# Measure PBKDF2 throughput on a stock 68000 (informs the KDF policy). Dev-only:
# needs a Kickstart ROM (timer.device EClock isn't available under AROS).
pbkdf2-bench:
sh tests/copperline/bench.sh
# Compare the portable C SHA-1 compress function against the hand-written
# 68000 asm one (#47), same boot/CPU. Dev-only, verifies the asm path is
# actually worth its runtime-dispatch complexity.
asm-bench:
sh tests/copperline/asm-bench.sh
# Compare AmiSSL's PBKDF2-HMAC-SHA1 against the builtin one, same boot/CPU
# (issue #85 groundwork). Dev-only: needs tests/gui/.env (AMIAUTH_WB_HDD/
# AMIAUTH_ROM) and the AmiSSL SDK (auto-fetched, cached).
amissl-bench:
sh tests/copperline/amissl-bench.sh
# --- guide: AmigaGuide user documentation, generated from userdocs/ ----------
# userdocs/ is the single source of truth for user docs (published as the
# MkDocs site); this converts it for on-Amiga reading (MultiView/AmigaGuide).
guide: | $(BUILD)/.dir
python3 tools/docs2guide.py userdocs $(BUILD)/AmiAuth.guide
# --- lha: build the real LHa for UNIX (archive-capable), pinned --------------
# Homebrew's and Ubuntu's `lha` is Lhasa — extract-only, useless for packaging
# — and the last lha *release* tag (2021) no longer compiles with modern
# compilers, so build a pinned master commit from source into build/tools/.
# Needs git + autoconf/automake. Override with a known-good archiver:
# make dist LHA=/path/to/real/lha
LHA_REPO := https://github.com/jca02266/lha.git
LHA_COMMIT := 86094cb56aba34de45668f39f74fcfb61e9d7fb6
LHA ?= $(BUILD)/tools/lha
$(BUILD)/tools/lha:
@mkdir -p $(BUILD)/tools
rm -rf $(BUILD)/tools/lha-src
git clone -q $(LHA_REPO) $(BUILD)/tools/lha-src
cd $(BUILD)/tools/lha-src && \
git -c advice.detachedHead=false checkout -q $(LHA_COMMIT) && \
autoreconf -fi >/dev/null 2>&1 && ./configure >/dev/null && \
$(MAKE) >/dev/null
cp $(BUILD)/tools/lha-src/src/lha $(BUILD)/tools/lha
rm -rf $(BUILD)/tools/lha-src
# --- dist: assemble the Aminet upload pair (archive + .readme) ---------------
# Builds the m68k binaries itself (build-test.yml's dist job runs `make
# dist` standalone, with no prior `build` job's artifacts to reuse - see the
# verb-contract comment above); the lha archiver is built automatically
# (above). Produces build/dist/AmiAuth.lha (drawer with binaries, docs,
# icons) and build/dist/AmiAuth.readme alongside it — the two files Aminet
# wants. Icons: the drawer icon sits next to the drawer; the CLI
# deliberately has no icon (it is a Shell command).
#
# The $VER grep below confirms the binaries just built actually embed the
# CURRENT src/version.h AMIAUTH_VERSION - the release workflow's own
# tag-vs-source check (scripts/verify-version.sh, run before this target)
# separately confirms the git tag matches src/version.h itself, closing the
# loop: tag == src/version.h == what's actually in the binaries.
dist: build guide $(LHA)
@v=$$(sed -n 's/^#define AMIAUTH_VERSION[[:space:]]*"\(.*\)"$$/\1/p' src/version.h); \
for b in AmiAuth AmiAuthGUI; do \
grep -aqF "\$$VER: $$b $$v (" $(BUILD)/$$b || { echo "dist: $(BUILD)/$$b lacks \"\$$VER: $$b $$v (...)\" - stale build/?"; exit 1; }; \
done
rm -rf $(BUILD)/dist
mkdir -p $(BUILD)/dist/AmiAuth
cp $(BUILD)/AmiAuth $(BUILD)/AmiAuthGUI $(BUILD)/AmiAuth.guide \
LICENSE THIRDPARTY.md AmiAuth.readme $(BUILD)/dist/AmiAuth/
cp icons/AmiAuthGUI.info icons/AmiAuth.guide.info $(BUILD)/dist/AmiAuth/
cp icons/AmiAuth.info AmiAuth.readme $(BUILD)/dist/
cd $(BUILD)/dist && $(abspath $(LHA)) aq AmiAuth.lha AmiAuth AmiAuth.info
@ls -l $(BUILD)/dist/AmiAuth.lha $(BUILD)/dist/AmiAuth.readme
# --- movepointer: dev/test-only tool, cross-built from vendored source -------
# tests/tools/movepointer/ (1987, Public Domain - see its README) precisely
# positions the mouse under Copperline, working around --mouse-after's
# non-linear host-to-guest scaling (see the copperline-testing skill). Built
# from source with our own toolchain rather than trusting the original
# Aminet prebuilt binary; -w since it's third-party (mirrors quirc's
# treatment) - the warnings are 1987 K&R implicit-declarations, harmless.
movepointer: | $(BUILD)/.dir
$(M68K_CC) -w -m68000 -noixemul tests/tools/movepointer/movepointer.c \
-lamiga -o $(BUILD)/MovePointer
movepointer-docker:
$(DOCKER) run --rm --platform linux/amd64 $(DOCKER_USER) -v "$(CURDIR)":/work -w /work \
$(AMIGA_GCC_IMAGE) sh -lc 'PATH=/opt/amiga/bin:$$PATH make movepointer'
# A marker file, not $(BUILD) itself: BUILD's value is literally the string
# "build", so a target named $(BUILD) would collide with the verb-contract
# `build:` target below (Make merges prerequisites across every rule
# sharing one target name) - every one of this file's `| $(BUILD)/.dir`
# order-only prerequisites would silently gain build's own m68k+gui
# prerequisites, breaking e.g. `make test` on a host with no cross-compiler.
# Reproduced and confirmed before making this change; see amiga-dev's
# docs/plan.md Phase 3 entry for the same bug caught for real in sana2loop.
$(BUILD)/.dir:
@mkdir -p $(BUILD)/.dir
clean:
rm -rf $(BUILD)