aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 26a66887992873aa8582179e0bce058aa6670459 (plain)
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
DOCBUILD=doctools/docbuild

VERBOSE=--verbose

FETCHTS=.fetch.ts
LOCALFETCH=.LocalFetch.ts

all: help

help:
	@echo -e "Usage:"
	@echo -e "- make clean: clean all generated files"
	@echo -e "- make fetch VERSIONS=[VERSION,...] SECTIONS=[SECTION,...]: fetch the site if necessary "
	@echo -e "- make localFetch VERSIONS=[VERSION,...] SECTIONS=[SECTION,...]: fetch the site if necessary but use local file."
	@echo -e "- make build VERSIONS=[VERSION,...] SECTIONS=[SECTION,...]: build the site"
	@echo -e "- make push  VERSIONS=[VERSION,...] SECTIONS=[SECTION,...]: push the built site"
	@echo -e "- make serve VERSIONS=[VERSION,...] SECTIONS=[SECTION,...]: serve the site"
	@echo -e "- make linkchecker: check link in the local site, PORT=[default:4000]"
	@echo -e
	@echo -e "VERSIONS="
	@echo -e "\t represents the desired versions, separated with ,"
	@echo -e "SECTIONS="
	@echo -e "\t represents the desired sections, separated with ,"

.PHONY: clean
clean:
	$(DOCBUILD) $(VERBOSE) --clean
	rm -f $(FETCHTS)
	rm -f $(LOCALFETCH)

$(LOCALFETCH): $(wildcard content/toc/*/fetched_files.yml)
	$(DOCBUILD) $(VERBOSE) --localFetch --fetch --force
	touch $(FETCHTS)
	touch $@

$(FETCHTS): $(wildcard content/toc/*/fetched_files.yml)
	$(DOCBUILD) $(VERBOSE) $(LOCAL_FETCHTS) --fetch --force --versions=$(VERSIONS) --sections=$(SECTIONS)
	touch $@

.PHONY: fetch
fetch: $(FETCHTS)
	@echo "Fetched files up to date."

.PHONY: localFetch
localFetch: $(LOCALFETCH) $(FETCHTS)
	@echo "Fetched files up to date and copy local file."

.PHONY: build
build: $(FETCHTS)
	$(DOCBUILD) $(VERBOSE) --build

.PHONY: push
push: $(FETCHTS)
	$(DOCBUILD) $(VERBOSE) --build --push

.PHONY: serve
serve: $(FETCHTS)
	$(DOCBUILD) $(VERBOSE) --build --serve

.PHONY: linkchecker
linkchecker: $(FETCHS)
	@which linkchecker &> /dev/null || { echo "No linkchecker found, please install linkchecker"; exit -1; }
	@curl http://localhost:4000 &> /dev/null || { echo "No localhost:4000 found: Please run make serve before checking localsite"; exit -1; }
	linkchecker http://localhost:4000