Fixed Makefile; fixed historical Source links.
This commit is contained in:
parent
a79af92920
commit
bfc0b7f598
1 changed files with 22 additions and 16 deletions
38
Makefile
38
Makefile
|
@ -21,6 +21,12 @@ else
|
||||||
AGDA_STDLIB_URL := https://agda.github.io/agda-stdlib/v$(AGDA_STDLIB_VERSION)/
|
AGDA_STDLIB_URL := https://agda.github.io/agda-stdlib/v$(AGDA_STDLIB_VERSION)/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(shell sed --version >/dev/null 2>&1; echo $$?),1)
|
||||||
|
SEDI := sed -i ""
|
||||||
|
else
|
||||||
|
SEDI := sed -i
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
# Build PLFA web version and test links
|
# Build PLFA web version and test links
|
||||||
default: test
|
default: test
|
||||||
|
@ -52,11 +58,15 @@ build-incremental: $(MARKDOWN_FILES)
|
||||||
# Download PLFA web releases
|
# Download PLFA web releases
|
||||||
build-history: latest/ $(RELEASES)
|
build-history: latest/ $(RELEASES)
|
||||||
|
|
||||||
latest/: $(addprefix .versions/plfa.github.io-web-,$(addsuffix /,$(LATEST_VERSION))) | .versions/
|
latest/: $(addprefix .versions/plfa.github.io-web-,$(addsuffix /,$(LATEST_VERSION)))
|
||||||
cd $< && $(JEKYLL) clean && $(JEKYLL) build --destination '../../latest' --baseurl '/latest'
|
$(SEDI) "s/branch: dev/branch: dev-$(LATEST_VERSION)/" $(addsuffix _config.yml,$<)
|
||||||
|
cd $< \
|
||||||
|
&& $(JEKYLL) clean \
|
||||||
|
&& $(JEKYLL) build --destination '../../latest' --baseurl '/latest'
|
||||||
|
|
||||||
# Download PLFA web release and build it under the relevant folder
|
# Download PLFA web release and build it under the relevant folder
|
||||||
define build_release
|
define build_release
|
||||||
|
version := $(1)
|
||||||
out := $(addsuffix /,$(1))
|
out := $(addsuffix /,$(1))
|
||||||
url := $(addprefix https://github.com/plfa/plfa.github.io/archive/web-,$(addsuffix .zip,$(1)))
|
url := $(addprefix https://github.com/plfa/plfa.github.io/archive/web-,$(addsuffix .zip,$(1)))
|
||||||
tmp_zip := $(addprefix .versions/plfa.github.io-web-,$(addsuffix .zip,$(1)))
|
tmp_zip := $(addprefix .versions/plfa.github.io-web-,$(addsuffix .zip,$(1)))
|
||||||
|
@ -66,18 +76,21 @@ baseurl := $(addprefix /,$(1))
|
||||||
$$(tmp_zip): tmp_zip = $(addprefix .versions/plfa.github.io-web-,$(addsuffix .zip,$(1)))
|
$$(tmp_zip): tmp_zip = $(addprefix .versions/plfa.github.io-web-,$(addsuffix .zip,$(1)))
|
||||||
$$(tmp_zip): url = $(addprefix https://github.com/plfa/plfa.github.io/archive/web-,$(addsuffix .zip,$(1)))
|
$$(tmp_zip): url = $(addprefix https://github.com/plfa/plfa.github.io/archive/web-,$(addsuffix .zip,$(1)))
|
||||||
$$(tmp_zip):
|
$$(tmp_zip):
|
||||||
|
@mkdir -p .versions/
|
||||||
wget -c $$(url) -O $$(tmp_zip)
|
wget -c $$(url) -O $$(tmp_zip)
|
||||||
|
|
||||||
$$(tmp_dir): tmp_dir = $(addprefix .versions/plfa.github.io-web-,$(addsuffix /,$(1)))
|
$$(tmp_dir): tmp_dir = $(addprefix .versions/plfa.github.io-web-,$(addsuffix /,$(1)))
|
||||||
$$(tmp_dir): tmp_zip = $(addprefix .versions/plfa.github.io-web-,$(addsuffix .zip,$(1)))
|
$$(tmp_dir): tmp_zip = $(addprefix .versions/plfa.github.io-web-,$(addsuffix .zip,$(1)))
|
||||||
$$(tmp_dir): $$(tmp_zip) | .versions/
|
$$(tmp_dir): $$(tmp_zip)
|
||||||
unzip -qq $$(tmp_zip) -d .versions/
|
yes | unzip -qq $$(tmp_zip) -d .versions/
|
||||||
|
|
||||||
|
$$(out): version = $(1)
|
||||||
$$(out): out = $(addsuffix /,$(1))
|
$$(out): out = $(addsuffix /,$(1))
|
||||||
$$(out): url = $(addprefix https://github.com/plfa/plfa.github.io/archive/web-,$(addsuffix .zip,$(1)))
|
$$(out): url = $(addprefix https://github.com/plfa/plfa.github.io/archive/web-,$(addsuffix .zip,$(1)))
|
||||||
$$(out): tmp_dir = $(addprefix .versions/plfa.github.io-web-,$(addsuffix /,$(1)))
|
$$(out): tmp_dir = $(addprefix .versions/plfa.github.io-web-,$(addsuffix /,$(1)))
|
||||||
$$(out): baseurl = $(addprefix /,$(1))
|
$$(out): baseurl = $(addprefix /,$(1))
|
||||||
$$(out): $$(tmp_dir)
|
$$(out): $$(tmp_dir)
|
||||||
|
$(SEDI) "s/branch: dev/branch: dev-$$(version)/" $$(addsuffix _config.yml,$$(tmp_dir))
|
||||||
cd $$(tmp_dir) \
|
cd $$(tmp_dir) \
|
||||||
&& rm -rf _posts \
|
&& rm -rf _posts \
|
||||||
&& $(JEKYLL) clean \
|
&& $(JEKYLL) clean \
|
||||||
|
@ -87,10 +100,6 @@ endef
|
||||||
# Incorporate previous releases of PLFA web version
|
# Incorporate previous releases of PLFA web version
|
||||||
$(foreach release_version,$(RELEASE_VERSIONS),$(eval $(call build_release,$(release_version))))
|
$(foreach release_version,$(RELEASE_VERSIONS),$(eval $(call build_release,$(release_version))))
|
||||||
|
|
||||||
.versions/:
|
|
||||||
mkdir -p .versions/
|
|
||||||
|
|
||||||
|
|
||||||
# Convert literal Agda to Markdown using highlight.sh
|
# Convert literal Agda to Markdown using highlight.sh
|
||||||
define AGDA_template
|
define AGDA_template
|
||||||
in := $(1)
|
in := $(1)
|
||||||
|
@ -99,6 +108,7 @@ $$(out) : in = $(1)
|
||||||
$$(out) : out = $(subst courses/,out/,$(subst src/,out/,$(subst .lagda.md,.md,$(1))))
|
$$(out) : out = $(subst courses/,out/,$(subst src/,out/,$(subst .lagda.md,.md,$(1))))
|
||||||
$$(out) : $$(in) | out/
|
$$(out) : $$(in) | out/
|
||||||
@echo "Processing $$(subst ./,,$$(in))"
|
@echo "Processing $$(subst ./,,$$(in))"
|
||||||
|
@mkdir -p out/
|
||||||
ifeq (,$$(findstring courses/,$$(in)))
|
ifeq (,$$(findstring courses/,$$(in)))
|
||||||
./highlight.sh $$(subst ./,,$$(in)) --include-path=src/
|
./highlight.sh $$(subst ./,,$$(in)) --include-path=src/
|
||||||
else
|
else
|
||||||
|
@ -126,9 +136,6 @@ test-stable-offline: $(MARKDOWN_FILES)
|
||||||
$(JEKYLL) build --destination '_site/stable' --baseurl '/stable'
|
$(JEKYLL) build --destination '_site/stable' --baseurl '/stable'
|
||||||
$(HTMLPROOFER) '_site' --disable-external
|
$(HTMLPROOFER) '_site' --disable-external
|
||||||
|
|
||||||
out/:
|
|
||||||
mkdir -p out/
|
|
||||||
|
|
||||||
.phony: test test-offline test-stable-offline
|
.phony: test test-offline test-stable-offline
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,6 +147,7 @@ epubcheck: out/epub/plfa.epub
|
||||||
$(EPUBCHECK) out/epub/plfa.epub
|
$(EPUBCHECK) out/epub/plfa.epub
|
||||||
|
|
||||||
out/epub/plfa.epub: out/epub/ | $(AGDA_FILES) $(LUA_FILES) epub/main.css out/epub/acknowledgements.md
|
out/epub/plfa.epub: out/epub/ | $(AGDA_FILES) $(LUA_FILES) epub/main.css out/epub/acknowledgements.md
|
||||||
|
@mkdir -p out/epub/
|
||||||
$(PANDOC) --strip-comments \
|
$(PANDOC) --strip-comments \
|
||||||
--css=epub/main.css \
|
--css=epub/main.css \
|
||||||
--epub-embed-font='assets/fonts/mononoki.woff' \
|
--epub-embed-font='assets/fonts/mononoki.woff' \
|
||||||
|
@ -157,19 +165,16 @@ out/epub/plfa.epub: out/epub/ | $(AGDA_FILES) $(LUA_FILES) epub/main.css out/epu
|
||||||
epub/index.md
|
epub/index.md
|
||||||
|
|
||||||
out/epub/acknowledgements.md: src/plfa/acknowledgements.md _config.yml
|
out/epub/acknowledgements.md: src/plfa/acknowledgements.md _config.yml
|
||||||
|
@mkdir -p out/epub/
|
||||||
$(BUNDLE) exec ruby epub/render-liquid-template.rb _config.yml $< $@
|
$(BUNDLE) exec ruby epub/render-liquid-template.rb _config.yml $< $@
|
||||||
|
|
||||||
out/epub/:
|
|
||||||
mkdir -p out/epub/
|
|
||||||
|
|
||||||
.phony: epub epubcheck
|
.phony: epub epubcheck
|
||||||
|
|
||||||
|
|
||||||
# Clean auxiliary files
|
# Clean auxiliary files
|
||||||
clean:
|
clean:
|
||||||
rm -f .agda-stdlib.sed .links-*.sed out/epub/acknowledgements.md
|
rm -f .agda-stdlib.sed .links-*.sed out/epub/acknowledgements.md
|
||||||
rm -f plfa.github.io-web-*.zip
|
rm -rf .versions
|
||||||
rm -rf plfa.github.io-web-*/
|
|
||||||
ifneq ($(strip $(AGDAI_FILES)),)
|
ifneq ($(strip $(AGDAI_FILES)),)
|
||||||
rm $(AGDAI_FILES)
|
rm $(AGDAI_FILES)
|
||||||
endif
|
endif
|
||||||
|
@ -178,6 +183,7 @@ endif
|
||||||
clobber: clean
|
clobber: clean
|
||||||
$(JEKYLL) clean
|
$(JEKYLL) clean
|
||||||
rm -rf out/
|
rm -rf out/
|
||||||
|
rm -rf latest/ $(RELEASES)
|
||||||
|
|
||||||
.phony: clean clobber
|
.phony: clean clobber
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue