This repository was archived by the owner on Jan 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (35 loc) · 1.4 KB
/
Makefile
File metadata and controls
47 lines (35 loc) · 1.4 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
MAKEFLAGS += --no-builtin-rules
BIKESHED ?= bikeshed
HTMLDIR ?= build
ORIGIN ?= origin
BIKESHED_PAGES =
.DEFAULT_GOAL ::= all
.PHONY: all clean
RM = $(if $(OS),rd /S /Q,rm -r)
EXTRACT = rg --no-line-number --with-filename 'Shortname: ([PD].*)$$' --replace '$$1'
GITHUB_REPOSITORY ?= $(shell git remote get-url origin --push | rg --no-line-number "^.*github.com[:/](.+)[.]git" --replace '$$1')
GITHUB_SHA ?= HEAD
BIKESHEDFLAGS += --md-local-boilerplate="computed-metadata yes"
BIKESHEDFLAGS += --md-repository=$(GITHUB_REPOSITORY)
BIKESHEDFLAGS += --md-text-macro="GITHUB-SHA $(GITHUB_SHA)"
BIKESHEDFLAGS += --md-text-macro="TAB   "
BOILERPLATE := $(wildcard src/*.include)
define bikeshed-target =
$$(HTMLDIR)/$(lastword $(1)).html: BIKESHEDFLAGS += --md-text-macro="FILENAME $$<"
$$(HTMLDIR)/$(lastword $(1)).html: $(firstword $(1)) $(BOILERPLATE) | $$(HTMLDIR)
@$$(BIKESHED) spec --gh-token "$$(GITHUB_TOKEN)" $$< $$@ $$(BIKESHEDFLAGS)
$$(info [BIKE]: $$(basename $$(@F)) -- $$(<F))
BIKESHED_PAGES += $$(HTMLDIR)/$(lastword $(1)).html
endef
extract-name = $(shell ${EXTRACT} $(1))
proposals = $(wildcard src/*.bs)
targets = $(foreach filename,${proposals},$(call extract-name,${filename}))
$(foreach target,$(targets),$(eval $(call bikeshed-target,$(subst :, ,$(target)))))
all: $(BIKESHED_PAGES)
$(BIKESHED_PAGES): $(HTMLDIR)
$(HTMLDIR):
@mkdir $@
clean:
@${RM} $(HTMLDIR)
watch:
watchexec -- $(MAKE) -j