summaryrefslogtreecommitdiff
path: root/Makefile
blob: 78a06f10be18904bf9e33df57dacdf3b32f2d4c3 (plain) (blame)
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
.PHONY: fossil build start preview test test-fossil-org test-upstream test-org test-smoke test-visual clean

BUILD_DIR := $(CURDIR)/.build/fossil
CONFIG_STAMP := $(BUILD_DIR)/.copland-configured
COPLAND_DIR := $(CURDIR)/tools/copland
export PATH := $(BUILD_DIR):$(PATH)
FOSSIL ?= fossil
export FOSSIL

$(COPLAND_DIR)/node_modules: $(COPLAND_DIR)/package.json $(COPLAND_DIR)/package-lock.json
	cd $(COPLAND_DIR) && npm ci

$(CONFIG_STAMP): configure Makefile shell.nix
	mkdir -p $(BUILD_DIR)
	@if [ -f $(BUILD_DIR)/Makefile ]; then $(MAKE) -C $(BUILD_DIR) clean; fi
	cd $(BUILD_DIR) && ../../configure --disable-fusefs --json
	touch $(CONFIG_STAMP)

fossil: $(CONFIG_STAMP)
	$(MAKE) -C $(BUILD_DIR) -j$${BUILD_JOBS:-2} fossil

build: $(COPLAND_DIR)/node_modules
	cd $(COPLAND_DIR) && npm run build

start: fossil build
	$(COPLAND_DIR)/scripts/preview.sh

preview: start

test-org: fossil
	$(COPLAND_DIR)/tests/org-renderer.sh

test-fossil-org: fossil
	$(MAKE) -C $(BUILD_DIR) test TESTFLAGS='org.test wiki.test'

test-smoke: fossil build
	$(COPLAND_DIR)/tests/smoke.sh

test-visual: fossil build
	cd $(COPLAND_DIR) && npm run test:visual

test-upstream: fossil
	$(MAKE) -C $(BUILD_DIR) test

test: test-fossil-org test-org test-smoke test-visual

clean:
	@if [ -d .copland-preview ]; then mv .copland-preview ".copland-preview.old.$$(date +%s)"; fi
	@if [ -d tools/copland/test-output ]; then mv tools/copland/test-output "tools/copland/test-output.old.$$(date +%s)"; fi
	@if [ -d tools/copland/playwright-report ]; then mv tools/copland/playwright-report "tools/copland/playwright-report.old.$$(date +%s)"; fi