79 lines
2.1 KiB
Makefile
79 lines
2.1 KiB
Makefile
PAGES := index.html 404.html javascript.html contact.html
|
|
SHARED_FILES := stallman.webp stallman_2024.webp favicon.ico \
|
|
poster_cz.webp poster_en.webp poster_cz.jpg poster_en.jpg \
|
|
word_cloud_cz.png word_cloud_en.png background.jpg \
|
|
moon.svg sun.svg narrow_light.svg narrow_dark.svg wide_light.svg wide_dark.svg lang_cz.svg lang_en.svg \
|
|
styles.css icons.css \
|
|
countdown.js theme.js lang.js \
|
|
jetbrains_mono.ttf
|
|
SEARCH_REPLACE := lib/search_and_replace/target/release/search_and_replace
|
|
COMPONENTS := head.html header.html nav.html footer.html
|
|
|
|
.PHONY: build
|
|
build: $(PAGES:%=dst/cz/%) $(PAGES:%=dst/en/%) $(SHARED_FILES:%=dst/%)
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf dst
|
|
|
|
$(SEARCH_REPLACE): $(shell find lib/search_and_replace/src)
|
|
cd lib/search_and_replace && cargo build --release
|
|
|
|
define make_page
|
|
cat $(1) | \
|
|
$(SEARCH_REPLACE) \
|
|
'<!--#include virtual="components/head.html" -->' "$$(cat components/$(3)/head.html)" \
|
|
'<!--#include virtual="components/header.html" -->' "$$(cat components/$(3)/header.html)" \
|
|
'<!--#include virtual="components/nav.html" -->' "$$(cat components/$(3)/nav.html)" \
|
|
'<!--#include virtual="components/footer.html" -->' "$$(cat components/$(3)/footer.html)" \
|
|
> $(2)
|
|
endef
|
|
|
|
dst/cz/%.html: pages/cz/%.html $(SEARCH_REPLACE) $(COMPONENTS:%=components/cz/%)
|
|
@mkdir -p $(@D)
|
|
$(call make_page,$<,$@,cz)
|
|
|
|
dst/en/%.html: pages/en/%.html $(SEARCH_REPLACE) $(COMPONENTS:%=components/en/%)
|
|
@mkdir -p $(@D)
|
|
$(call make_page,$<,$@,en)
|
|
|
|
dst/%.css: styles/%.css
|
|
@mkdir -p $(@D)
|
|
ln -f $< $@
|
|
|
|
dst/%.js: scripts/%.js
|
|
@mkdir -p $(@D)
|
|
ln -f $< $@
|
|
|
|
dst/poster_%.webp: images/poster_%.png
|
|
@mkdir -p $(@D)
|
|
magick $< -resize 2000x2000 $@
|
|
|
|
dst/poster_%.jpg: images/poster_%.png
|
|
@mkdir -p $(@D)
|
|
magick $< -resize 2000x2000 $@
|
|
|
|
dst/word_cloud_%.png: images/word_cloud_%.png
|
|
@mkdir -p $(@D)
|
|
magick $< -resize 2000x2000 $@
|
|
|
|
dst/%.jpg: images/%.jpg
|
|
@mkdir -p $(@D)
|
|
ln -f $< $@
|
|
|
|
dst/%.webp: images/%.jpg
|
|
@mkdir -p $(@D)
|
|
magick $< $@
|
|
|
|
dst/%.svg: icons/%.svg
|
|
@mkdir -p $(@D)
|
|
ln -f $< $@
|
|
|
|
dst/favicon.ico: images/favicon.ico
|
|
@mkdir -p $(@D)
|
|
ln -f $< $@
|
|
|
|
dst/%.ttf: fonts/%.ttf
|
|
@mkdir -p $(@D)
|
|
ln -f $< $@
|