reorganise make stuff

This commit is contained in:
Rhiannon Morris 2020-07-24 15:20:10 +02:00
parent 0f0073ba77
commit 59c226111e
4 changed files with 106 additions and 38 deletions

View file

@ -63,20 +63,10 @@ dependGallery' (GalleryInfo {title, description, prefix, filters})
$@index: $@path
$@path: $@pages' $@files' $@rss $$(MAKEPAGES)
echo "[gallery] "$$@
mkdir -p $$(dir $$@)
$$(MAKEPAGES) $$(MPFLAGS) gallery \
-p "$@prefix" -t "$*title" $flags -o "$$@" \
$$(filter $$(DATADIR)/%/$$(INFONAME),$$^)
$$(call gallery,$title',$@prefix,$flags)
$@rss: $@files' $$(MAKEPAGES)
echo "[rss] "$$@
mkdir -p $$(dir $$@)
$$(MAKEPAGES) $$(MPFLAGS) rss -t "$*title" \
-d "$*description" \
-R "$$(ROOT)" -p "$@prefix" \
-o "$$@" -D "$@data_" \
$$(filter $$(DATADIR)/%/$$(INFONAME),$$^)
$$(call rss,$title',$description',$@prefix,$@data_)
$rules
@ -84,6 +74,9 @@ dependGallery' (GalleryInfo {title, description, prefix, filters})
|]
where
flags = filtersToFlags filters
title' = substComma title
description' = substComma description
substComma = textMap \case ',' -> "$(comma)"; c -> fromChar c
makeRules :: FilePath -- ^ prefix
-> GalleryFilters
@ -93,31 +86,16 @@ makeRules :: FilePath -- ^ prefix
-> Builder
makeRules prefix filters build data_ tmp = [b|@0
$@buildPrefix/%/index.html: $@data_/%/info.yaml $$(MAKEPAGES)
echo "[single] "$$@
mkdir -p $$(dir $$@)
$$(MAKEPAGES) $$(MPFLAGS) single -D "$@data_" "$$<" -o "$$@" $flags
$$(call single,$@data_,$flags)
$@tmpPrefix/%.mk: $@data_/%/info.yaml $$(MAKEPAGES)
echo "[deps] "$$@
mkdir -p $$(dir $$@)
$$(MAKEPAGES) $$(MPFLAGS) depend-single $flags \
-o "$$@" -p "$@prefix" -B "$@build" -D "$@data_" $$<
$$(call depend-single,$@prefix,$@build,$@data_,$flags)
$@buildPrefix/%: $@tmp/%
$$(call copy)
$@buildPrefix/%: $@data_/%
echo "[copy] "$$@
mkdir -p $$(dir $$@)
cp "$$<" "$$@"
$@buildPrefix/%_small.png: $@data_/%.png
echo "[resize] "$$@
mkdir -p $$(dir $$@)
convert -resize '$$(SMALL)x$$(SMALL)^' \
-gravity center -crop 1:1+0 "$$<" "$$@"
$@buildPrefix/%_med.png: $@data_/%.png
echo "[resize] "$$@
mkdir -p $$(dir $$@)
convert -resize '$$(MEDW)x$$(MEDH)>' "$$<" "$$@"
$$(call copy)
|]
where
buildPrefix = build </> prefix